public static bool HigherPriorityLoop_Prefix(ProfessionDetailPanel __instance) { HumanAI human = __instance.GetFieldValue <HumanAI>("human"); ProfessionType type = __instance.GetPropertyValue <ProfessionType>("type"); int prio = human.professionManager.GetProfession(type).priority + 1; human.professionManager.SetPriority(type, prio, human); __instance.InvokeMethod("UpdatePriority"); return(false); }
public static void UpdatePriority_Postfix(ProfessionDetailPanel __instance) { HumanAI human = __instance.GetFieldValue <HumanAI>("human"); ProfessionType type = __instance.GetPropertyValue <ProfessionType>("type"); Image priorityImage = __instance.GetFieldValue <Image>("priorityImage"); Sprite starsFour = ModHandler.mods.sprites["starsFour"]; int priority = human.professionManager.GetProfession(type).priority; if (priority == 4) { priorityImage.sprite = starsFour; } __instance.priorityHigherButton.SetIsPressable(priority < MaxPriority); }