public static void DoConfigInterfaceExt(this Bill_Production _this, Rect baseRect, Color baseColor) { // counter label var rect = new Rect(28f, 32f, 100f, 30f); var counterLabel = _this.RepeatInfoText; // min count label GUI.color = new Color(1f, 1f, 1f, 0.65f); if (_this.repeatMode == BillRepeatModeDefOf.TargetCount) { var labelWidget = new WidgetRow(28, 32, UIDirection.RightThenDown); var extendable = (IExtendable)_this; counterLabel = extendable.MinStock + "/" + counterLabel; var str = counterLabel.Split('/'); // min labelWidget.Label(str[0] + "/"); // current GUI.color = new Color(1f, 1f, 1f, 1f); labelWidget.Label(str[1]); GUI.color = new Color(1f, 1f, 1f, 0.65f); // max labelWidget.Label("/" + str[2]); } else { Widgets.Label(rect, counterLabel); } GUI.color = baseColor; var widgetRow = new WidgetRow(baseRect.xMax, baseRect.y + 29f, UIDirection.LeftThenUp, 99999f, 4f); CreateAssignPawnButton(_this); CreateDetailButton(_this, widgetRow); //CreateHaulModeButton(_this, widgetRow); CreateRepeatButton(_this, widgetRow); CreatePlusMinusButton(_this, widgetRow); CreateOverlayLabel(_this, baseRect); }
public void DoGuiHeadder(Rect rectContentWindow) { // Headder to Select Tabs ----------------------------------------- WidgetRow _ButtonWidgetRow = new WidgetRow(rectContentWindow.x, rectContentWindow.y, UIDirection.RightThenDown, 99999f, 4f); if (_ButtonWidgetRow.ButtonText("Fabrication", null, true, true)) { this.optionalTitle = "E.D.S.N Exclibur - Fabrication"; this.m_CurrentTab = EnumDialogTabSelection.Fabrication; } if (_ButtonWidgetRow.ButtonText("System Status", null, true, true)) { this.optionalTitle = "E.D.S.N Exclibur - System Status"; this.m_CurrentTab = EnumDialogTabSelection.SystemStatus; } Widgets.DrawLineHorizontal(rectContentWindow.xMin, rectContentWindow.yMax, rectContentWindow.width); }
public static void DoPaneContentsFor(ISelectable sel, Rect rect) { try { GUI.BeginGroup(rect); float num = 0f; Thing thing = sel as Thing; Pawn pawn = sel as Pawn; if (thing != null) { num += 3f; WidgetRow row = new WidgetRow(0f, num, UIDirection.RightThenUp, 2000f, 29f); InspectPaneFiller.DrawHealth(row, thing); if (pawn != null) { InspectPaneFiller.DrawMood(row, pawn); if (pawn.timetable != null) { InspectPaneFiller.DrawTimetableSetting(row, pawn); } InspectPaneFiller.DrawAreaAllowed(row, pawn); } num += 18f; } InspectPaneFiller.DrawInspectStringFor(sel, ref num); } catch (Exception ex) { Log.ErrorOnce(string.Concat(new object[] { "Error in DoPaneContentsFor ", Find.Selector.FirstSelectedObject, ": ", ex.ToString() }), 754672); } finally { GUI.EndGroup(); } }
private static void DrawColorOption(Listing_Standard listing, MoodLevel moodLevel) { Rect rect = listing.GetRect(GenUI.ListSpacing); WidgetRow row = new WidgetRow(rect.x, rect.y, UIDirection.RightThenDown, rect.width); if (row.ButtonIcon(moodLevel.GetTexture())) { Find.WindowStack.Add(new Dialog_ColorPicker( moodLevel.GetColor(), (color) => { switch (moodLevel) { case MoodLevel.Satisfied: ModSettings.Satisfied = color; BCBTexture.Satisfied = SolidColorMaterials.NewSolidColorTexture(color); break; case MoodLevel.Minor: ModSettings.Minor = color; BCBTexture.Minor = SolidColorMaterials.NewSolidColorTexture(color); break; case MoodLevel.Major: ModSettings.Major = color; BCBTexture.Major = SolidColorMaterials.NewSolidColorTexture(color); break; case MoodLevel.Extreme: ModSettings.Extreme = color; BCBTexture.Extreme = SolidColorMaterials.NewSolidColorTexture(color); break; } ModSettings.UISettingsChanged = true; })); } row.GapButtonIcon(); row.Label(moodLevel.ToString()); }
public void DoPlaySettingsGlobalControls(WidgetRow row, bool worldView) { bool flag = this.showColonistBar; if (worldView) { if (Current.ProgramState == ProgramState.Playing) { row.ToggleableIcon(ref this.showColonistBar, TexButton.ShowColonistBar, "ShowColonistBarToggleButton".Translate(), SoundDefOf.MouseoverToggle, null); } bool flag2 = this.lockNorthUp; row.ToggleableIcon(ref this.lockNorthUp, TexButton.LockNorthUp, "LockNorthUpToggleButton".Translate(), SoundDefOf.MouseoverToggle, null); if (flag2 != this.lockNorthUp && this.lockNorthUp) { Find.WorldCameraDriver.RotateSoNorthIsUp(true); } row.ToggleableIcon(ref this.usePlanetDayNightSystem, TexButton.UsePlanetDayNightSystem, "UsePlanetDayNightSystemToggleButton".Translate(), SoundDefOf.MouseoverToggle, null); row.ToggleableIcon(ref this.showExpandingIcons, TexButton.ShowExpandingIcons, "ShowExpandingIconsToggleButton".Translate(), SoundDefOf.MouseoverToggle, null); row.ToggleableIcon(ref this.showWorldFeatures, TexButton.ShowWorldFeatures, "ShowWorldFeaturesToggleButton".Translate(), SoundDefOf.MouseoverToggle, null); } else { row.ToggleableIcon(ref this.showLearningHelper, TexButton.ShowLearningHelper, "ShowLearningHelperWhenEmptyToggleButton".Translate(), SoundDefOf.MouseoverToggle, null); row.ToggleableIcon(ref this.showZones, TexButton.ShowZones, "ZoneVisibilityToggleButton".Translate(), SoundDefOf.MouseoverToggle, null); row.ToggleableIcon(ref this.showEnvironment, TexButton.ShowEnvironment, "ShowEnvironmentToggleButton".Translate(), SoundDefOf.MouseoverToggle, "InspectRoomStats"); row.ToggleableIcon(ref this.showColonistBar, TexButton.ShowColonistBar, "ShowColonistBarToggleButton".Translate(), SoundDefOf.MouseoverToggle, null); row.ToggleableIcon(ref this.showRoofOverlay, TexButton.ShowRoofOverlay, "ShowRoofOverlayToggleButton".Translate(), SoundDefOf.MouseoverToggle, null); row.ToggleableIcon(ref this.autoHomeArea, TexButton.AutoHomeArea, "AutoHomeAreaToggleButton".Translate(), SoundDefOf.MouseoverToggle, null); bool resourceReadoutCategorized = Prefs.ResourceReadoutCategorized; bool flag3 = resourceReadoutCategorized; row.ToggleableIcon(ref resourceReadoutCategorized, TexButton.CategorizedResourceReadout, "CategorizedResourceReadoutToggleButton".Translate(), SoundDefOf.MouseoverToggle, null); if (resourceReadoutCategorized != flag3) { Prefs.ResourceReadoutCategorized = resourceReadoutCategorized; } } if (flag != this.showColonistBar) { Find.ColonistBar.MarkColonistsDirty(); } }
private static void ButtonOnGUI(WidgetRow widgetRow) { if (widgetRow.ButtonIcon(ConsoleTexturePool.Get("Console/PythonConsoleOpen"), "Open the Python console.")) { //button was clicked var inst = Instance; List <Verse.Window> windowstack_windows = (List <Window>) typeof(WindowStack).InvokeMember("windows", BindingFlags.GetField | BindingFlags.Instance | BindingFlags.NonPublic, null, Find.WindowStack, null); List <ConsoleWindow> visible_windows = windowstack_windows.FindAll(w => typeof(ConsoleWindow).IsInstanceOfType(w)) .Cast <ConsoleWindow>().ToList(); if (visible_windows.Count > 0) { //put all visible console windows into storage foreach (Window w in visible_windows) { Find.WindowStack.TryRemove(w, false); } inst.windows_storage.AddRange(visible_windows); } else { if (inst.windows_storage.Count > 0) { //move stored windows back to WindowStack foreach (Window w in inst.windows_storage) { Find.WindowStack.Add(w); } inst.windows_storage.Clear(); } else { //there are no console windows at all; make one Find.WindowStack.Add(new ConsoleWindow()); } } } }
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); } } } } }
public static void Draw() { if (Prefs.DevMode && AwesomeInventoryMod.Settings.ShowRestartButton) { Vector2 vector = new Vector2((float)UI.screenWidth * 0.5f - WidgetRow.IconSize, 3f); Find.WindowStack.ImmediateWindow( typeof(UnitTestButton).GetHashCode(), new Rect(vector.x, vector.y, WidgetRow.IconSize, WidgetRow.IconSize).Rounded(), WindowLayer.GameUI, () => { WidgetRow row = new WidgetRow(WidgetRow.IconSize, 0, UIDirection.LeftThenDown); if (row.ButtonIcon(UnitTextIcon, "Restart Rimworld")) { GenCommandLine.Restart(); } }, doBackground: false, absorbInputAroundWindow: false, 0f); } }
static void PostFix(WidgetRow row, bool worldView) { if (worldView) { return; } if (row == null || TexButton.Pause == null) { return; } row.ToggleableIcon(ref SettingsController.ShowElevationMap, TexButton.Pause, "Show Elevation Topography Map", SoundDefOf.MouseoverToggle); row.ToggleableIcon(ref SettingsController.ShowMoistureMap, TexButton.Pause, "Show Moisture Topography Map", SoundDefOf.MouseoverToggle); row.ToggleableIcon(ref SettingsController.ShowWaterLevelMap, TexButton.Pause, "Show Water Level Topography Map", SoundDefOf.MouseoverToggle); }
public void DoEditWidgets(WidgetRow widgetRow) { if (!widgetRow.ButtonText("Setup from preset...", "Set up the reverb filter from a preset.")) { return; } List <FloatMenuOption> list = new List <FloatMenuOption>(); foreach (AudioReverbPreset value in Enum.GetValues(typeof(AudioReverbPreset))) { if (value != AudioReverbPreset.User) { AudioReverbPreset localPreset = value; list.Add(new FloatMenuOption(value.ToString(), delegate { this.SetupAs(localPreset); })); } } Find.WindowStack.Add(new FloatMenu(list)); }
public static void DrawHealth(WidgetRow row, Thing t) { Pawn pawn = t as Pawn; float fillPct; string label; if (pawn == null) { if (!t.def.useHitPoints) { return; } if (t.HitPoints >= t.MaxHitPoints) { GUI.color = Color.white; } else if ((float)t.HitPoints > (float)t.MaxHitPoints * 0.5f) { GUI.color = Color.yellow; } else if (t.HitPoints > 0) { GUI.color = Color.red; } else { GUI.color = Color.grey; } fillPct = (float)t.HitPoints / (float)t.MaxHitPoints; label = t.HitPoints.ToStringCached() + " / " + t.MaxHitPoints.ToStringCached(); } else { GUI.color = Color.white; fillPct = pawn.health.summaryHealth.SummaryHealthPercent; label = HealthUtility.GetGeneralConditionLabel(pawn, true); } row.FillableBar(93f, 16f, fillPct, label, InspectPaneFiller.HealthTex, InspectPaneFiller.BarBGTex); GUI.color = Color.white; }
/// <summary> /// Draw ammo selection for <paramref name="thingDef"/> if it is an ammo user. /// </summary> /// <param name="widgetRow"> Drawing helper. </param> /// <param name="thingDef"> Ammo user. </param> protected virtual void DrawAmmoSelection(WidgetRow widgetRow, ThingDef thingDef) { ValidateArg.NotNull(widgetRow, nameof(widgetRow)); ValidateArg.NotNull(thingDef, nameof(thingDef)); if (thingDef.HasComp(typeof(CompAmmoUser)) && widgetRow.ButtonIcon(ImageResource.IconAmmo)) { CompProperties_AmmoUser ammoUser = thingDef.GetCompProperties <CompProperties_AmmoUser>(); GenericAmmo genericAmmo = this.CreateGenericAmmoDef(thingDef); List <FloatMenuOption> options = new List <FloatMenuOption>(); foreach (ThingDef ammoDef in ammoUser.ammoSet?.ammoTypes.Select(al => al.ammo as ThingDef).Concat(genericAmmo as ThingDef)) { options.Add( new FloatMenuOption( ammoDef.LabelCap , () => { ThingGroupSelector groupSelector = new ThingGroupSelector(ammoDef); ThingSelector thingSelector; thingSelector = AwesomeInventoryServiceProvider.MakeInstanceOf <SingleThingSelector>(ammoDef, null); groupSelector.SetStackCount(ammoUser.magazineSize); groupSelector.Add(thingSelector); if (WhiteBlacklistView.IsWishlist) { _currentLoadout.Add(groupSelector); } else { _currentLoadout.AddToBlacklist(groupSelector); } })); } Find.WindowStack.Add(new FloatMenu(options)); } }
public override void DoSettingsWindowContents(Rect inRect) { var listingStandard = new Listing_Standard(); listingStandard.Begin(inRect); WidgetRow widgetRow = new WidgetRow(0f, 0f, UIDirection.RightThenUp, 99999f, 4f); widgetRow.Gap(4f); if (Current.Game != null) { if (widgetRow.ButtonText("ColonistBarHiding.GetSettings".Translate(), null, true, false)) { Find.WindowStack.Add(new Dialog_ManageColonistBar(false)); } } else { widgetRow.Label("ColonistBarHiding.NoCurrentGame".Translate()); } listingStandard.End(); base.DoSettingsWindowContents(inRect); }
/// <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(); } }
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; } } } GUI.EndGroup(); }
private static void CreateRepeatButton(Bill_Production _this, WidgetRow widgetRow) { Texture2D tex = null; if (_this.repeatMode == BillRepeatModeDefOf.RepeatCount) { tex = TexButton.RepeatCount; } else if (_this.repeatMode == BillRepeatModeDefOf.TargetCount) { tex = TexButton.TargetCount; } else if (_this.repeatMode == BillRepeatModeDefOf.Forever) { tex = TexButton.Forever; } if (widgetRow.ButtonIcon(tex, _this.repeatMode.GetLabel())) { BillRepeatModeUtility.MakeConfigFloatMenu(_this); } }
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 num = rect.width - widgetRow.FinalX - 4f; Vector2 vector = Text.CalcSize("Rename".Translate()); float num2 = num - vector.x - 16f - 4f; Vector2 vector2 = Text.CalcSize("InvertArea".Translate()); float width = num2 - vector2.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(); } WidgetRow widgetRow2 = widgetRow; Texture2D deleteX = TexButton.DeleteX; Color? mouseoverColor = GenUI.SubtleMouseoverColor; if (widgetRow2.ButtonIcon(deleteX, null, mouseoverColor)) { area.Delete(); } GUI.EndGroup(); }
public void DoListing(Rect rect) { GUI.BeginGroup(rect); Text.Font = GameFont.Small; WidgetRow widgetRow = new WidgetRow(0.0f, 0.0f, UIDirection.RightThenDown, 99999f, 4f); if (widgetRow.ButtonText("ReligionInfo_AddTask".Translate())) { Find.WindowStack.Add((Window) new FloatMenu(menuOptions)); } Text.Anchor = TextAnchor.UpperLeft; GUI.color = Color.white; Rect outRect = new Rect(0.0f, 35f, rect.width, rect.height - 35f); Rect viewRect = new Rect(0.0f, 0.0f, outRect.width - 16f, 1300f); Widgets.BeginScrollView(outRect, ref scrollPosition, viewRect, true); float y = 0.0f; for (int index = 0; index < day.Tasks.Count(); ++index) { ActivityTask task = day.Tasks.ElementAt(index); Rect rect1 = task.DoInterface(0.0f, y, viewRect.width, index); Rect deleteRect = new Rect(rect1.width - 24f, y, 24f, 24f); if (Widgets.ButtonImage(deleteRect, GraphicsCache.DeleteX, Color.white, Color.white * GenUI.SubtleMouseoverColor)) { day.Remove(task); SoundDefOf.Click.PlayOneShotOnCamera((Map)null); } //TooltipHandler.TipRegion(deleteRect, (TipSignal)"DeleteBillTip".Translate()); y += rect1.height + 6f; } if (Event.current.type == EventType.Layout) { viewRect.height = y + 60f; } Widgets.EndScrollView(); GUI.EndGroup(); }
private static void DrawAreaAllowed(WidgetRow row, Pawn pawn) { if (pawn.playerSettings == null || !pawn.playerSettings.RespectsAllowedArea) { return; } row.Gap(6f); bool flag = pawn.playerSettings != null && pawn.playerSettings.AreaRestriction != null; Texture2D fillTex; if (flag) { fillTex = pawn.playerSettings.AreaRestriction.ColorTexture; } else { fillTex = BaseContent.GreyTex; } Rect rect = row.FillableBar(93f, 16f, 1f, AreaUtility.AreaAllowedLabel(pawn), fillTex, null); if (Mouse.IsOver(rect)) { if (flag) { pawn.playerSettings.AreaRestriction.MarkForDraw(); } Rect rect2 = rect.ContractedBy(-1f); Widgets.DrawBox(rect2, 1); } if (Widgets.ButtonInvisible(rect, false)) { AllowedAreaMode mode = (!pawn.RaceProps.Humanlike) ? AllowedAreaMode.Animal : AllowedAreaMode.Humanlike; AreaUtility.MakeAllowedAreaListFloatMenu(delegate(Area a) { pawn.playerSettings.AreaRestriction = a; }, mode, true, true, pawn.Map); } }
private static void Postfix(WidgetRow row, bool worldView) { if (worldView || (row == null)) { return; } var component = Find.CurrentMap?.GetComponent <QuicksavedCameraPosMapComponent>(); if (component == null) { return; } var activated = component.savedPosition != null; var wasActivated = activated; var langKey = Mod.Id + (activated ? ".Load" : ".Save"); row.ToggleableIcon(ref activated, Textures.Icon, langKey.Translate(), SoundDefOf.Mouseover_ButtonToggle); if (activated != wasActivated) { if (Input.GetMouseButtonUp(1)) { component.ClearPosition(); } else if (activated) { component.SavePosition(); } else { component.LoadPosition(); component.ClearPosition(); } } }
internal static void DrawDebugToolbarButton(WidgetRow widgets) { if (widgets.ButtonIcon(quickstartIconTex, "Open the quickstart settings.\n\nThis lets you automatically generate a map or load an existing save when the game is started.\nShift-click to quick-generate a new map.")) { 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 override bool DrawOption(Rect rect) { bool changed = false; WidgetRow row = new WidgetRow(rect.x, rect.y); row.Label("TD.AnythingXStepsNearbyMatches".Translate()); if (row.ButtonText(any ? "TD.AnyOption".Translate() : "TD.AllOptions".Translate())) { any = !any; changed = true; } IntRange slider = new IntRange(0, range); rect.xMin = row.FinalX; Widgets.IntRange(rect, id, ref slider, max: 10); if (range != slider.max) { range = slider.max; changed = true; } return(changed); }
private void DrawModeButton(Rect rowRect, out float rollingY) { WidgetRow widgetRow = new WidgetRow(rowRect.x, rowRect.y, UIDirection.RightThenDown); switch (_mode) { case ViewMode.Loadout: if (widgetRow.ButtonText(UIText.LoadoutView.TranslateSimple())) { _mode = ViewMode.Inventory; } break; case ViewMode.Inventory: if (widgetRow.ButtonText(UIText.InventoryView.TranslateSimple())) { _mode = ViewMode.Loadout; } break; } rollingY = widgetRow.FinalY + GenUI.ListSpacing; }
public static void DoPaneContentsFor(ISelectable sel, Rect rect) { try { GUI.BeginGroup(rect); float num = 0f; Thing thing = sel as Thing; Pawn pawn = sel as Pawn; if (thing != null) { num += 3f; WidgetRow row = new WidgetRow(0f, num); DrawHealth(row, thing); if (pawn != null) { DrawMood(row, pawn); if (pawn.timetable != null) { DrawTimetableSetting(row, pawn); } DrawAreaAllowed(row, pawn); } num += 18f; } Rect rect2 = rect.AtZero(); rect2.yMin = num; DrawInspectStringFor(sel, rect2); } catch (Exception ex) { Log.ErrorOnce(string.Concat("Error in DoPaneContentsFor ", Find.Selector.FirstSelectedObject, ": ", ex.ToString()), 754672); } finally { GUI.EndGroup(); } }
private void DoAreaRow(Area areaToList, Listing_Standard listing, int group, int count, int priority, bool isPriority) { var 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, count, priority, isPriority); var widgetRow = new WidgetRow(rowRect.x, rowRect.y, UIDirection.RightThenUp, rowRect.width); widgetRow.Icon(TextureLoader.dragHash); widgetRow.Icon(areaToList.ColorTexture); 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 DoPaneContentsFor(ISelectable sel, Rect rect) { try { GUI.BeginGroup(rect); float num = 0f; Thing thing = sel as Thing; Pawn pawn = sel as Pawn; if (thing != null) { num = (float)(num + 3.0); WidgetRow row = new WidgetRow(0f, num, UIDirection.RightThenUp, 99999f, 4f); InspectPaneFiller.DrawHealth(row, thing); if (pawn != null) { InspectPaneFiller.DrawMood(row, pawn); if (pawn.timetable != null) { InspectPaneFiller.DrawTimetableSetting(row, pawn); } InspectPaneFiller.DrawAreaAllowed(row, pawn); } num = (float)(num + 18.0); } Rect rect2 = rect.AtZero(); rect2.yMin = num; InspectPaneFiller.DrawInspectStringFor(sel, rect2); } catch (Exception ex) { Log.ErrorOnce("Error in DoPaneContentsFor " + Find.Selector.FirstSelectedObject + ": " + ex.ToString(), 754672); } finally { GUI.EndGroup(); } }
private static void CreateRepeatButton(Bill_Production _this, WidgetRow widgetRow) { Texture2D tex = null; switch (_this.repeatMode) { case BillRepeatMode.RepeatCount: tex = TexButton.RepeatCount; break; case BillRepeatMode.TargetCount: tex = TexButton.TargetCount; break; case BillRepeatMode.Forever: tex = TexButton.Forever; break; } if (widgetRow.ButtonIcon(tex, _this.repeatMode.GetLabel())) { BillRepeatModeUtility.MakeConfigFloatMenu(_this); } }
public static WidgetRow ReverseDirection(WidgetRow widgetRow, Rect rect) { return(new WidgetRow(rect.width, 0f, UIDirection.LeftThenUp, 99999f, 4f)); }
private void DoScenarioListEntry(Rect rect, Scenario scen) { bool flag = 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) { return; } WidgetRow widgetRow = new WidgetRow(rect.xMax, rect.y, UIDirection.LeftThenDown); if (scen.Category == ScenarioCategory.CustomLocal && widgetRow.ButtonIcon(TexButton.DeleteX, "Delete".Translate(), GenUI.SubtleMouseoverColor)) { Find.WindowStack.Add(Dialog_MessageBox.CreateConfirmation("ConfirmDelete".Translate(scen.File.Name), delegate { scen.File.Delete(); ScenarioLister.MarkDirty(); }, destructive: true)); } if (scen.Category == ScenarioCategory.SteamWorkshop && widgetRow.ButtonIcon(TexButton.DeleteX, "Unsubscribe".Translate(), GenUI.SubtleMouseoverColor)) { Find.WindowStack.Add(Dialog_MessageBox.CreateConfirmation("ConfirmUnsubscribe".Translate(scen.File.Name), delegate { scen.enabled = false; if (curScen == scen) { curScen = null; EnsureValidSelection(); } Workshop.Unsubscribe(scen); }, destructive: true)); } if (scen.GetPublishedFileId() != PublishedFileId_t.Invalid) { if (widgetRow.ButtonIcon(ContentSource.SteamWorkshop.GetIcon(), "WorkshopPage".Translate())) { SteamUtility.OpenWorkshopPage(scen.GetPublishedFileId()); } if (scen.CanToUploadToWorkshop()) { widgetRow.Icon(CanUploadIcon, "CanBeUpdatedOnWorkshop".Translate()); } } if (!flag && Widgets.ButtonInvisible(rect)) { curScen = scen; SoundDefOf.Click.PlayOneShotOnCamera(); } }
public override void DoWindowContents(Rect inRect) { //Title var listing = new Listing_Standard(); listing.Begin(inRect); Text.Font = GameFont.Medium; listing.Label("TD.CustomAlerts".Translate()); Text.Font = GameFont.Small; listing.GapLine(); listing.End(); //Check off Rect enableRect = inRect.RightHalf().TopPartPixels(Text.LineHeight); Widgets.CheckboxLabeled(enableRect, "Enable Alerts", ref Alert_Find.enableAll); //Margin inRect.yMin += listing.CurHeight; //Useful things: Map map = Find.CurrentMap; ListEverythingGameComp comp = Current.Game.GetComponent <ListEverythingGameComp>(); string remove = null; //Scrolling! Rect viewRect = new Rect(0f, 0f, inRect.width - 16f, scrollViewHeight); Widgets.BeginScrollView(inRect, ref scrollPosition, viewRect); Rect rowRect = viewRect; rowRect.height = RowHeight; foreach (string name in comp.AlertNames()) { FindAlertData alert = comp.GetAlert(name); FindDescription desc = alert.desc; WidgetRow row = new WidgetRow(rowRect.x, rowRect.y, UIDirection.RightThenDown, rowRect.width); rowRect.y += RowHeight; row.Label(alert.Label, rowRect.width / 4); if (row.ButtonText("Rename".Translate())) { Find.WindowStack.Add(new Dialog_Name(newName => comp.RenameAlert(name, newName))); } if (row.ButtonText("Load".Translate())) { MainTabWindow_List.OpenWith(desc.Clone(map)); } if (row.ButtonText("Delete".Translate())) { remove = name; } bool crit = desc.alertPriority == AlertPriority.Critical; row.ToggleableIcon(ref crit, TexButton.PassionMajorIcon, "TD.CriticalAlert".Translate()); comp.SetPriority(name, crit ? AlertPriority.Critical : AlertPriority.Medium); row.Label("TD.SecondsUntilShown".Translate()); int sec = desc.ticksToShowAlert / 60; string secStr = sec.ToString(); Rect textRect = row.GetRect(64); textRect.height -= 4; textRect.width -= 4; Widgets.TextFieldNumeric(textRect, ref sec, ref secStr, 0, 999999); TooltipHandler.TipRegion(textRect, "TD.Tip1000SecondsInARimworldDay".Translate()); comp.SetTicks(name, sec * 60); row.Label("TD.ShowWhen".Translate()); if (row.ButtonIcon(TexFor(desc.countComp))) { comp.SetComp(name, (CompareType)((int)(desc.countComp + 1) % 3)); } int count = desc.countToAlert; string countStr = count.ToString(); textRect = row.GetRect(64); textRect.height -= 4; textRect.width -= 4; Widgets.TextFieldNumeric(textRect, ref count, ref countStr, 0, 999999); comp.SetCount(name, count); } scrollViewHeight = RowHeight * comp.AlertNames().Count(); Widgets.EndScrollView(); if (remove != null) { if (Event.current.shift) { comp.RemoveAlert(remove); } else { Find.WindowStack.Add(Dialog_MessageBox.CreateConfirmation( "TD.Delete0".Translate(remove), () => comp.RemoveAlert(remove))); } } }