DailyMgr.cs 9.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292
  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. using wf;
  9. public class DailyMgr : BaseCreatePanel
  10. {
  11. public DailyMgr.Daily GetCurrentDaily()
  12. {
  13. return this.currentDaily;
  14. }
  15. public static bool IsLegacy
  16. {
  17. get
  18. {
  19. return GameMain.Instance.CharacterMgr.status.GetFlag("2.0モード") == 1;
  20. }
  21. }
  22. public override void Init()
  23. {
  24. this.m_goPanel = base.GetPanel("DailyPanel");
  25. this.m_ctrl = base.GetCtrl<DailyCtrl>();
  26. this.m_ctrl.Init(this, this.m_goPanel);
  27. if (this.sceneMgr == null)
  28. {
  29. this.sceneMgr = base.transform.parent.gameObject.GetComponent<SceneMgr>();
  30. }
  31. this.m_api = new DailyAPI(this.sceneMgr);
  32. this.m_goPanel.SetActive(false);
  33. }
  34. public void OpenDaytimePanel()
  35. {
  36. this.m_api.SceneStart(true, this, new DailyAPI.dgOnSceneStartCallBack(this.OpenDaytimeCallBack));
  37. }
  38. public void OpenDaytimeCallBack()
  39. {
  40. base.BaseOpenPanel(DailyMgr.Daily.Daytime.ToString());
  41. }
  42. public void OpenNightPanel()
  43. {
  44. this.m_api.SceneStart(false, this, new DailyAPI.dgOnSceneStartCallBack(this.OpenNightCallBack));
  45. }
  46. public void OpenNightCallBack()
  47. {
  48. base.BaseOpenPanel(DailyMgr.Daily.Night.ToString());
  49. }
  50. protected override void OpenPanel(string openType)
  51. {
  52. DailyMgr.Daily daily = (DailyMgr.Daily)Enum.Parse(typeof(DailyMgr.Daily), openType);
  53. if (daily != DailyMgr.Daily.Daytime)
  54. {
  55. if (daily == DailyMgr.Daily.Night)
  56. {
  57. this.DisplayNightPanel();
  58. }
  59. }
  60. else
  61. {
  62. this.DisplayDaytimePanel();
  63. }
  64. }
  65. private void DisplayDaytimePanel()
  66. {
  67. BasePanelMgr.isOpen = false;
  68. this.currentDaily = DailyMgr.Daily.Daytime;
  69. Debug.Log("昼パートメインをオープンしました。");
  70. GameMain.Instance.TutorialPanel.SetImage(TutorialPanel.ImageSet.MainMenu, false);
  71. this.m_ctrl.DisplayViewer(DailyMgr.Daily.Daytime);
  72. GameMain.Instance.FacilityMgr.ClearCacheFacilityPowerUpResult();
  73. Debug.Log("メイドによる施設強化のキャッシュをクリアしました。");
  74. this.m_api.SetupTutorial();
  75. GameMain.Instance.LifeModeMgr.OnTimeZoneChanged();
  76. if (!DailyMgr.IsLegacy)
  77. {
  78. GameMain.Instance.CharacterMgr.status.CheckTrophyMainMenu();
  79. }
  80. ScheduleAPI.ErrorCheck();
  81. }
  82. private void DisplayNightPanel()
  83. {
  84. BasePanelMgr.isOpen = false;
  85. this.currentDaily = DailyMgr.Daily.Night;
  86. Debug.Log("夜パートメインをオープンしました。");
  87. this.m_ctrl.DisplayViewer(DailyMgr.Daily.Night);
  88. GameMain.Instance.FacilityMgr.ClearCacheFacilityPowerUpResult();
  89. Debug.Log("メイドによる施設強化のキャッシュをクリアしました。");
  90. this.m_api.SetupTutorial();
  91. GameMain.Instance.LifeModeMgr.OnTimeZoneChanged();
  92. if (!DailyMgr.IsLegacy)
  93. {
  94. GameMain.Instance.CharacterMgr.status.CheckTrophyMainMenu();
  95. }
  96. }
  97. public void CloseDailyPanel()
  98. {
  99. if (this.currentDaily == DailyMgr.Daily.Daytime)
  100. {
  101. ScheduleAPI.BackupParam(SCENE_ID.Morning);
  102. ScheduleAPI.BackUpScheduleSlot();
  103. }
  104. if (!DailyMgr.IsLegacy)
  105. {
  106. GameMain.Instance.FacilityMgr.UpdateFacilityAssignedMaidData();
  107. }
  108. base.BaseClosePanel();
  109. }
  110. public void OnClickMenuButton()
  111. {
  112. DailyCtrl.ButtonData menuButton = this.m_ctrl.GetMenuButton(UIButton.current);
  113. if (menuButton.type == DailyCtrl.ButtonType.Schedule)
  114. {
  115. base.BaseClosePanel(new Action(base.GetManager<ScheduleMgr>().BaseOpenPanel));
  116. }
  117. else if (menuButton.type == DailyCtrl.ButtonType.Save)
  118. {
  119. base.BaseClosePanel(new Action(base.GetManager<SaveAndLoadMgr>().OpenSavePanel));
  120. }
  121. else if (menuButton.type == DailyCtrl.ButtonType.Load)
  122. {
  123. base.BaseClosePanel(new Action(base.GetManager<SaveAndLoadMgr>().OpenLoadPanel));
  124. }
  125. else if (menuButton.type == DailyCtrl.ButtonType.Next)
  126. {
  127. if (GameModeManager.nowGameMode == GameModeManager.Type.LifeMode)
  128. {
  129. CharacterMgr characterMgr = GameMain.Instance.CharacterMgr;
  130. bool flag = false;
  131. int num = 0;
  132. while (num < characterMgr.GetStockMaidCount() && !flag)
  133. {
  134. if (!(characterMgr.GetStockMaid(num) == null))
  135. {
  136. flag = PersonalEventBlocker.IsEnabledLifeMode(characterMgr.GetStockMaid(num).status.personal);
  137. }
  138. num++;
  139. }
  140. if (!flag)
  141. {
  142. GameMain.Instance.SysDlg.ShowFromLanguageTerm("Dialog/現在のメイド構成ではライフモードを始める事ができません。", null, SystemDialog.TYPE.OK, null, null);
  143. return;
  144. }
  145. }
  146. if (PluginData.IsEnabled("GP003"))
  147. {
  148. for (int i = 0; i < 40; i++)
  149. {
  150. Maid scheduleSlot = GameMain.Instance.CharacterMgr.status.GetScheduleSlot(i);
  151. if (scheduleSlot != null)
  152. {
  153. ReadOnlyDictionary<int, ScheduleCSVData.ScheduleBase> allData = ScheduleCSVData.AllData;
  154. foreach (int num2 in new int[]
  155. {
  156. scheduleSlot.status.noonWorkId,
  157. scheduleSlot.status.nightWorkId
  158. })
  159. {
  160. if (!allData.ContainsKey(num2))
  161. {
  162. Debug.LogError("ScheduleAPI:タスクID[" + num2 + "]のデータが見つかりませんでした");
  163. }
  164. else
  165. {
  166. bool flag2 = false;
  167. ScheduleCSVData.ScheduleBase scheduleBase = ScheduleCSVData.AllData[num2];
  168. if (ScheduleCSVData.YotogiData.ContainsKey(scheduleBase.id))
  169. {
  170. flag2 = !ScheduleAPI.EnableNightWork(num2, scheduleSlot, false, true);
  171. }
  172. if (flag2)
  173. {
  174. GameMain.Instance.SysDlg.Show("実行できないスケジュールがセットされています。スケジュール設定を見直してください。", SystemDialog.TYPE.OK, null, null);
  175. return;
  176. }
  177. }
  178. }
  179. }
  180. }
  181. }
  182. this.m_pressingNext = true;
  183. this.CloseDailyPanel();
  184. }
  185. else
  186. {
  187. Dictionary<DailyCtrl.ButtonType, string> dictionary = new Dictionary<DailyCtrl.ButtonType, string>();
  188. dictionary.Add(DailyCtrl.ButtonType.Dance, "label_dance");
  189. dictionary.Add(DailyCtrl.ButtonType.MaidManagement, "label_maidmanagement");
  190. dictionary.Add(DailyCtrl.ButtonType.EventScenario, "label_eventscenario");
  191. dictionary.Add(DailyCtrl.ButtonType.Shop, "label_shop");
  192. dictionary.Add(DailyCtrl.ButtonType.FacilityManagement, "label_facilitymanagement");
  193. dictionary.Add(DailyCtrl.ButtonType.CompetitiveShow, "label_competitiveshow");
  194. dictionary.Add(DailyCtrl.ButtonType.Casino, "label_casino");
  195. dictionary.Add(DailyCtrl.ButtonType.Trophy, "label_trophy");
  196. dictionary.Add(DailyCtrl.ButtonType.FreeMode, "label_free");
  197. dictionary.Add(DailyCtrl.ButtonType.PhotoMode, "label_photomode");
  198. dictionary.Add(DailyCtrl.ButtonType.DeskCustomize, "label_deskcustomize");
  199. dictionary.Add(DailyCtrl.ButtonType.MyRoomCustom, "label_myroom");
  200. dictionary.Add(DailyCtrl.ButtonType.ManEdit, "label_useredit");
  201. dictionary.Add(DailyCtrl.ButtonType.NPCEdit, "label_npcedit");
  202. dictionary.Add(DailyCtrl.ButtonType.PrivateMaidModeSetting, "label_privatemaidmodesetting");
  203. dictionary.Add(DailyCtrl.ButtonType.ScoutMode, "label_scoutmode");
  204. dictionary.Add(DailyCtrl.ButtonType.LegacyMode, "label_legacymode");
  205. dictionary.Add(DailyCtrl.ButtonType.Karaoke, "label_karaoke");
  206. dictionary.Add(DailyCtrl.ButtonType.Credit, "label_credit");
  207. if (dictionary.ContainsKey(menuButton.type))
  208. {
  209. if (menuButton.type == DailyCtrl.ButtonType.LegacyMode)
  210. {
  211. bool flag3 = false;
  212. foreach (Maid maid in GameMain.Instance.CharacterMgr.GetStockMaidList())
  213. {
  214. if (maid != null && maid.status.isCompatiblePersonality)
  215. {
  216. flag3 = true;
  217. break;
  218. }
  219. }
  220. if (!flag3)
  221. {
  222. GameMain.Instance.SysDlg.Show("旧ボディの移籍メイドが最低1人以上いないと実行する事はできません", SystemDialog.TYPE.OK, null, null);
  223. return;
  224. }
  225. GameMain.Instance.CMSystem.SetTmpGenericFlag("AddAllOffset_Ignore", 0);
  226. }
  227. DailyAPI.EndType f_eEndType = DailyAPI.EndType.NormalSceneChange;
  228. if (menuButton.type == DailyCtrl.ButtonType.FreeMode)
  229. {
  230. f_eEndType = DailyAPI.EndType.ToFreeMode;
  231. }
  232. 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)
  233. {
  234. f_eEndType = DailyAPI.EndType.TakeOver;
  235. }
  236. this.m_api.EndNextScene(f_eEndType, dictionary[menuButton.type]);
  237. }
  238. else
  239. {
  240. Debug.LogWarning("ボタン種類[" + menuButton.type.ToString() + "]は未実装です");
  241. }
  242. }
  243. }
  244. protected override void BeforeClose()
  245. {
  246. this.m_ctrl.SetAllButtonEnable(false);
  247. }
  248. protected override void AfterClose()
  249. {
  250. if (this.m_ctrl != null)
  251. {
  252. this.m_ctrl.SetAllButtonEnable(true);
  253. }
  254. if (this.m_pressingNext && this.sceneMgr != null && this.m_api != null)
  255. {
  256. this.m_api.EndNextScene(DailyAPI.EndType.NormalSceneChange, "label");
  257. }
  258. }
  259. protected override void SetFadeTargetPanel()
  260. {
  261. this.fadeTargetPanel = this.m_goPanel;
  262. }
  263. private DailyAPI m_api;
  264. private DailyCtrl m_ctrl;
  265. private DailyMgr.Daily currentDaily;
  266. private bool m_pressingNext;
  267. public enum Daily
  268. {
  269. Daytime,
  270. Night
  271. }
  272. }