using System; using System.Collections.Generic; using com.workman.cm3d2.button; using PlayerStatus; using PrivateMaidMode; using Schedule; using scoutmode; using UnityEngine; using wf; public class DailyCtrl : MonoBehaviour { public void Init(DailyMgr mgr, GameObject goPanel) { this.m_mgr = mgr; this.m_goPanel = goPanel; } public void DisplayViewer(DailyMgr.Daily daily) { if (!this.m_bInit) { this.m_bInit = true; foreach (DailyCtrl.ButtonData buttonData in this.menuButtons) { EventDelegate.Add(buttonData.button.onClick, new EventDelegate.Callback(this.m_mgr.OnClickMenuButton)); } } foreach (DailyCtrl.ButtonData buttonData2 in this.menuButtons) { buttonData2.active = true; } DailyCtrl.ButtonType[] array3; if (daily == DailyMgr.Daily.Daytime) { if (DailyMgr.IsLegacy) { array3 = new DailyCtrl.ButtonType[] { DailyCtrl.ButtonType.Dance, DailyCtrl.ButtonType.FacilityManagement, DailyCtrl.ButtonType.Casino, DailyCtrl.ButtonType.Trophy, DailyCtrl.ButtonType.PhotoMode, DailyCtrl.ButtonType.DeskCustomize, DailyCtrl.ButtonType.MyRoomCustom, DailyCtrl.ButtonType.Casino, DailyCtrl.ButtonType.Shop, DailyCtrl.ButtonType.FacilityManagement, DailyCtrl.ButtonType.LegacyMode, DailyCtrl.ButtonType.Karaoke, DailyCtrl.ButtonType.EventScenario, DailyCtrl.ButtonType.ManEdit, DailyCtrl.ButtonType.Credit, DailyCtrl.ButtonType.NPCEdit, DailyCtrl.ButtonType.PrivateMaidModeSetting, DailyCtrl.ButtonType.ScoutMode }; } else { array3 = new DailyCtrl.ButtonType[] { DailyCtrl.ButtonType.Dance, DailyCtrl.ButtonType.Casino, DailyCtrl.ButtonType.CompetitiveShow }; } } else if (DailyMgr.IsLegacy) { array3 = new DailyCtrl.ButtonType[] { DailyCtrl.ButtonType.Schedule, DailyCtrl.ButtonType.CompetitiveShow, DailyCtrl.ButtonType.Trophy, DailyCtrl.ButtonType.PhotoMode, DailyCtrl.ButtonType.DeskCustomize, DailyCtrl.ButtonType.MyRoomCustom, DailyCtrl.ButtonType.Casino, DailyCtrl.ButtonType.Shop, DailyCtrl.ButtonType.FacilityManagement, DailyCtrl.ButtonType.LegacyMode, DailyCtrl.ButtonType.Karaoke, DailyCtrl.ButtonType.EventScenario, DailyCtrl.ButtonType.ManEdit, DailyCtrl.ButtonType.Credit, DailyCtrl.ButtonType.Dance, DailyCtrl.ButtonType.NPCEdit, DailyCtrl.ButtonType.PrivateMaidModeSetting, DailyCtrl.ButtonType.ScoutMode }; } else { array3 = new DailyCtrl.ButtonType[] { DailyCtrl.ButtonType.Schedule, DailyCtrl.ButtonType.CompetitiveShow, DailyCtrl.ButtonType.LegacyMode }; } this.GetMenuButton(DailyCtrl.ButtonType.NPCEdit).active = (!Product.isPublic && PluginData.IsEnabled("GP001")); this.GetMenuButton(DailyCtrl.ButtonType.PrivateMaidModeSetting).active = PluginData.IsEnabled("GP002"); this.GetMenuButton(DailyCtrl.ButtonType.ScoutMode).active = ScoutManager.isModeEnabled; foreach (DailyCtrl.ButtonType type in array3) { this.GetMenuButton(type).active = false; } Status status = GameMain.Instance.CharacterMgr.status; if (!status.isAvailableDance) { this.GetMenuButton(DailyCtrl.ButtonType.Dance).active = false; } if (!status.isAvailableCompetitiveShow) { this.GetMenuButton(DailyCtrl.ButtonType.CompetitiveShow).active = false; } if (!status.isAvailableShop) { this.GetMenuButton(DailyCtrl.ButtonType.Shop).active = false; } if (!KaraokeDataManager.IsExistKaraokeData(false)) { this.GetMenuButton(DailyCtrl.ButtonType.Karaoke).active = false; } this.m_goPanel.SetActive(true); this.SetAllButtonEnable(true); if (!CasinoDataMgr.Instance.GetCasinoFacility(true) && !CasinoDataMgr.Instance.GetCasinoFacility(false)) { this.GetMenuButton(DailyCtrl.ButtonType.Casino).button.isEnabled = false; } if (!DailyMgr.IsLegacy && daily == DailyMgr.Daily.Daytime) { UIButton button = this.GetMenuButton(DailyCtrl.ButtonType.LegacyMode).button; if (GameUty.IsEnabledCompatibilityMode && PluginData.IsEnabled("Legacy")) { EventDelegate.Add(button.onClick, new EventDelegate.Callback(this.BackUpScheduleSlot)); this.GetMenuButton(DailyCtrl.ButtonType.LegacyMode).button.isEnabled = this.IsEnabledLegacyMode(); } else { this.GetMenuButton(DailyCtrl.ButtonType.LegacyMode).active = false; } } this.GetMenuButton(DailyCtrl.ButtonType.DeskCustomize).button.isEnabled = (PrivateModeMgr.Instance.PrivateMaid == null); foreach (UITable table in this.m_goPanel.GetComponentsInChildren()) { Utility.ResetNGUI(table); } foreach (UIGrid grid in this.m_goPanel.GetComponentsInChildren()) { Utility.ResetNGUI(grid); } StatusViewer component = UTY.GetChildObject(this.m_goPanel, "StatusViewer", false).GetComponent(); component.isEnabledClubNameChangeButton = true; component.isEnabledMainBusinessChangeButton = false; if (daily == DailyMgr.Daily.Daytime && !DailyMgr.IsLegacy && (PluginData.IsEnabled("GP001") || PluginData.IsEnabled("GP002"))) { component.isEnabledGameModeChangeButton = true; } else { component.isEnabledGameModeChangeButton = false; } } public DailyCtrl.ButtonData GetMenuButton(DailyCtrl.ButtonType type) { foreach (DailyCtrl.ButtonData buttonData in this.menuButtons) { if (buttonData.type == type) { return buttonData; } } return new DailyCtrl.ButtonData { button = null, type = type }; } public DailyCtrl.ButtonData GetMenuButton(UIButton button) { foreach (DailyCtrl.ButtonData buttonData in this.menuButtons) { if (buttonData.button == button) { return buttonData; } } return new DailyCtrl.ButtonData { button = null, type = DailyCtrl.ButtonType.Next }; } private bool IsEnabledCompetitiveShow() { return this.m_mgr.GetCurrentDaily() == DailyMgr.Daily.Daytime && GameMain.Instance.CharacterMgr.status.isAvailableCompetitiveShow; } private bool IsEnabledShop() { return GameMain.Instance.CharacterMgr.status.isAvailableShop; } private bool IsEnabledDance() { return this.m_mgr.GetCurrentDaily() == DailyMgr.Daily.Night && GameMain.Instance.CharacterMgr.status.isAvailableDance; } private bool IsEnabledVRCom() { return this.m_mgr.GetCurrentDaily() == DailyMgr.Daily.Daytime && false; } private bool IsEnabledLegacyMode() { List stockMaidList = GameMain.Instance.CharacterMgr.GetStockMaidList(); bool result = false; foreach (Maid maid in stockMaidList) { if (maid != null && maid.status.isCompatiblePersonality) { result = true; } } return result; } public void SetAllButtonEnable(bool enable) { foreach (DailyCtrl.ButtonData buttonData in this.menuButtons) { if (buttonData.button.gameObject.activeSelf) { buttonData.button.isEnabled = enable; } } } public void BackUpScheduleSlot() { ScheduleAPI.BackUpScheduleSlot(); } [SerializeField] private DailyCtrl.ButtonData[] menuButtons; private DailyMgr m_mgr; private Dictionary m_dicRank; private GameObject m_goPanel; private ButtonEnable m_btnEnable; private bool m_bInit; public enum ButtonType { Dance, Schedule, MaidManagement, EventScenario, Shop, FacilityManagement, CompetitiveShow, Casino, Save, Load, Trophy, FreeMode, PhotoMode, DeskCustomize, ManEdit, LegacyMode, Karaoke, Credit, Next, MyRoomCustom, NPCEdit, PrivateMaidModeSetting, ScoutMode } [Serializable] public class ButtonData { public bool active { get { return this.button.gameObject.activeSelf; } set { this.button.gameObject.SetActive(value); } } [SerializeField] public DailyCtrl.ButtonType type; [SerializeField] public UIButton button; } }