/// <summary> /// 检查资源是否存在,若不存在则创建并注册 /// 需要在蛐蛐界面和人物界面初始化完毕后进行 /// </summary> public static void TryRegisterResources() { if (MajordomoWindow.instance == null) { MajordomoWindow.instance = new MajordomoWindow(); } if (!MajordomoWindow.instance.window || !MajordomoWindow.instance.menu || !MajordomoWindow.instance.mainHolder || !MajordomoWindow.instance.textSummary) { MajordomoWindow.instance.CreateMainWindow(); } if (!MajordomoWindow.instance.assignBuildingWorkersButton || !MajordomoWindow.instance.messageContent || !MajordomoWindow.instance.textMessagePage) { MajordomoWindow.instance.CreateMessagePage(); } MajordomoWindow.instance.window.SetActive(false); MajordomoWindow.instance.isWindowOpening = false; }
static void Postfix() { if (!Main.enabled) { return; } MajordomoWindow.TryRegisterResources(); }
static void Postfix(bool __state) { if (!Main.enabled) { return; } if (__state) { MajordomoWindow.TryRegisterResources(); } }
/// <summary> /// 检查资源是否存在,若不存在则创建并注册 /// 需要在蛐蛐界面和人物界面初始化完毕后进行 /// </summary> public static void TryRegisterResources() { if (MajordomoWindow.instance == null) { MajordomoWindow.instance = new MajordomoWindow(); } if (!MajordomoWindow.instance.window || !MajordomoWindow.instance.menu || !MajordomoWindow.instance.panelContainer || !MajordomoWindow.instance.summaryBar) { MajordomoWindow.instance.CreateWindow(); } if (MajordomoWindow.instance.panelLogs == null) { MajordomoWindow.instance.panelLogs = new PanelLogs( MajordomoWindow.instance.panelContainer, MajordomoWindow.instance.history); } MajordomoWindow.instance.panelLogs.TryRegisterResources(MajordomoWindow.instance.panelContainer); if (MajordomoWindow.instance.panelCharts == null) { MajordomoWindow.instance.panelCharts = new PanelCharts( MajordomoWindow.instance.panelContainer, MajordomoWindow.instance.history); } MajordomoWindow.instance.panelCharts.TryRegisterResources(MajordomoWindow.instance.panelContainer); if (!MajordomoWindow.instance.logsPanelButton || !MajordomoWindow.instance.chartsPanelButton || !MajordomoWindow.instance.assignBuildingWorkersButton) { MajordomoWindow.instance.CreateMenuItems(); } MajordomoWindow.instance.panels = new Dictionary <ITaiwuWindow, GameObject>() { [MajordomoWindow.instance.panelLogs] = MajordomoWindow.instance.logsPanelButton, [MajordomoWindow.instance.panelCharts] = MajordomoWindow.instance.chartsPanelButton, }; MajordomoWindow.instance.SwitchPanel(MajordomoWindow.instance.panelLogs); MajordomoWindow.instance.window.SetActive(false); MajordomoWindow.instance.isWindowOpening = false; UnityEngine.Debug.Log("Resources of MajordomoWindow registered."); }