123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285 |
- 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<UIPanel>();
- this.sprite_ = UTY.GetChildObject(base.gameObject, "Image", false).GetComponent<UI2DSprite>();
- this.ok_button_ = UTY.GetChildObject(base.gameObject, "OK", false).GetComponent<UIButton>();
- 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<GameObject> list = new List<GameObject>();
- 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<UIGrid>();
- string[] array = new string[]
- {
- "このヘルプについて",
- "メイドを配置・選択をする",
- "メイドの移動や表示設定",
- "メイドのモーションを設定する",
- "メイドの表情を設定する",
- "メイドにアイテムを持たせる",
- "背景を変更する",
- "背景にオブジェクトを追加・削除する",
- "背景やオブジェクトの移動・表示設定",
- "ポーズエディットを開始する",
- "ポーズを編集する",
- "指先ブレンドを使う",
- "ショートカット一覧"
- };
- for (int i = 0; i < list.Count; i++)
- {
- GameObject gameObject2 = Utility.CreatePrefab(component.gameObject, "SceneTutorial/PhotModeTutorialItemBtn", true);
- gameObject2.GetComponentInChildren<UILabel>().text = array[i];
- gameObject2.GetComponent<PhotoTutorialButton>().SetTarget(list[i]);
- }
- component.Reposition();
- NGUITools.FindInParents<UIScrollView>(component.transform).ResetPosition();
- }
- UTY.GetChildObject(base.gameObject, "PhotoPanel/LeftPanel/Contents/UnitParent", false).GetComponent<UIGrid>().GetChild(0).GetComponent<PhotoTutorialButton>().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<UISprite>();
- 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<TutorialPanel.ImageSet, string[]> image_set_dic_ = new Dictionary<TutorialPanel.ImageSet, string[]>();
- 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
- }
- }
|