public static void Postfix(ManagementMenu.ScreenData screenData, ManagementMenu __instance) { KIconToggleMenu.ToggleInfo researchInfo = Traverse.Create(__instance).Field("researchInfo").GetValue <KIconToggleMenu.ToggleInfo>(); ManagementMenu.ScreenData activeScreen = Traverse.Create(__instance).Field("activeScreen").GetValue <ManagementMenu.ScreenData>(); if (screenData.toggleInfo == researchInfo && activeScreen == screenData) { RequirementFunctions.CountResourcesInReservoirs(); ResearchScreen researchScreen = (ResearchScreen)ManagementMenu.Instance.researchScreen; Dictionary <Tech, ResearchEntry> entryMap = Traverse.Create(researchScreen).Field("entryMap").GetValue <Dictionary <Tech, ResearchEntry> >(); foreach (Tech tech in entryMap.Keys) { if (!tech.IsComplete()) { LocText researchName = Traverse.Create(entryMap[tech]).Field("researchName").GetValue <LocText>(); if (!TechRequirements.Instance.HasTechReq(tech.Id)) { continue; } researchName.GetComponent <ToolTip>().toolTip = CreateTechTooltipText(tech); } } } /*else if (screenData.toggleInfo == researchInfo && activeScreen != screenData) * Debug.Log("ResearchRequirements: Research closed"); * else * Debug.Log("ResearchRequirements: Other screen toogled");*/ }
public static void Postfix(ManagementMenu.ScreenData screenData, ManagementMenu __instance) { KIconToggleMenu.ToggleInfo researchInfo = Traverse.Create(__instance).Field("researchInfo").GetValue <KIconToggleMenu.ToggleInfo>(); ManagementMenu.ScreenData activeScreen = Traverse.Create(__instance).Field("activeScreen").GetValue <ManagementMenu.ScreenData>(); if (screenData.toggleInfo == researchInfo && activeScreen == screenData) { RequirementFunctions.CountResourcesInReservoirs(); ResearchScreen researchScreen = Traverse.Create(ManagementMenu.Instance).Field("researchScreen").GetValue <ResearchScreen>(); if (researchScreen == null) { return; } Dictionary <Tech, ResearchEntry> entryMap = Traverse.Create(researchScreen).Field("entryMap").GetValue <Dictionary <Tech, ResearchEntry> >(); foreach (Tech tech in entryMap.Keys) { if (!tech.IsComplete()) { LocText researchName = Traverse.Create(entryMap[tech]).Field("researchName").GetValue <LocText>(); researchName.GetComponent <ToolTip>().toolTip = CreateTechTooltipText(tech); } } } }