DailyMgr.cs 6.5 KB

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