private void DoScenarioListEntry(Rect rect, Scenario scen) { bool flag = this.curScen == scen; Widgets.DrawOptionBackground(rect, flag); MouseoverSounds.DoRegion(rect); Rect rect2 = rect.ContractedBy(4f); Text.Font = GameFont.Small; Rect rect3 = rect2; rect3.height = Text.CalcHeight(scen.name, rect3.width); Widgets.Label(rect3, scen.name); Text.Font = GameFont.Tiny; Rect rect4 = rect2; rect4.yMin = rect3.yMax; Widgets.Label(rect4, scen.GetSummary()); if (scen.enabled) { WidgetRow widgetRow = new WidgetRow(rect.xMax, rect.y, UIDirection.LeftThenDown, 99999f, 4f); if (scen.Category == ScenarioCategory.CustomLocal && widgetRow.ButtonIcon(TexButton.DeleteX, "Delete".Translate(), new Color?(GenUI.SubtleMouseoverColor))) { Find.WindowStack.Add(Dialog_MessageBox.CreateConfirmation("ConfirmDelete".Translate(scen.File.Name), delegate { scen.File.Delete(); ScenarioLister.MarkDirty(); }, true, null)); } if (scen.Category == ScenarioCategory.SteamWorkshop && widgetRow.ButtonIcon(TexButton.DeleteX, "Unsubscribe".Translate(), new Color?(GenUI.SubtleMouseoverColor))) { Find.WindowStack.Add(Dialog_MessageBox.CreateConfirmation("ConfirmUnsubscribe".Translate(scen.File.Name), delegate { scen.enabled = false; if (this.curScen == scen) { this.curScen = null; this.EnsureValidSelection(); } Workshop.Unsubscribe(scen); }, true, null)); } if (scen.GetPublishedFileId() != PublishedFileId_t.Invalid) { if (widgetRow.ButtonIcon(ContentSource.SteamWorkshop.GetIcon(), "WorkshopPage".Translate(), null)) { SteamUtility.OpenWorkshopPage(scen.GetPublishedFileId()); } if (scen.CanToUploadToWorkshop()) { widgetRow.Icon(Page_SelectScenario.CanUploadIcon, "CanBeUpdatedOnWorkshop".Translate()); } } if (!flag && Widgets.ButtonInvisible(rect, false)) { this.curScen = scen; SoundDefOf.Click.PlayOneShotOnCamera(null); } } }
public static void DoOrderButton(WidgetRow widgetRow, Area areaBase) { if (!(areaBase is Area_Allowed area)) { return; } List <Area> areas = area.Map.areaManager.AllAreas.FindAll(a => a is Area_Allowed); int index = areas.IndexOf(area); if (widgetRow.ButtonIcon(TexButton.Clear, "TD.ClearEntireArea".Translate())) { BoolGrid grid = (BoolGrid)innerGridInfo.GetValue(area); grid.Clear(); area.Invert(); area.Invert(); //this is stupid but easiest way to access Dirtier } if (index > 0) { if (widgetRow.ButtonIcon(TexButton.ReorderUp)) { Area other = areas[index - 1]; area.Map.GetComponent <MapComponent_AreaOrder>().Swap(area, other); } } else { widgetRow.GapButtonIcon(); } if (index < areas.Count - 1 && widgetRow.ButtonIcon(TexButton.ReorderDown)) { Area other = areas[index + 1]; area.Map.GetComponent <MapComponent_AreaOrder>().Swap(area, other); } }
public static void CopyPasteAreaRow(WidgetRow widgetRow, Area area) { //Gap doesn't work if it's the first thing. So dumb. Increment is private. So dumb. //Have to hack in the method call instead AEH. float gapWidth = WidgetRow.DefaultGap + WidgetRow.IconSize; if (copiedArea == area) { IncrementPositionInfo.Invoke(widgetRow, new object[] { gapWidth }); } else if (widgetRow.ButtonIcon(TexButton.Copy)) { copiedArea = area; } if (widgetRow.ButtonIcon(TexButton.Paste)) { if (copiedArea == null || copiedArea == area || Event.current.button == 1) { List <FloatMenuOption> otherAreas = new List <FloatMenuOption>(area.Map.areaManager.AllAreas .FindAll(a => !(a is Area_Allowed)) .ConvertAll(a => new FloatMenuOption(a.Label, () => PasteArea(a, area), mouseoverGuiAction: () => a.MarkForDraw()))); Find.WindowStack.Add(new FloatMenu(otherAreas, "TD.PasteFrom".Translate())); } else { PasteArea(copiedArea, area); } } }
private static void Postfix(WidgetRow row, bool worldView) { if (worldView || (row == null)) { return; } if (AlertManager.OnAlert) { if (row.ButtonIcon(Resources.EmergencyOn, "BPC.ToggleEmergencyOn".Translate(), UnityEngine.Color.red, true)) { AlertManager.OnAlert = false; SoundDefOf.Tick_High.PlayOneShotOnCamera(null); AlertManager.LoadState(0); //OFF } } if (!AlertManager.OnAlert) { if (row.ButtonIcon(Resources.EmergencyOff, "BPC.ToggleEmergencyOff".Translate(), UnityEngine.Color.gray, true)) { AlertManager.OnAlert = true; SoundDefOf.Tick_Low.PlayOneShotOnCamera(null); AlertManager.SaveState(0); AlertManager.LoadState(1); //ON if (AlertManager.AutomaticPawnsInterrupt) { AlertManager.PawnsInterruptForced(); } } } }
protected override void DrawConfigInterface(Rect baseRect, Color baseColor) { Rect rect = new Rect(28f, 32f, 100f, 30f); GUI.color = new Color(1f, 1f, 1f, 0.65f); Widgets.Label(rect, this.RepeatInfoText); GUI.color = baseColor; WidgetRow widgetRow = new WidgetRow(baseRect.xMax, baseRect.y + 29f, UIDirection.LeftThenUp, 99999f, 4f); if (widgetRow.ButtonText("Details".Translate() + "...", null, true, false)) { Find.WindowStack.Add(new Dialog_BillConfig_Hysteresis(this, ((Thing)this.billStack.billGiver).Position)); } if (widgetRow.ButtonText(this.repeatMode.GetLabel().PadRight(20), null, true, false)) { BillRepeatModeUtility.MakeConfigFloatMenu(this); } if (widgetRow.ButtonIcon((Texture2D)DetourInjector.ButtonPlus.GetValue(null), null)) { if (this.repeatMode == BillRepeatMode.Forever) { this.repeatMode = BillRepeatMode.RepeatCount; this.repeatCount = 1; } else if (this.repeatMode == BillRepeatMode.TargetCount) { this.targetCount += this.recipe.targetCountAdjustment; } else if (this.repeatMode == BillRepeatMode.RepeatCount) { this.repeatCount++; } SoundDefOf.AmountIncrement.PlayOneShotOnCamera(); } if (widgetRow.ButtonIcon((Texture2D)DetourInjector.ButtonMinus.GetValue(null), null)) { if (this.repeatMode == BillRepeatMode.Forever) { this.repeatMode = BillRepeatMode.RepeatCount; this.repeatCount = 1; } else if (this.repeatMode == BillRepeatMode.TargetCount) { this.targetCount = Mathf.Max(0, this.targetCount - this.recipe.targetCountAdjustment); } else if (this.repeatMode == BillRepeatMode.RepeatCount) { this.repeatCount = Mathf.Max(0, this.repeatCount - 1); } SoundDefOf.AmountDecrement.PlayOneShotOnCamera(); } }
private static void CreateHaulModeButton(Bill_Production _this, WidgetRow widgetRow) { var label = ("BillStoreMode_" + _this.storeMode).Translate(); Texture2D tex = null; if (_this.storeMode == BillStoreModeDefOf.BestStockpile) { tex = TexButton.BestStockpile; } else if (_this.storeMode == BillStoreModeDefOf.DropOnFloor) { tex = TexButton.DropOnFloor; } if (widgetRow.ButtonIcon(tex, label)) { List <FloatMenuOption> list = new List <FloatMenuOption>(); foreach (BillStoreModeDef current in from bsm in DefDatabase <BillStoreModeDef> .AllDefs orderby bsm.listOrder select bsm) { BillStoreModeDef smLocal = current; list.Add(new FloatMenuOption(("BillStoreMode_" + current).Translate(), delegate { _this.storeMode = smLocal; }, MenuOptionPriority.Default, null, null, 0f, null, null)); } Find.WindowStack.Add(new FloatMenu(list)); } }
private static void CreateDetailButton(Bill_Production _this, WidgetRow widgetRow) { if (widgetRow.ButtonIcon(TexButton.Detail, "Details".Translate())) { Find.WindowStack.Add(new Dialog_BillConfig(_this, ((Thing)_this.billStack.billGiver).Position)); } }
private static void CreateHaulModeButton(Bill_Production _this, WidgetRow widgetRow) { var label = ("BillStoreMode_" + _this.storeMode).Translate(); Texture2D tex = null; switch (_this.storeMode) { case BillStoreMode.BestStockpile: tex = TexButton.BestStockpile; break; case BillStoreMode.DropOnFloor: tex = TexButton.DropOnFloor; break; } if (widgetRow.ButtonIcon(tex, label)) { var list = new List <FloatMenuOption>(); var enumerator = Enum.GetValues(typeof(BillStoreMode)).GetEnumerator(); { while (enumerator.MoveNext()) { var billStoreMode = (BillStoreMode)(byte)enumerator.Current; var smLocal = billStoreMode; list.Add(new FloatMenuOption(("BillStoreMode_" + billStoreMode).Translate(), delegate { _this.storeMode = smLocal; })); } } Find.WindowStack.Add(new FloatMenu(list)); } }
private static void DrawColorOption(Listing_Standard listing, string label, Color color, Action <Color> action) { Rect rect = listing.GetRect(GenUI.ListSpacing); WidgetRow row = new WidgetRow(rect.x, rect.y, UIDirection.RightThenDown, rect.width); if (!_textureCache.TryGetValue(color, out Texture2D texture)) { texture = SolidColorMaterials.NewSolidColorTexture(color); _textureCache[color] = texture; } if (row.ButtonIcon(texture)) { Find.WindowStack.Add( new Dialog_ColorPicker( color , (newColor) => { action.Invoke(newColor); ModSettings.UISettingsChanged = true; })); } row.GapButtonIcon(); row.Label(label); }
private void DoAreaRow(Area areaToList, Listing_Standard listing, int group, int count, int priority, bool isPriority) { Rect rowRect = listing.GetRect(elementHeight); ReorderableWidget.Reorderable(group, rowRect); if (Mouse.IsOver(rowRect)) { GUI.color = areaToList.Color; Widgets.DrawHighlightIfMouseover(rowRect); GUI.color = Color.white; } DoAreaTooltip(rowRect, areaToList, count, priority, isPriority); WidgetRow widgetRow = new WidgetRow(rowRect.x, rowRect.y, UIDirection.RightThenUp, rowRect.width); widgetRow.Icon(TextureLoader.dragHash); widgetRow.Icon(areaToList.ColorTexture, null); widgetRow.LabelWithAnchorAndFont(areaToList.Label, -1, TextAnchor.MiddleLeft, GameFont.Small); widgetRow.Gap(rowRect.width - (widgetRow.FinalX - rowRect.x) - (2 * WidgetRow.IconSize + WidgetRow.DefaultGap)); if (isPriority) { widgetRow.Icon(TextureLoader.clean); } else { widgetRow.Gap(WidgetRow.IconSize + WidgetRow.DefaultGap); } if (count > 1 && widgetRow.ButtonIcon(TextureLoader.delete)) { removeQueue.Add(areaToList); } }
public static void Postfix(WidgetRow row, bool worldView) { if (!worldView) { if (CinematicCameraManager.currentCamera != null) { GUI.color = GenUI.MouseoverColor; } if (row.ButtonIcon(Resources.cameraIcon, "Fluffy.FollowMe.CinematicCamera".Translate())) { var options = new List <FloatMenuOption>(); foreach (var camera in CinematicCameraManager.Cameras) { options.Add(new FloatMenuOption(camera.LabelCap, () => CinematicCameraManager.Start(camera))); } options.Add(new FloatMenuOption("Fluffy.FollowMe.CinematicCamera.Off".Translate(), () => CinematicCameraManager.Stop())); Find.WindowStack.Add(new FloatMenu(options)); } GUI.color = Color.white; } }
private static void Postfix(WidgetRow row, bool worldView) { if (worldView) { return; } var mouseOverRect = new Rect(row.FinalX - WidgetRow.IconSize, row.FinalY, WidgetRow.IconSize, WidgetRow.IconSize); MouseoverSounds.DoRegion(mouseOverRect, SoundDefOf.Mouseover_ButtonToggle); if (Mouse.IsOver(mouseOverRect)) { Find.CurrentMap.GetCleaningManager().MarkAllForDraw(); } if (!row.ButtonIcon(TextureLoader.priorityWindowButton, "OpenCleaningPriorityDialog".Translate())) { return; } if (!Find.WindowStack.IsOpen <Dialog_CleaningPriority>()) { Find.WindowStack.Add(new Dialog_CleaningPriority(Find.CurrentMap)); } else { Find.WindowStack.TryRemove(typeof(Dialog_CleaningPriority)); } }
static void Draw(WidgetRow row) { if (row.ButtonIcon(TexButton.Paste, "Hot swap.")) { HotSwapMain.DoHotSwap(); } }
private static void DoAreaRow(Rect rect, Area area) { if (Mouse.IsOver(rect)) { area.MarkForDraw(); GUI.color = area.Color; Widgets.DrawHighlight(rect); GUI.color = Color.white; } GUI.BeginGroup(rect); WidgetRow widgetRow = new WidgetRow(0f, 0f); widgetRow.Icon(area.ColorTexture); widgetRow.Gap(4f); float width = rect.width - widgetRow.FinalX - 4f - Text.CalcSize("Rename".Translate()).x - 16f - 4f - Text.CalcSize("InvertArea".Translate()).x - 16f - 4f - 24f; widgetRow.Label(area.Label, width); if (widgetRow.ButtonText("Rename".Translate())) { Find.WindowStack.Add(new Dialog_RenameArea(area)); } if (widgetRow.ButtonText("InvertArea".Translate())) { area.Invert(); } if (widgetRow.ButtonIcon(TexButton.DeleteX, null, GenUI.SubtleMouseoverColor)) { area.Delete(); } GUI.EndGroup(); }
internal static void DrawDebugToolbarButton(WidgetRow widgets) { const string quickstartButtonTooltip = "Open the quickstart settings.\n\n" + "This lets you automatically generate a map or load an existing save when the game is started.\n" + "Shift-click to quick-generate a new map."; if (widgets.ButtonIcon(quickstartIconTex, quickstartButtonTooltip)) { var stack = Find.WindowStack; if (HugsLibUtility.ShiftIsHeld) { stack.TryRemove(typeof(Dialog_QuickstartSettings)); InitateMapGeneration(); } else { if (stack.IsOpen <Dialog_QuickstartSettings>()) { stack.TryRemove(typeof(Dialog_QuickstartSettings)); } else { stack.Add(new Dialog_QuickstartSettings()); } } } }
public Rect GetPawnFilterPartRect(PawnFilterPart part, float height) { // Make rect. Rect rect = this.GetRect(PawnFilterPart.RowHeight + height); Widgets.DrawBoxSolid(rect, new Color(1, 1, 1, 0.08f)); WidgetRow widgetRow = new WidgetRow(rect.x, rect.y, UIDirection.RightThenDown, 72, 0); // Add removal button. if (widgetRow.ButtonIcon(ContentFinder <Texture2D> .Get("UI/Buttons/Delete", true), null, new Color?(GenUI.SubtleMouseoverColor))) { part.toRemove = true; } // Add label. Rect labelRect = new Rect(rect.x + 32, rect.y, rect.width, PawnFilterPart.RowHeight); Widgets.Label(labelRect, part.label); // Make a space between filter parts. this.Gap(gapSize); // Return remainder for further modification. return(new Rect(rect.x, rect.y + labelRect.height, rect.width, rect.height - labelRect.height)); }
private static void DoAreaRow(Rect rect, Area area) { if (Mouse.IsOver(rect)) { area.MarkForDraw(); GUI.color = area.Color; Widgets.DrawHighlight(rect); GUI.color = Color.white; } GUI.BeginGroup(rect); WidgetRow widgetRow = new WidgetRow(0f, 0f, UIDirection.RightThenUp, 99999f, 4f); widgetRow.Icon(area.ColorTexture, null); widgetRow.Gap(4f); widgetRow.Label(area.Label, 220f); if (widgetRow.ButtonText("Rename".Translate(), null, true, false)) { Find.WindowStack.Add(new Dialog_RenameArea(area)); } if (widgetRow.ButtonText("InvertArea".Translate(), null, true, false)) { area.Invert(); } WidgetRow arg_D3_0 = widgetRow; Texture2D deleteX = TexButton.DeleteX; Color? mouseoverColor = new Color?(GenUI.SubtleMouseoverColor); if (arg_D3_0.ButtonIcon(deleteX, null, mouseoverColor)) { area.Delete(); } GUI.EndGroup(); }
private void DrawScrollableLoadout(Rect rect, Pawn pawn, CompAwesomeInventoryLoadout comp, PawnRowViewModel viewModel) { if (pawn.outfits.CurrentOutfit is AwesomeInventoryLoadout loadout) { // Loadout name button string loadoutName = loadout.label; WidgetRow widgetRow = new WidgetRow(rect.x, rect.y, UIDirection.RightThenDown); if (widgetRow.ButtonText(loadoutName)) { Dialog_ManageLoadouts dialog = AwesomeInventoryServiceProvider.MakeInstanceOf <Dialog_ManageLoadouts>(loadout, pawn, true); dialog.closeOnClickedOutside = true; Find.WindowStack.Add(dialog); } else if (widgetRow.ButtonIcon(TexResource.Copy)) { _copy = loadout; Messages.Message(string.Concat(UIText.CopyLoadout.TranslateSimple(), $" {_copy.label}"), MessageTypeDefOf.NeutralEvent); } else if (_copy != null && widgetRow.ButtonIcon(TexResource.Paste)) { pawn.SetLoadout(_copy); } // Loadout scroll view Rect loadoutItemRect = new Rect(rect.x, widgetRow.FinalY + GenUI.ListSpacing, rect.width, GenUI.ListSpacing + GenUI.ScrollBarWidth); Rect viewRect = loadoutItemRect.ReplaceHeight(GenUI.ListSpacing).ReplaceWidth(viewModel.LoadoutViewWidth); Widgets.ScrollHorizontal(loadoutItemRect, ref viewModel.LoadoutScrollPos, viewRect); Widgets.BeginScrollView(loadoutItemRect, ref viewModel.LoadoutScrollPos, viewRect); Rect iconRect = viewRect.ReplaceWidth(GenUI.SmallIconSize); foreach (ThingGroupSelector groupSelector in comp.Loadout .OrderByDescending(a => a.SingleThingSelectors.FirstOrDefault()?.ThingSample, new LoadoutUtility.ThingTypeComparer())) { if (groupSelector.SingleThingSelectors.FirstOrDefault() is SingleThingSelector selector) { this.DrawThingIcon(iconRect, pawn, selector.ThingSample, comp); this.DragItemToLoadout(iconRect, groupSelector); iconRect = iconRect.ReplaceX(iconRect.xMax); } } viewModel.LoadoutViewWidth = iconRect.x - rect.x; Widgets.EndScrollView(); } }
public static bool Checkbox(this WidgetRow row, ref bool toggleOn, string tooltip = null, Color?mouseoverColor = null) { if (row.ButtonIcon(toggleOn ? Widgets.CheckboxOnTex : Widgets.CheckboxOffTex, tooltip, mouseoverColor)) { toggleOn = !toggleOn; return(true); } return(false); }
private void DrawButtons() { WidgetRow widgetRow = new WidgetRow(); if (widgetRow.ButtonIcon(Info, "Open the debug log.")) { ToggleLogWindow(); } }
public static void Postfix(WidgetRow ___widgetRow) { if (___widgetRow.ButtonIcon(TextureButton.SoundNote, "Open sound tester.")) { if (!Find.WindowStack.TryRemove(typeof(EditWindow_SoundTest))) { Find.WindowStack.Add(new EditWindow_SoundTest()); } } }
public static void DoButtonIcon(WidgetRow widgetRow, Texture2D tex, string tooltip, Area area) { if (widgetRow.ButtonIcon(tex, tooltip)) { if (area is Area_Allowed aa) { Find.WindowStack.Add(new Dialog_RecolorArea(aa)); //TODO: better dialog } } }
public static void AddWidget(WidgetRow row, bool worldView) { if (worldView) { return; } if (row.ButtonIcon(ContentFinder <Texture2D> .Get("Rename"), "Rename the Colony!")) { Settlement settlement = (Settlement)Find.CurrentMap.info.parent; Find.WindowStack.Add(new Dialog_RenameColony(settlement)); } }
/// <summary> /// Draw choices for preview quality. /// </summary> /// <param name="widgetRow"> Helper for drawing. </param> protected virtual void DrawPreviewQuality(WidgetRow widgetRow) { ValidateArg.NotNull(widgetRow, nameof(widgetRow)); GUI.color = Color.grey; Text.Anchor = TextAnchor.MiddleLeft; widgetRow.LabelWithHighlight(UIText.PreviewQuality.TranslateSimple(), UIText.PreviewQualityTooltip.TranslateSimple()); GUI.color = Color.white; if (widgetRow.ButtonIcon(TexResource.TriangleLeft)) { _qualityPreview = _qualityPreview.Previous(); } Text.Anchor = TextAnchor.MiddleCenter; widgetRow.Label(_qualityPreview.GetLabel(), GenUI.GetWidthCached(UIText.TenCharsString)); if (widgetRow.ButtonIcon(TexResource.TriangleRight)) { _qualityPreview = _qualityPreview.Next(); } }
public static void Postfix(WidgetRow row, bool worldView) { if (!worldView) { if (row.ButtonIcon(ShowPriority, "P_ShowPriority".Translate())) { var listOptions = new List <FloatMenuOption>(); listOptions.Add(new FloatMenuOption("None".Translate(), delegate() { MainMod.ForcedDrawMode = PriorityDrawMode.None; })); listOptions.Add(new FloatMenuOption("P_Cell".Translate(), delegate() { MainMod.ForcedDrawMode = PriorityDrawMode.Cell; })); listOptions.Add(new FloatMenuOption("P_Thing".Translate(), delegate() { MainMod.ForcedDrawMode = PriorityDrawMode.Thing; })); Find.WindowStack.Add(new FloatMenu(listOptions)); } } }
private void DrawMakeLoadout(Rect rect, Pawn pawn) { string label = UIText.MakeLoadout.TranslateSimple(); WidgetRow widgetRow = new WidgetRow(rect.x, rect.y, UIDirection.RightThenDown); if (widgetRow.ButtonText(label)) { Find.WindowStack.Add( new FloatMenu(pawn.MakeActionableLoadoutOption())); } else if (_copy != null && widgetRow.ButtonIcon(TexResource.Paste)) { pawn.SetLoadout(_copy); } }
internal static void DrawDebugToolbarButton(WidgetRow widgets) { if (widgets.ButtonIcon(profilerIconTex, "Open Harmony Profiler")) { var stack = Find.WindowStack; if (stack.IsOpen <Dialog_HarmonyProfiler>()) { stack.TryRemove(typeof(Dialog_HarmonyProfiler)); } else { stack.Add(new Dialog_HarmonyProfiler()); } } }
internal static void DrawDebugToolbarButton(WidgetRow widgets) { if (widgets.ButtonIcon(iconTex, "Inject code from ModDir/RuntimeCode")) { var fileName = $"{rootDir}\\RuntimeCode\\Assemblies\\RuntimeCode.dll"; if (!File.Exists(fileName)) { Log.Error($"Dll not found: {fileName}"); return; } // need to change internal dll name so that you can inject it many times using (MemoryStream memStream = new MemoryStream()) { var newAsmName = Guid.NewGuid().ToString(); using (var asmCecil = AssemblyDefinition.ReadAssembly(fileName)) { asmCecil.Name = new AssemblyNameDefinition(newAsmName, Version.Parse("1.0.0.0")); asmCecil.Write(memStream); } var asm = Assembly.Load(memStream.ToArray()); try { var type = asm.GetType("RuntimeCode.Initializer"); if (type == null) { Log.Error($"Can't find type: RuntimeCode.Initializer"); return; } var method = type.GetMethod("Start"); if (method == null) { Log.Error($"Can't find method: RuntimeCode.Initializer:Start"); return; } method.Invoke(null, null); } catch (Exception e) { Log.Error($"Exception when loading code: {e}"); } } } }
private static void DoColumn( Rect rect, Policy policy, Resources.Type type) { GUI.BeginGroup(rect); WidgetRow widgetRow = new WidgetRow(0f, 0f, UIDirection.RightThenUp, 99999f, 4f); widgetRow.Gap(4f); if (policy != null) { widgetRow.Label(policy.label, 138f); if (widgetRow.ButtonText( "BPC.Rename".Translate(), null, true, false)) { Find.WindowStack.Add(new Dialog_RenamePolicy(policy, type)); } if (policy.id > 0 && widgetRow.ButtonIcon( ContentFinder <Texture2D> .Get( "UI/Buttons/Delete", true), null)) { switch (type) { case Resources.Type.assign: AssignManager.DeletePolicy(policy); break; case Resources.Type.animal: AnimalManager.DeletePolicy(policy); break; case Resources.Type.restrict: RestrictManager.DeletePolicy(policy); break; case Resources.Type.work: WorkManager.DeletePolicy(policy); break; } } } GUI.EndGroup(); }
public static void DoInspectPaneButtons(Rect rect, ref float lineEndWidth, MainTabWindow_Inspect __instance) { if (Find.Selector.NumSelected == 1) { Thing singleSelectedThing = Find.Selector.SingleSelectedThing; if (singleSelectedThing != null) { Widgets.InfoCardButton(rect.width - 48f, 0f, Find.Selector.SingleSelectedThing); lineEndWidth += 24f; Pawn pawn = singleSelectedThing as Pawn; if (pawn != null && pawn.playerSettings != null && pawn.playerSettings.UsesConfigurableHostilityResponse) { HostilityResponseModeUtility.DrawResponseButton(new Vector2(rect.width - 72f, 0f), pawn); lineEndWidth += 24f; } if (pawn != null) { Need_Soul soul; if ((soul = pawn.needs.TryGetNeed <Need_Soul>()) != null) { float num = rect.height - 48; Widgets.ListSeparator(ref num, rect.width, "PawnAlignment".Translate()); ColorInt colorInt = new ColorInt(65, 25, 25); Texture2D soultex = SolidColorMaterials.NewSolidColorTexture(colorInt.ToColor); ColorInt colorInt2 = new ColorInt(10, 10, 10); Texture2D bgtex = SolidColorMaterials.NewSolidColorTexture(colorInt2.ToColor); WidgetRow row = new WidgetRow(0f, rect.height - 24f); row.FillableBar(93f, 16f, soul.CurLevelPercentage, soul.CurCategory.ToString(), soultex, bgtex); String desc = "PawnAlignmentButtonDescription".Translate(); if (row.ButtonIcon(HarmonyPatches.patronIcon, desc)) { Find.WindowStack.Add(new MainTabWindow_Alignment()); } string culturalTolerance = "Cultural Tolerance: " + soul.CulturalTolerance.ToString(); Widgets.Label(new Rect(rect.width / 2, rect.height - 24, rect.width / 2, 16f), culturalTolerance); } } } } }