using System; using System.Collections.Generic; using PlayerStatus; using UnityEngine; using wf; public class TutorialPanel : MonoBehaviour { public void Awake() { this.current_page_ = 0; this.main_panel_ = base.gameObject.GetComponent(); this.sprite_ = UTY.GetChildObject(base.gameObject, "Image", false).GetComponent(); this.ok_button_ = UTY.GetChildObject(base.gameObject, "OK", false).GetComponent(); EventDelegate.Add(this.ok_button_.onClick, new EventDelegate.Callback(this.OnClickNext)); this.image_set_dic_.Add(TutorialPanel.ImageSet.MainMenu, new string[] { "cm3d2_tutorial_hirumenu00" }); this.image_set_dic_.Add(TutorialPanel.ImageSet.Schedule, new string[] { "cm3d2_tutorial_schedule00" }); this.image_set_dic_.Add(TutorialPanel.ImageSet.Yotogi, new string[] { "cm3d2_tutorial_skillselect00", "cm3d2_tutorial_skillselect01" }); this.image_set_dic_.Add(TutorialPanel.ImageSet.Edit, new string[] { "cm3d2_tutorial_maidpoint" }); this.image_set_dic_.Add(TutorialPanel.ImageSet.DeskCustom, new string[] { "cm3d2_tutorial_deskcustom" }); this.image_set_dic_.Add(TutorialPanel.ImageSet.PhotoMode, new string[] { "cm3d2_tutorial_bg" }); this.ok_button_.gameObject.SetActive(true); } public void Start() { this.CheckCallAwake(); if (base.gameObject.activeSelf) { base.gameObject.SetActive(false); } } public void OnDestroy() { this.DestroyImage(); } public void Reset() { this.CheckCallAwake(); this.DestroyImage(); iTween.Stop(base.gameObject); this.ok_button_.isEnabled = false; this.main_panel_.alpha = 0f; base.gameObject.SetActive(false); } public void SetImage(TutorialPanel.ImageSet image_set, bool absolut_call = false) { if (!absolut_call) { return; } string flagName = "__チュートリアルフラグ_" + image_set.ToString(); Status status = GameMain.Instance.CharacterMgr.status; if (this.image_set_dic_.ContainsKey(image_set)) { if (status.GetFlag(flagName) == 0 || absolut_call) { this.SetImage(this.image_set_dic_[image_set]); if (image_set == TutorialPanel.ImageSet.PhotoMode) { GameObject childObject = UTY.GetChildObject(base.gameObject, "PhotoPanel", false); childObject.SetActive(true); if (UTY.GetChildObject(childObject, "RightPanel", true) == null) { GameObject gameObject = Utility.CreatePrefab(childObject, "SceneTutorial/PhotoTutorialRightPanel", true); gameObject.name = "RightPanel"; gameObject.SetActive(true); gameObject.transform.localPosition = Vector3.zero; GameObject childObject2 = UTY.GetChildObject(gameObject, "Field/Contents/Parent/Space", false); List list = new List(); int num = 0; for (;;) { GameObject childObject3 = UTY.GetChildObject(childObject2, "Btn" + (num + 1).ToString(), true); if (childObject3 == null) { break; } childObject3.SetActive(true); list.Add(childObject3); num++; } UIGrid component = UTY.GetChildObject(childObject, "LeftPanel/Contents/UnitParent", false).GetComponent(); string[] array = new string[] { "このヘルプについて", "メイドを配置・選択をする", "メイドの移動や表示設定", "メイドのモーションを設定する", "メイドの表情を設定する", "メイドにアイテムを持たせる", "背景を変更する", "背景にオブジェクトを追加・削除する", "背景やオブジェクトの移動・表示設定", "ポーズエディットを開始する", "ポーズを編集する", "指先ブレンドを使う", "ショートカット一覧" }; for (int i = 0; i < list.Count; i++) { GameObject gameObject2 = Utility.CreatePrefab(component.gameObject, "SceneTutorial/PhotModeTutorialItemBtn", true); gameObject2.GetComponentInChildren().text = array[i]; gameObject2.GetComponent().SetTarget(list[i]); } component.Reposition(); NGUITools.FindInParents(component.transform).ResetPosition(); } UTY.GetChildObject(base.gameObject, "PhotoPanel/LeftPanel/Contents/UnitParent", false).GetComponent().GetChild(0).GetComponent().OnClickEvent(); } else { UTY.GetChildObject(base.gameObject, "PhotoPanel", false).gameObject.SetActive(false); } } status.SetFlag(flagName, 1); } } public void SetImage(string[] file_name_array) { this.CheckCallAwake(); if (file_name_array == null || file_name_array.Length == 0) { return; } base.gameObject.SetActive(true); this.ok_button_.isEnabled = false; this.main_panel_.alpha = 0f; this.file_name_array_ = new string[file_name_array.Length]; file_name_array.CopyTo(this.file_name_array_, 0); this.current_page_ = -1; this.OnClickNext(); iTween.ValueTo(base.gameObject, iTween.Hash(new object[] { "easetype", iTween.EaseType.easeOutQuad, "from", 0f, "to", 1f, "time", 0.5f, "delay", 0, "onUpdate", "OnUpdateFade", "onComplete", "OnFadeInEnd" })); } private void OnFadeInEnd() { this.ok_button_.isEnabled = true; } private bool SetPage(int page) { if (this.file_name_array_ == null || this.file_name_array_.Length <= page || page < 0) { return false; } this.DestroyImage(); string text = string.Empty + this.file_name_array_[page] + ".tex"; if (GameUty.FileSystem.IsExistentFile(text)) { Texture2D texture2D = ImportCM.CreateTexture(text); Sprite sprite = Sprite.Create(texture2D, new Rect(0f, 0f, (float)texture2D.width, (float)texture2D.height), default(Vector2)); sprite.name = text; this.sprite_.sprite2D = sprite; this.sprite_.SetDimensions(texture2D.width, texture2D.height); UISprite component = this.ok_button_.gameObject.GetComponent(); if (page == this.file_name_array_.Length - 1) { if (this.ok_button_.normalSprite != "cm3d2_common_okbuttom") { this.ok_button_.normalSprite = "cm3d2_common_okbuttom"; } } else if (this.ok_button_.normalSprite != "cm3d2_common_nextbuttom") { this.ok_button_.normalSprite = "cm3d2_common_nextbuttom"; } return true; } return false; } private void CheckCallAwake() { if (this.sprite_ == null) { this.Awake(); } } private void OnClickNext() { this.current_page_++; if (!this.SetPage(this.current_page_)) { this.ok_button_.isEnabled = false; iTween.ValueTo(base.gameObject, iTween.Hash(new object[] { "easetype", iTween.EaseType.easeOutQuad, "from", 1f, "to", 0f, "time", 0.5f, "delay", 0, "onUpdate", "OnUpdateFade", "onComplete", "Reset" })); } } private void OnUpdateFade(float val) { if (base.gameObject.activeSelf) { this.main_panel_.alpha = val; } } private void DestroyImage() { if (this.sprite_ != null && this.sprite_.sprite2D != null && this.sprite_.sprite2D.texture != null) { UnityEngine.Object.DestroyImmediate(this.sprite_.sprite2D.texture); } } private Dictionary image_set_dic_ = new Dictionary(); private int current_page_; private string[] file_name_array_; private UIPanel main_panel_; private UI2DSprite sprite_; private UIButton ok_button_; public enum ImageSet { MainMenu, Trophy, Schedule, Yotogi, CompetitiveShow, Edit, DeskCustom, PhotoMode } }