DailyMgr.cs 6.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213
  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. GameMain.Instance.LifeModeMgr.OnTimeZoneChanged();
  73. if (!DailyMgr.IsLegacy)
  74. {
  75. GameMain.Instance.CharacterMgr.status.CheckTrophyMainMenu();
  76. }
  77. ScheduleAPI.ErrorCheck();
  78. }
  79. private void DisplayNightPanel()
  80. {
  81. this.currentDaily = DailyMgr.Daily.Night;
  82. Debug.Log("夜パートメインをオープンしました。");
  83. this.m_ctrl.DisplayViewer(DailyMgr.Daily.Night);
  84. GameMain.Instance.FacilityMgr.ClearCacheFacilityPowerUpResult();
  85. Debug.Log("メイドによる施設強化のキャッシュをクリアしました。");
  86. this.m_api.SetupTutorial();
  87. GameMain.Instance.LifeModeMgr.OnTimeZoneChanged();
  88. if (!DailyMgr.IsLegacy)
  89. {
  90. GameMain.Instance.CharacterMgr.status.CheckTrophyMainMenu();
  91. }
  92. }
  93. public void CloseDailyPanel()
  94. {
  95. if (this.currentDaily == DailyMgr.Daily.Daytime)
  96. {
  97. ScheduleAPI.BackupParam(SCENE_ID.Morning);
  98. ScheduleAPI.BackUpScheduleSlot();
  99. }
  100. if (!DailyMgr.IsLegacy)
  101. {
  102. GameMain.Instance.FacilityMgr.UpdateFacilityAssignedMaidData();
  103. }
  104. base.BaseClosePanel();
  105. }
  106. public void OnClickMenuButton()
  107. {
  108. DailyCtrl.ButtonData menuButton = this.m_ctrl.GetMenuButton(UIButton.current);
  109. if (menuButton.type == DailyCtrl.ButtonType.Schedule)
  110. {
  111. base.BaseClosePanel(new Action(base.GetManager<ScheduleMgr>().BaseOpenPanel));
  112. }
  113. else if (menuButton.type == DailyCtrl.ButtonType.Save)
  114. {
  115. base.BaseClosePanel(new Action(base.GetManager<SaveAndLoadMgr>().OpenSavePanel));
  116. }
  117. else if (menuButton.type == DailyCtrl.ButtonType.Load)
  118. {
  119. base.BaseClosePanel(new Action(base.GetManager<SaveAndLoadMgr>().OpenLoadPanel));
  120. }
  121. else if (menuButton.type == DailyCtrl.ButtonType.Next)
  122. {
  123. this.m_pressingNext = true;
  124. this.CloseDailyPanel();
  125. }
  126. else
  127. {
  128. Dictionary<DailyCtrl.ButtonType, string> dictionary = new Dictionary<DailyCtrl.ButtonType, string>();
  129. dictionary.Add(DailyCtrl.ButtonType.Dance, "label_dance");
  130. dictionary.Add(DailyCtrl.ButtonType.MaidManagement, "label_maidmanagement");
  131. dictionary.Add(DailyCtrl.ButtonType.EventScenario, "label_eventscenario");
  132. dictionary.Add(DailyCtrl.ButtonType.Shop, "label_shop");
  133. dictionary.Add(DailyCtrl.ButtonType.FacilityManagement, "label_facilitymanagement");
  134. dictionary.Add(DailyCtrl.ButtonType.CompetitiveShow, "label_competitiveshow");
  135. dictionary.Add(DailyCtrl.ButtonType.Casino, "label_casino");
  136. dictionary.Add(DailyCtrl.ButtonType.Trophy, "label_trophy");
  137. dictionary.Add(DailyCtrl.ButtonType.FreeMode, "label_free");
  138. dictionary.Add(DailyCtrl.ButtonType.PhotoMode, "label_photomode");
  139. dictionary.Add(DailyCtrl.ButtonType.DeskCustomize, "label_deskcustomize");
  140. dictionary.Add(DailyCtrl.ButtonType.MyRoomCustom, "label_myroom");
  141. dictionary.Add(DailyCtrl.ButtonType.ManEdit, "label_useredit");
  142. dictionary.Add(DailyCtrl.ButtonType.NPCEdit, "label_npcedit");
  143. dictionary.Add(DailyCtrl.ButtonType.LegacyMode, "label_legacymode");
  144. dictionary.Add(DailyCtrl.ButtonType.Karaoke, "label_karaoke");
  145. dictionary.Add(DailyCtrl.ButtonType.Credit, "label_credit");
  146. if (dictionary.ContainsKey(menuButton.type))
  147. {
  148. DailyAPI.EndType f_eEndType = DailyAPI.EndType.NormalSceneChange;
  149. if (menuButton.type == DailyCtrl.ButtonType.FreeMode)
  150. {
  151. f_eEndType = DailyAPI.EndType.ToFreeMode;
  152. }
  153. 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)
  154. {
  155. f_eEndType = DailyAPI.EndType.TakeOver;
  156. }
  157. this.m_api.EndNextScene(f_eEndType, dictionary[menuButton.type]);
  158. }
  159. else
  160. {
  161. Debug.LogWarning("ボタン種類[" + menuButton.type.ToString() + "]は未実装です");
  162. }
  163. }
  164. }
  165. protected override void BeforeClose()
  166. {
  167. this.m_ctrl.SetAllButtonEnable(false);
  168. }
  169. protected override void AfterClose()
  170. {
  171. if (this.m_ctrl != null)
  172. {
  173. this.m_ctrl.SetAllButtonEnable(true);
  174. }
  175. if (this.m_pressingNext && this.sceneMgr != null && this.m_api != null)
  176. {
  177. this.m_api.EndNextScene(DailyAPI.EndType.NormalSceneChange, "label");
  178. }
  179. }
  180. protected override void SetFadeTargetPanel()
  181. {
  182. this.fadeTargetPanel = this.m_goPanel;
  183. }
  184. private DailyAPI m_api;
  185. private DailyCtrl m_ctrl;
  186. private DailyMgr.Daily currentDaily;
  187. private bool m_pressingNext;
  188. public enum Daily
  189. {
  190. Daytime,
  191. Night
  192. }
  193. }