public static void InjectCustomUI() { Rect editButtonRect = new Rect(620f, 0.0f, 50f, 30f); if (ModsConfig.IsActive("hahkethomemah.simplepersonalities")) { editButtonRect.x -= 130; } if (Widgets.ButtonText(editButtonRect, "RandomPlus.FilterButton".Translate(), true, false, true)) { var page = new Page_RandomEditor(); Find.WindowStack.Add(page); } Rect rerollLabelRect = new Rect(620f, 40f, 200f, 30f); if (ModsConfig.IdeologyActive) { rerollLabelRect.y += 40; } string labelText = "RandomPlus.RerollLabel".Translate() + RandomSettings.RandomRerollCounter() + "/" + RandomSettings.PawnFilter.RerollLimit; var tmpSave = GUI.color; if (RandomSettings.RandomRerollCounter() >= RandomSettings.PawnFilter.RerollLimit) { GUI.color = Color.red; } Widgets.Label(rerollLabelRect, labelText); GUI.color = tmpSave; }
public static void DrawEditButton() { Rect editButtonRect = new Rect(620f, 0.0f, 50f, 30f); if (Widgets.ButtonText(editButtonRect, "Edit", true, false, true)) { var page = new Page_RandomEditor(); Find.WindowStack.Add(page); } Rect rerollLabelRect = new Rect(620f, 40f, 200f, 30f); string labelText = "Rerolls: " + RandomSettings.RandomRerollCounter() + "/" + RandomSettings.RandomRerollLimit(); var tmpSave = GUI.color; if (RandomSettings.RandomRerollCounter() >= RandomSettings.RandomRerollLimit()) { GUI.color = Color.red; } Widgets.Label(rerollLabelRect, labelText); GUI.color = tmpSave; }
// Macro function go automaticially go straight to pawn select page public static void GoToConfigPawnPage() { var page_select_scenario = new Page_SelectScenario(); Find.WindowStack.Add(page_select_scenario); var methodInfo0 = typeof(Page_SelectScenario).GetMethod("CanDoNext", BindingFlags.NonPublic | BindingFlags.Instance); methodInfo0.Invoke(page_select_scenario, new object[0]); var methodInfo1 = typeof(Page_SelectScenario).GetMethod("DoNext", BindingFlags.NonPublic | BindingFlags.Instance); methodInfo1.Invoke(page_select_scenario, new object[0]); var page_storyteller = (Page_SelectStoryteller)page_select_scenario.next; var page_storyteller_methodInfo0 = typeof(Page_SelectStoryteller).GetMethod("CanDoNext", BindingFlags.NonPublic | BindingFlags.Instance); page_storyteller_methodInfo0.Invoke(page_storyteller, new object[0]); var page_storyteller_methodInfo1 = typeof(Page_SelectStoryteller).GetMethod("DoNext", BindingFlags.NonPublic | BindingFlags.Instance); page_storyteller_methodInfo1.Invoke(page_storyteller, new object[0]); var page_create_world = (Page_CreateWorldParams)page_storyteller.next; var prop = typeof(Page_CreateWorldParams).GetField("planetCoverage", BindingFlags.NonPublic | BindingFlags.Instance); prop.SetValue(page_create_world, 0.1f); var page_create_world_methodInfo0 = typeof(Page_CreateWorldParams).GetMethod("CanDoNext", BindingFlags.NonPublic | BindingFlags.Instance); page_create_world_methodInfo0.Invoke(page_create_world, new object[0]); var page_select_site = (Page_SelectStartingSite)page_create_world.next; LongEventHandler.QueueLongEvent(() => { while (Find.World == null) { System.Threading.Thread.Sleep(100); } LongEventHandler.ExecuteWhenFinished(() => { Find.WorldInterface.SelectedTile = RimWorld.Planet.TileFinder.RandomStartingTile(); var page_select_site_methodInfo0 = typeof(Page_SelectStartingSite).GetMethod("CanDoNext", BindingFlags.NonPublic | BindingFlags.Instance); page_select_site_methodInfo0.Invoke(page_select_site, new object[0]); var page_create_world_methodInfo1 = typeof(Page_SelectStartingSite).GetMethod("DoNext", BindingFlags.NonPublic | BindingFlags.Instance); page_create_world_methodInfo1.Invoke(page_select_site, new object[0]); if (ModsConfig.IdeologyActive) { var page_ideo = (Page_ChooseIdeoPreset)page_select_site.next; var allIdeo = DefDatabase <IdeoPresetDef> .AllDefs; var page_ideo_select_field = typeof(Page_ChooseIdeoPreset).GetField("selectedIdeo", BindingFlags.NonPublic | BindingFlags.Instance); page_ideo_select_field.SetValue(page_ideo, allIdeo.RandomElement()); var page_ideo_methodInfo0 = typeof(Page_ChooseIdeoPreset).GetMethod("CanDoNext", BindingFlags.NonPublic | BindingFlags.Instance); page_ideo_methodInfo0.Invoke(page_ideo, new object[0]); var page_ideo_methodInfo1 = typeof(Page_ChooseIdeoPreset).GetMethod("DoNext", BindingFlags.NonPublic | BindingFlags.Instance); page_ideo_methodInfo1.Invoke(page_ideo, new object[0]); } var page = new Page_RandomEditor(); Find.WindowStack.Add(page); }); }, "wait", true, null, false); }