using System; using System.Collections.Generic; using BackupParamAccessor; using com.workman.cm3d2.scene.dailyEtc; using MaidStatus; using Schedule; using UnityEngine; using wf; public class DailyMgr : BaseCreatePanel { public DailyMgr.Daily GetCurrentDaily() { return this.currentDaily; } public static bool IsLegacy { get { return GameMain.Instance.CharacterMgr.status.GetFlag("2.0モード") == 1; } } public override void Init() { this.m_goPanel = base.GetPanel("DailyPanel"); this.m_ctrl = base.GetCtrl(); this.m_ctrl.Init(this, this.m_goPanel); if (this.sceneMgr == null) { this.sceneMgr = base.transform.parent.gameObject.GetComponent(); } this.m_api = new DailyAPI(this.sceneMgr); this.m_goPanel.SetActive(false); } public void OpenDaytimePanel() { this.m_api.SceneStart(true, this, new DailyAPI.dgOnSceneStartCallBack(this.OpenDaytimeCallBack)); } public void OpenDaytimeCallBack() { base.BaseOpenPanel(DailyMgr.Daily.Daytime.ToString()); } public void OpenNightPanel() { this.m_api.SceneStart(false, this, new DailyAPI.dgOnSceneStartCallBack(this.OpenNightCallBack)); } public void OpenNightCallBack() { base.BaseOpenPanel(DailyMgr.Daily.Night.ToString()); } protected override void OpenPanel(string openType) { DailyMgr.Daily daily = (DailyMgr.Daily)Enum.Parse(typeof(DailyMgr.Daily), openType); if (daily != DailyMgr.Daily.Daytime) { if (daily == DailyMgr.Daily.Night) { this.DisplayNightPanel(); } } else { this.DisplayDaytimePanel(); } } private void DisplayDaytimePanel() { BasePanelMgr.isOpen = false; this.currentDaily = DailyMgr.Daily.Daytime; Debug.Log("昼パートメインをオープンしました。"); GameMain.Instance.TutorialPanel.SetImage(TutorialPanel.ImageSet.MainMenu, false); this.m_ctrl.DisplayViewer(DailyMgr.Daily.Daytime); GameMain.Instance.FacilityMgr.ClearCacheFacilityPowerUpResult(); Debug.Log("メイドによる施設強化のキャッシュをクリアしました。"); this.m_api.SetupTutorial(); GameMain.Instance.LifeModeMgr.OnTimeZoneChanged(); if (!DailyMgr.IsLegacy) { GameMain.Instance.CharacterMgr.status.CheckTrophyMainMenu(); } ScheduleAPI.ErrorCheck(); } private void DisplayNightPanel() { BasePanelMgr.isOpen = false; this.currentDaily = DailyMgr.Daily.Night; Debug.Log("夜パートメインをオープンしました。"); this.m_ctrl.DisplayViewer(DailyMgr.Daily.Night); GameMain.Instance.FacilityMgr.ClearCacheFacilityPowerUpResult(); Debug.Log("メイドによる施設強化のキャッシュをクリアしました。"); this.m_api.SetupTutorial(); GameMain.Instance.LifeModeMgr.OnTimeZoneChanged(); if (!DailyMgr.IsLegacy) { GameMain.Instance.CharacterMgr.status.CheckTrophyMainMenu(); } } public void CloseDailyPanel() { if (this.currentDaily == DailyMgr.Daily.Daytime) { ScheduleAPI.BackupParam(SCENE_ID.Morning); ScheduleAPI.BackUpScheduleSlot(); } if (!DailyMgr.IsLegacy) { GameMain.Instance.FacilityMgr.UpdateFacilityAssignedMaidData(); } base.BaseClosePanel(); } public void OnClickMenuButton() { DailyCtrl.ButtonData menuButton = this.m_ctrl.GetMenuButton(UIButton.current); if (menuButton.type == DailyCtrl.ButtonType.Schedule) { base.BaseClosePanel(new Action(base.GetManager().BaseOpenPanel)); } else if (menuButton.type == DailyCtrl.ButtonType.Save) { base.BaseClosePanel(new Action(base.GetManager().OpenSavePanel)); } else if (menuButton.type == DailyCtrl.ButtonType.Load) { base.BaseClosePanel(new Action(base.GetManager().OpenLoadPanel)); } else if (menuButton.type == DailyCtrl.ButtonType.Next) { if (GameModeManager.nowGameMode == GameModeManager.Type.LifeMode) { CharacterMgr characterMgr = GameMain.Instance.CharacterMgr; bool flag = false; int num = 0; while (num < characterMgr.GetStockMaidCount() && !flag) { if (!(characterMgr.GetStockMaid(num) == null)) { flag = PersonalEventBlocker.IsEnabledLifeMode(characterMgr.GetStockMaid(num).status.personal); } num++; } if (!flag) { GameMain.Instance.SysDlg.ShowFromLanguageTerm("Dialog/現在のメイド構成ではライフモードを始める事ができません。", null, SystemDialog.TYPE.OK, null, null); return; } } if (PluginData.IsEnabled("GP003")) { for (int i = 0; i < 40; i++) { Maid scheduleSlot = GameMain.Instance.CharacterMgr.status.GetScheduleSlot(i); if (scheduleSlot != null) { ReadOnlyDictionary allData = ScheduleCSVData.AllData; foreach (int num2 in new int[] { scheduleSlot.status.noonWorkId, scheduleSlot.status.nightWorkId }) { if (!allData.ContainsKey(num2)) { Debug.LogError("ScheduleAPI:タスクID[" + num2 + "]のデータが見つかりませんでした"); } else { bool flag2 = false; ScheduleCSVData.ScheduleBase scheduleBase = ScheduleCSVData.AllData[num2]; if (ScheduleCSVData.YotogiData.ContainsKey(scheduleBase.id)) { flag2 = !ScheduleAPI.EnableNightWork(num2, scheduleSlot, false, true); } if (flag2) { GameMain.Instance.SysDlg.Show("実行できないスケジュールがセットされています。スケジュール設定を見直してください。", SystemDialog.TYPE.OK, null, null); return; } } } } } } this.m_pressingNext = true; this.CloseDailyPanel(); } else { Dictionary dictionary = new Dictionary(); dictionary.Add(DailyCtrl.ButtonType.Dance, "label_dance"); dictionary.Add(DailyCtrl.ButtonType.MaidManagement, "label_maidmanagement"); dictionary.Add(DailyCtrl.ButtonType.EventScenario, "label_eventscenario"); dictionary.Add(DailyCtrl.ButtonType.Shop, "label_shop"); dictionary.Add(DailyCtrl.ButtonType.FacilityManagement, "label_facilitymanagement"); dictionary.Add(DailyCtrl.ButtonType.CompetitiveShow, "label_competitiveshow"); dictionary.Add(DailyCtrl.ButtonType.Casino, "label_casino"); dictionary.Add(DailyCtrl.ButtonType.Trophy, "label_trophy"); dictionary.Add(DailyCtrl.ButtonType.FreeMode, "label_free"); dictionary.Add(DailyCtrl.ButtonType.PhotoMode, "label_photomode"); dictionary.Add(DailyCtrl.ButtonType.DeskCustomize, "label_deskcustomize"); dictionary.Add(DailyCtrl.ButtonType.MyRoomCustom, "label_myroom"); dictionary.Add(DailyCtrl.ButtonType.ManEdit, "label_useredit"); dictionary.Add(DailyCtrl.ButtonType.NPCEdit, "label_npcedit"); dictionary.Add(DailyCtrl.ButtonType.PrivateMaidModeSetting, "label_privatemaidmodesetting"); dictionary.Add(DailyCtrl.ButtonType.ScoutMode, "label_scoutmode"); dictionary.Add(DailyCtrl.ButtonType.LegacyMode, "label_legacymode"); dictionary.Add(DailyCtrl.ButtonType.Karaoke, "label_karaoke"); dictionary.Add(DailyCtrl.ButtonType.Credit, "label_credit"); if (dictionary.ContainsKey(menuButton.type)) { if (menuButton.type == DailyCtrl.ButtonType.LegacyMode) { bool flag3 = false; foreach (Maid maid in GameMain.Instance.CharacterMgr.GetStockMaidList()) { if (maid != null && maid.status.isCompatiblePersonality) { flag3 = true; break; } } if (!flag3) { GameMain.Instance.SysDlg.Show("旧ボディの移籍メイドが最低1人以上いないと実行する事はできません", SystemDialog.TYPE.OK, null, null); return; } GameMain.Instance.CMSystem.SetTmpGenericFlag("AddAllOffset_Ignore", 0); } DailyAPI.EndType f_eEndType = DailyAPI.EndType.NormalSceneChange; if (menuButton.type == DailyCtrl.ButtonType.FreeMode) { f_eEndType = DailyAPI.EndType.ToFreeMode; } 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) { f_eEndType = DailyAPI.EndType.TakeOver; } this.m_api.EndNextScene(f_eEndType, dictionary[menuButton.type]); } else { Debug.LogWarning("ボタン種類[" + menuButton.type.ToString() + "]は未実装です"); } } } protected override void BeforeClose() { this.m_ctrl.SetAllButtonEnable(false); } protected override void AfterClose() { if (this.m_ctrl != null) { this.m_ctrl.SetAllButtonEnable(true); } if (this.m_pressingNext && this.sceneMgr != null && this.m_api != null) { this.m_api.EndNextScene(DailyAPI.EndType.NormalSceneChange, "label"); } } protected override void SetFadeTargetPanel() { this.fadeTargetPanel = this.m_goPanel; } private DailyAPI m_api; private DailyCtrl m_ctrl; private DailyMgr.Daily currentDaily; private bool m_pressingNext; public enum Daily { Daytime, Night } }