예제 #1
0
파일: Patch.cs 프로젝트: romen-h/ONI-Mods
        public static void Postfix(ScheduleScreen __instance)
        {
            var fi = AccessTools.Field(typeof(ScheduleScreen), "paintStyles");

            blockColors = (Dictionary <string, ColorStyleSetting>)fi.GetValue(__instance);
        }
    protected override void OnPrefabInit()
    {
        base.OnPrefabInit();
        Instance = this;
        CodexCache.Init();
        ScheduledUIInstantiation component = GameScreenManager.Instance.ssOverlayCanvas.GetComponent <ScheduledUIInstantiation>();

        instantiator.Instantiate();
        jobsScreen        = instantiator.GetComponentInChildren <JobsTableScreen>(true);
        consumablesScreen = instantiator.GetComponentInChildren <ConsumablesTableScreen>(true);
        vitalsScreen      = instantiator.GetComponentInChildren <VitalsTableScreen>(true);
        starmapScreen     = component.GetInstantiatedObject <StarmapScreen>();
        codexScreen       = instantiator.GetComponentInChildren <CodexScreen>(true);
        scheduleScreen    = instantiator.GetComponentInChildren <ScheduleScreen>(true);
        skillsScreen      = component.GetInstantiatedObject <SkillsScreen>();
        Subscribe(Game.Instance.gameObject, 288942073, OnUIClear);
        consumablesInfo            = new ToggleInfo(UI.CONSUMABLES, "OverviewUI_consumables_icon", null, Action.ManageConsumables, UI.TOOLTIPS.MANAGEMENTMENU_CONSUMABLES, string.Empty);
        vitalsInfo                 = new ToggleInfo(UI.VITALS, "OverviewUI_vitals_icon", null, Action.ManageVitals, UI.TOOLTIPS.MANAGEMENTMENU_VITALS, string.Empty);
        reportsInfo                = new ToggleInfo(UI.REPORT, "OverviewUI_reports_icon", null, Action.ManageReport, UI.TOOLTIPS.MANAGEMENTMENU_DAILYREPORT, string.Empty);
        reportsInfo.prefabOverride = smallPrefab;
        researchInfo               = new ToggleInfo(UI.RESEARCH, "OverviewUI_research_nav_icon", null, Action.ManageResearch, UI.TOOLTIPS.MANAGEMENTMENU_RESEARCH, string.Empty);
        jobsInfo    = new ToggleInfo(UI.JOBS, "OverviewUI_priority_icon", null, Action.ManagePriorities, UI.TOOLTIPS.MANAGEMENTMENU_JOBS, string.Empty);
        skillsInfo  = new ToggleInfo(UI.SKILLS, "OverviewUI_jobs_icon", null, Action.ManageSkills, UI.TOOLTIPS.MANAGEMENTMENU_SKILLS, string.Empty);
        starmapInfo = new ToggleInfo(UI.STARMAP.MANAGEMENT_BUTTON, "OverviewUI_starmap_icon", null, Action.ManageStarmap, UI.TOOLTIPS.MANAGEMENTMENU_STARMAP, string.Empty);
        codexInfo   = new ToggleInfo(UI.CODEX.MANAGEMENT_BUTTON, "OverviewUI_database_icon", null, Action.ManageDatabase, UI.TOOLTIPS.MANAGEMENTMENU_CODEX, string.Empty);
        codexInfo.prefabOverride = smallPrefab;
        scheduleInfo             = new ToggleInfo(UI.SCHEDULE, "OverviewUI_schedule2_icon", null, Action.ManageSchedule, UI.TOOLTIPS.MANAGEMENTMENU_SCHEDULE, string.Empty);
        ScreenInfoMatch.Add(consumablesInfo, new ScreenData
        {
            screen     = consumablesScreen,
            tabIdx     = 3,
            toggleInfo = consumablesInfo
        });
        ScreenInfoMatch.Add(vitalsInfo, new ScreenData
        {
            screen     = vitalsScreen,
            tabIdx     = 2,
            toggleInfo = vitalsInfo
        });
        ScreenInfoMatch.Add(reportsInfo, new ScreenData
        {
            screen     = reportsScreen,
            tabIdx     = 4,
            toggleInfo = reportsInfo
        });
        ScreenInfoMatch.Add(jobsInfo, new ScreenData
        {
            screen     = jobsScreen,
            tabIdx     = 1,
            toggleInfo = jobsInfo
        });
        ScreenInfoMatch.Add(skillsInfo, new ScreenData
        {
            screen     = skillsScreen,
            tabIdx     = 0,
            toggleInfo = skillsInfo
        });
        ScreenInfoMatch.Add(codexInfo, new ScreenData
        {
            screen     = codexScreen,
            tabIdx     = 6,
            toggleInfo = codexInfo
        });
        ScreenInfoMatch.Add(scheduleInfo, new ScreenData
        {
            screen     = scheduleScreen,
            tabIdx     = 7,
            toggleInfo = scheduleInfo
        });
        ScreenInfoMatch.Add(starmapInfo, new ScreenData
        {
            screen     = starmapScreen,
            tabIdx     = 7,
            toggleInfo = starmapInfo
        });
        List <ToggleInfo> list = new List <ToggleInfo>();

        list.Add(vitalsInfo);
        list.Add(consumablesInfo);
        list.Add(scheduleInfo);
        list.Add(jobsInfo);
        list.Add(skillsInfo);
        list.Add(researchInfo);
        list.Add(starmapInfo);
        list.Add(reportsInfo);
        list.Add(codexInfo);
        Setup(list);
        base.onSelect           += OnButtonClick;
        PauseMenuButton.onClick += OnPauseMenuClicked;
        PauseMenuButton.transform.SetAsLastSibling();
        PauseMenuButton.GetComponent <ToolTip>().toolTip = GameUtil.ReplaceHotkeyString(UI.TOOLTIPS.MANAGEMENTMENU_PAUSEMENU, Action.Escape);
        Components.ResearchCenters.OnAdd    += CheckResearch;
        Components.ResearchCenters.OnRemove += CheckResearch;
        Components.RoleStations.OnAdd       += CheckSkills;
        Components.RoleStations.OnRemove    += CheckSkills;
        Game.Instance.Subscribe(-809948329, CheckResearch);
        Game.Instance.Subscribe(-809948329, CheckSkills);
        Components.Telescopes.OnAdd    += CheckStarmap;
        Components.Telescopes.OnRemove += CheckStarmap;
        skillsTooltipDisabled           = UI.TOOLTIPS.MANAGEMENTMENU_REQUIRES_SKILL_STATION;
        skillsTooltip           = GameUtil.ReplaceHotkeyString(UI.TOOLTIPS.MANAGEMENTMENU_SKILLS, Action.ManageSkills);
        researchTooltipDisabled = UI.TOOLTIPS.MANAGEMENTMENU_REQUIRES_RESEARCH;
        researchTooltip         = GameUtil.ReplaceHotkeyString(UI.TOOLTIPS.MANAGEMENTMENU_RESEARCH, Action.ManageResearch);
        starmapTooltipDisabled  = UI.TOOLTIPS.MANAGEMENTMENU_REQUIRES_TELESCOPE;
        starmapTooltip          = GameUtil.ReplaceHotkeyString(UI.TOOLTIPS.MANAGEMENTMENU_STARMAP, Action.ManageStarmap);
        CheckResearch(null);
        CheckSkills(null);
        CheckStarmap(null);
        researchInfo.toggle.soundPlayer.AcceptClickCondition = (() => ResearchAvailable() || activeScreen == ScreenInfoMatch[Instance.researchInfo]);
        KButton[] closeButtons = CloseButtons;
        foreach (KButton kButton in closeButtons)
        {
            kButton.onClick            += CloseAll;
            kButton.soundPlayer.Enabled = false;
        }
        foreach (KToggle toggle in toggles)
        {
            toggle.soundPlayer.toggle_widget_sound_events[0].PlaySound = false;
            toggle.soundPlayer.toggle_widget_sound_events[1].PlaySound = false;
        }
    }