DailyMgr.cs 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210
  1. using System;
  2. using System.Collections.Generic;
  3. using BackupParamAccessor;
  4. using com.workman.cm3d2.scene.dailyEtc;
  5. using Schedule;
  6. using UnityEngine;
  7. public class DailyMgr : BaseCreatePanel
  8. {
  9. public DailyMgr.Daily GetCurrentDaily()
  10. {
  11. return this.currentDaily;
  12. }
  13. public static bool IsLegacy
  14. {
  15. get
  16. {
  17. return GameMain.Instance.CharacterMgr.status.GetFlag("2.0モード") == 1;
  18. }
  19. }
  20. public override void Init()
  21. {
  22. this.m_goPanel = base.GetPanel("DailyPanel");
  23. this.m_ctrl = base.GetCtrl<DailyCtrl>();
  24. this.m_ctrl.Init(this, this.m_goPanel);
  25. if (this.sceneMgr == null)
  26. {
  27. this.sceneMgr = base.transform.parent.gameObject.GetComponent<SceneMgr>();
  28. }
  29. this.m_api = new DailyAPI(this.sceneMgr);
  30. this.m_goPanel.SetActive(false);
  31. }
  32. public void OpenDaytimePanel()
  33. {
  34. this.m_api.SceneStart(true, this, new DailyAPI.dgOnSceneStartCallBack(this.OpenDaytimeCallBack));
  35. }
  36. public void OpenDaytimeCallBack()
  37. {
  38. base.BaseOpenPanel(DailyMgr.Daily.Daytime.ToString());
  39. }
  40. public void OpenNightPanel()
  41. {
  42. this.m_api.SceneStart(false, this, new DailyAPI.dgOnSceneStartCallBack(this.OpenNightCallBack));
  43. }
  44. public void OpenNightCallBack()
  45. {
  46. base.BaseOpenPanel(DailyMgr.Daily.Night.ToString());
  47. }
  48. protected override void OpenPanel(string openType)
  49. {
  50. DailyMgr.Daily daily = (DailyMgr.Daily)Enum.Parse(typeof(DailyMgr.Daily), openType);
  51. if (daily != DailyMgr.Daily.Daytime)
  52. {
  53. if (daily == DailyMgr.Daily.Night)
  54. {
  55. this.DisplayNightPanel();
  56. }
  57. }
  58. else
  59. {
  60. this.DisplayDaytimePanel();
  61. }
  62. }
  63. private void DisplayDaytimePanel()
  64. {
  65. this.currentDaily = DailyMgr.Daily.Daytime;
  66. Debug.Log("昼パートメインをオープンしました。");
  67. GameMain.Instance.TutorialPanel.SetImage(TutorialPanel.ImageSet.MainMenu, false);
  68. this.m_ctrl.DisplayViewer(DailyMgr.Daily.Daytime);
  69. GameMain.Instance.FacilityMgr.ClearCacheFacilityPowerUpResult();
  70. Debug.Log("メイドによる施設強化のキャッシュをクリアしました。");
  71. this.m_api.SetupTutorial();
  72. if (!DailyMgr.IsLegacy)
  73. {
  74. GameMain.Instance.CharacterMgr.status.CheckTrophyMainMenu();
  75. }
  76. ScheduleAPI.ErrorCheck();
  77. }
  78. private void DisplayNightPanel()
  79. {
  80. this.currentDaily = DailyMgr.Daily.Night;
  81. Debug.Log("夜パートメインをオープンしました。");
  82. this.m_ctrl.DisplayViewer(DailyMgr.Daily.Night);
  83. GameMain.Instance.FacilityMgr.ClearCacheFacilityPowerUpResult();
  84. Debug.Log("メイドによる施設強化のキャッシュをクリアしました。");
  85. this.m_api.SetupTutorial();
  86. if (!DailyMgr.IsLegacy)
  87. {
  88. GameMain.Instance.CharacterMgr.status.CheckTrophyMainMenu();
  89. }
  90. }
  91. public void CloseDailyPanel()
  92. {
  93. if (this.currentDaily == DailyMgr.Daily.Daytime)
  94. {
  95. ScheduleAPI.BackupParam(SCENE_ID.Morning);
  96. ScheduleAPI.BackUpScheduleSlot();
  97. }
  98. if (!DailyMgr.IsLegacy)
  99. {
  100. GameMain.Instance.FacilityMgr.UpdateFacilityAssignedMaidData();
  101. }
  102. base.BaseClosePanel();
  103. }
  104. public void OnClickMenuButton()
  105. {
  106. DailyCtrl.ButtonData menuButton = this.m_ctrl.GetMenuButton(UIButton.current);
  107. if (menuButton.type == DailyCtrl.ButtonType.Schedule)
  108. {
  109. base.BaseClosePanel(new Action(base.GetManager<ScheduleMgr>().BaseOpenPanel));
  110. }
  111. else if (menuButton.type == DailyCtrl.ButtonType.Save)
  112. {
  113. base.BaseClosePanel(new Action(base.GetManager<SaveAndLoadMgr>().OpenSavePanel));
  114. }
  115. else if (menuButton.type == DailyCtrl.ButtonType.Load)
  116. {
  117. base.BaseClosePanel(new Action(base.GetManager<SaveAndLoadMgr>().OpenLoadPanel));
  118. }
  119. else if (menuButton.type == DailyCtrl.ButtonType.Next)
  120. {
  121. this.m_pressingNext = true;
  122. this.CloseDailyPanel();
  123. }
  124. else
  125. {
  126. Dictionary<DailyCtrl.ButtonType, string> dictionary = new Dictionary<DailyCtrl.ButtonType, string>();
  127. dictionary.Add(DailyCtrl.ButtonType.Dance, "label_dance");
  128. dictionary.Add(DailyCtrl.ButtonType.MaidManagement, "label_maidmanagement");
  129. dictionary.Add(DailyCtrl.ButtonType.EventScenario, "label_eventscenario");
  130. dictionary.Add(DailyCtrl.ButtonType.Shop, "label_shop");
  131. dictionary.Add(DailyCtrl.ButtonType.FacilityManagement, "label_facilitymanagement");
  132. dictionary.Add(DailyCtrl.ButtonType.CompetitiveShow, "label_competitiveshow");
  133. dictionary.Add(DailyCtrl.ButtonType.Casino, "label_casino");
  134. dictionary.Add(DailyCtrl.ButtonType.Trophy, "label_trophy");
  135. dictionary.Add(DailyCtrl.ButtonType.FreeMode, "label_free");
  136. dictionary.Add(DailyCtrl.ButtonType.PhotoMode, "label_photomode");
  137. dictionary.Add(DailyCtrl.ButtonType.DeskCustomize, "label_deskcustomize");
  138. dictionary.Add(DailyCtrl.ButtonType.MyRoomCustom, "label_myroom");
  139. dictionary.Add(DailyCtrl.ButtonType.ManEdit, "label_useredit");
  140. dictionary.Add(DailyCtrl.ButtonType.LegacyMode, "label_legacymode");
  141. dictionary.Add(DailyCtrl.ButtonType.Karaoke, "label_karaoke");
  142. dictionary.Add(DailyCtrl.ButtonType.Credit, "label_credit");
  143. if (dictionary.ContainsKey(menuButton.type))
  144. {
  145. DailyAPI.EndType f_eEndType = DailyAPI.EndType.NormalSceneChange;
  146. if (menuButton.type == DailyCtrl.ButtonType.FreeMode)
  147. {
  148. f_eEndType = DailyAPI.EndType.ToFreeMode;
  149. }
  150. else if (menuButton.type == DailyCtrl.ButtonType.Trophy || menuButton.type == DailyCtrl.ButtonType.PhotoMode || menuButton.type == DailyCtrl.ButtonType.DeskCustomize || menuButton.type == DailyCtrl.ButtonType.MaidManagement || menuButton.type == DailyCtrl.ButtonType.FacilityManagement)
  151. {
  152. f_eEndType = DailyAPI.EndType.TakeOver;
  153. }
  154. this.m_api.EndNextScene(f_eEndType, dictionary[menuButton.type]);
  155. }
  156. else
  157. {
  158. Debug.LogWarning("ボタン種類[" + menuButton.type.ToString() + "]は未実装です");
  159. }
  160. }
  161. }
  162. protected override void BeforeClose()
  163. {
  164. this.m_ctrl.SetAllButtonEnable(false);
  165. }
  166. protected override void AfterClose()
  167. {
  168. if (this.m_ctrl != null)
  169. {
  170. this.m_ctrl.SetAllButtonEnable(true);
  171. }
  172. if (this.m_pressingNext && this.sceneMgr != null && this.m_api != null)
  173. {
  174. this.m_api.EndNextScene(DailyAPI.EndType.NormalSceneChange, "label");
  175. }
  176. }
  177. protected override void SetFadeTargetPanel()
  178. {
  179. this.fadeTargetPanel = this.m_goPanel;
  180. }
  181. private DailyAPI m_api;
  182. private DailyCtrl m_ctrl;
  183. private DailyMgr.Daily currentDaily;
  184. private bool m_pressingNext;
  185. public enum Daily
  186. {
  187. Daytime,
  188. Night
  189. }
  190. }