using System; using System.Collections.Generic; using BackupParamAccessor; using com.workman.cm3d2.scene.dailyEtc; using Schedule; using UnityEngine; 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() { 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() { 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) { 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.LegacyMode, "label_legacymode"); dictionary.Add(DailyCtrl.ButtonType.Karaoke, "label_karaoke"); dictionary.Add(DailyCtrl.ButtonType.Credit, "label_credit"); if (dictionary.ContainsKey(menuButton.type)) { 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) { 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 } }