SceneKasizukiMainMenu.cs 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198
  1. using System;
  2. using System.Collections.Generic;
  3. using Kasizuki;
  4. using UnityEngine;
  5. public class SceneKasizukiMainMenu : WfScreenManager
  6. {
  7. public WfScreenMoveChildren moveScreen
  8. {
  9. get
  10. {
  11. return this.m_MoveScreen;
  12. }
  13. }
  14. public void Awake()
  15. {
  16. this.m_advKag = GameMain.Instance.ScriptMgr.adv_kag;
  17. }
  18. public override void Start()
  19. {
  20. base.Start();
  21. this.m_MoveScreen = base.children_dic["Move"].GetComponent<WfScreenMoveChildren>();
  22. BgMgr bgMgr = GameMain.Instance.BgMgr;
  23. bgMgr.ChangeBg("EmpireClub_Entrance");
  24. GameMain.Instance.MainLight.Reset();
  25. GameMain.Instance.CharacterMgr.ResetCharaPosAll();
  26. GameMain.Instance.MainCamera.Reset(CameraMain.CameraType.Target, true);
  27. GameMain.Instance.SoundMgr.VoiceStopAll();
  28. this.GetTagBackup();
  29. CharacterMgr characterMgr = GameMain.Instance.CharacterMgr;
  30. for (int i = 0; i < characterMgr.GetMaidCount(); i++)
  31. {
  32. if (characterMgr.GetMaid(i) != null)
  33. {
  34. characterMgr.GetMaid(i).Visible = false;
  35. }
  36. }
  37. this.UpdateMan(delegate
  38. {
  39. this.CallScreen("MainMenu");
  40. });
  41. GameMain.Instance.SoundMgr.PlayBGM(this.m_MusicName + ".ogg", 0.5f, true);
  42. if (!uGUITutorialPanel.IsOpened())
  43. {
  44. uGUITutorialPanel.OpenTutorial("SceneKasizukiMainMenu", null, false);
  45. }
  46. }
  47. protected override void SettingChildrenList(Dictionary<string, WfScreenChildren> children_dic)
  48. {
  49. string[] array = new string[]
  50. {
  51. "MainMenu",
  52. "MaidInfo",
  53. "Move"
  54. };
  55. for (int i = 0; i < array.Length; i++)
  56. {
  57. WfScreenChildren component = UTY.GetChildObject(base.gameObject, array[i], false).GetComponent<WfScreenChildren>();
  58. if (component == null)
  59. {
  60. NDebug.Assert(string.Format("オブジェクト「{0}」は見つかりましたが、WfScreenChildrenコンポーネントがありません", array[i]), false);
  61. }
  62. component.parent_mgr = this;
  63. children_dic.Add(array[i], component);
  64. }
  65. }
  66. private void GetTagBackup()
  67. {
  68. Dictionary<string, string> tag_backup = this.m_advKag.tag_backup;
  69. if (tag_backup != null && tag_backup.Count > 0)
  70. {
  71. string a;
  72. if (tag_backup.TryGetValue("name", out a))
  73. {
  74. if (a == "SceneKasizukiMainMenu")
  75. {
  76. string empty = string.Empty;
  77. if (tag_backup.TryGetValue("label", out empty))
  78. {
  79. this.strScriptReturnLabel = empty;
  80. }
  81. else
  82. {
  83. NDebug.Warning(string.Format("スクリプトからの引数「{0}」がありませんでした", "label"));
  84. }
  85. if (tag_backup.TryGetValue("label_free", out empty))
  86. {
  87. this.strScriptReturnLabelFree = empty;
  88. }
  89. else
  90. {
  91. NDebug.Warning(string.Format("スクリプトからの引数「{0}」がありませんでした", "label_free"));
  92. }
  93. if (tag_backup.TryGetValue("edit_label", out empty))
  94. {
  95. this.strScriptReturnLabelEdit = empty;
  96. }
  97. this.isReturnEdit = tag_backup.ContainsKey("return_edit");
  98. this.isUpdateMaidStatus = tag_backup.ContainsKey("update_maid_status");
  99. }
  100. }
  101. else
  102. {
  103. Debug.Log("スクリプトからの引数がありませんでした");
  104. }
  105. }
  106. }
  107. public void UpdateMan(Action callback)
  108. {
  109. int nowManType = GameMain.Instance.KasizukiMgr.GetNowManType();
  110. ManData.Data data = ManData.GetData(nowManType);
  111. Maid man = GameMain.Instance.KasizukiMgr.GetMan();
  112. GameMain.Instance.KasizukiMgr.SetManModel(man, data.manType);
  113. GameMain.Instance.KasizukiMgr.UpdateManModel(man, delegate
  114. {
  115. if (callback != null)
  116. {
  117. callback();
  118. }
  119. this.UpdateManEnd();
  120. });
  121. }
  122. private void UpdateManEnd()
  123. {
  124. Maid man = GameMain.Instance.KasizukiMgr.GetMan();
  125. man.body0.SetChinkoVisible(false);
  126. man.CrossFade("man_porse01.anm", false, true, false, 0f, 1f);
  127. }
  128. private void OnDestroy()
  129. {
  130. if (this.isQuit)
  131. {
  132. return;
  133. }
  134. this.CameraFadeOut(delegate
  135. {
  136. GameMain.Instance.KasizukiMgr.SetNowManType(ManDataType.主人公);
  137. this.UpdateMan(delegate
  138. {
  139. this.CameraFadeIn(null);
  140. });
  141. }, 0.01f);
  142. }
  143. private void OnApplicationQuit()
  144. {
  145. this.isQuit = true;
  146. }
  147. public void CameraFadeIn(Action onEnd)
  148. {
  149. CameraMain.dgOnCompleteFade dgOnCompleteFade = null;
  150. if (onEnd != null)
  151. {
  152. dgOnCompleteFade = new CameraMain.dgOnCompleteFade(onEnd.Invoke);
  153. }
  154. CameraMain mainCamera = GameMain.Instance.MainCamera;
  155. CameraMain.dgOnCompleteFade f_dg = dgOnCompleteFade;
  156. mainCamera.FadeIn(0.5f, false, f_dg, true, true, default(Color));
  157. }
  158. public void CameraFadeOut(Action onEnd, float time = 0.5f)
  159. {
  160. CameraMain.dgOnCompleteFade dgOnCompleteFade = null;
  161. if (onEnd != null)
  162. {
  163. dgOnCompleteFade = new CameraMain.dgOnCompleteFade(onEnd.Invoke);
  164. }
  165. CameraMain mainCamera = GameMain.Instance.MainCamera;
  166. CameraMain.dgOnCompleteFade f_dg = dgOnCompleteFade;
  167. mainCamera.FadeOut(time, false, f_dg, true, default(Color));
  168. }
  169. public string strScriptReturnLabel { get; private set; }
  170. public string strScriptReturnLabelEdit { get; private set; }
  171. public string strScriptReturnLabelFree { get; private set; }
  172. public bool isReturnEdit { get; private set; }
  173. public bool isUpdateMaidStatus { get; private set; }
  174. private WfScreenMoveChildren m_MoveScreen;
  175. private ADVKagManager m_advKag;
  176. public string m_MusicName = "BGM020";
  177. private bool isQuit;
  178. }