public static void Postfix(ResearchCenter __instance) { TechInstance activeResearch = Research.Instance.GetActiveResearch(); Tech tech = activeResearch.tech; TechRequirements.TechReq req = TechRequirements.Instance.GetTechReq(tech.Id); if (req.ContinuousCheck) { if (!req.ReqUnlocked()) { __instance.StopWork(__instance.worker, true); ResearchScreen researchScreen = (ResearchScreen)ManagementMenu.Instance.researchScreen; researchScreen.CancelResearch(); Research.Instance.SetActiveResearch(null, true); } } }
public static void Postfix(ResearchCenter __instance) { GVD.VersionAlert(false); /* * Works vor vanilla * */ TechInstance activeResearch = Research.Instance.GetActiveResearch(); Tech tech = activeResearch.tech; TechRequirements.TechReq req = TechRequirements.Instance.GetTechReq(tech.Id); if (req.ContinuousCheck) { if (!req.ReqUnlocked()) { __instance.StopWork(__instance.worker, true); ResearchScreen researchScreen = (ResearchScreen)ManagementMenu.Instance.researchScreen; researchScreen.CancelResearch(); Research.Instance.SetActiveResearch(null, true); } } /* * Works vor DLC * * TechInstance activeResearch = Research.Instance.GetActiveResearch(); * Tech tech = activeResearch.tech; * TechRequirements.TechReq req = TechRequirements.Instance.GetTechReq(tech.Id); * * if (req.ContinuousCheck) * if (!req.ReqUnlocked()) * { * __instance.StopWork(__instance.worker, true); * ResearchScreen researchScreen = Traverse.Create(ManagementMenu.Instance).Field("researchScreen").GetValue<ResearchScreen>(); * if (researchScreen == null) * return; * researchScreen.CancelResearch(); * Research.Instance.SetActiveResearch(null, true); * Debug.Log("ResearchRequirements: research canceled"); * } */ }
public static void Postfix(ResearchCenter __instance) { //throw new System.NotImplementedException("ResearchCenter_OnWorkTick_Patch - not implemented for DLC"); /* * Works vor vanilla * * TechInstance activeResearch = Research.Instance.GetActiveResearch(); * Tech tech = activeResearch.tech; * TechRequirements.TechReq req = TechRequirements.Instance.GetTechReq(tech.Id); * * if (req.ContinuousCheck) * if(!req.ReqUnlocked()) * { * __instance.StopWork(__instance.worker, true); * ResearchScreen researchScreen = (ResearchScreen)ManagementMenu.Instance.researchScreen; * researchScreen.CancelResearch(); * Research.Instance.SetActiveResearch(null, true); * } */ GVD.VersionAlert(true); TechInstance activeResearch = Research.Instance.GetActiveResearch(); Tech tech = activeResearch.tech; TechRequirements.TechReq req = TechRequirements.Instance.GetTechReq(tech.Id); if (req.ContinuousCheck) { if (!req.ReqUnlocked()) { __instance.StopWork(__instance.worker, true); ResearchScreen researchScreen = Traverse.Create(ManagementMenu.Instance).Field("researchScreen").GetValue <ResearchScreen>(); if (researchScreen == null) { return; } researchScreen.CancelResearch(); Research.Instance.SetActiveResearch(null, true); Debug.Log("ResearchRequirements: research canceled"); } } }