123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292 |
- 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<DailyCtrl>();
- this.m_ctrl.Init(this, this.m_goPanel);
- if (this.sceneMgr == null)
- {
- this.sceneMgr = base.transform.parent.gameObject.GetComponent<SceneMgr>();
- }
- 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<ScheduleMgr>().BaseOpenPanel));
- }
- else if (menuButton.type == DailyCtrl.ButtonType.Save)
- {
- base.BaseClosePanel(new Action(base.GetManager<SaveAndLoadMgr>().OpenSavePanel));
- }
- else if (menuButton.type == DailyCtrl.ButtonType.Load)
- {
- base.BaseClosePanel(new Action(base.GetManager<SaveAndLoadMgr>().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<int, ScheduleCSVData.ScheduleBase> 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<DailyCtrl.ButtonType, string> dictionary = new Dictionary<DailyCtrl.ButtonType, string>();
- 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
- }
- }
|