DailyMgr.cs 7.4 KB

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