private static void DrawTimeAssignmentSelectorFor(Rect rect, TimeAssignmentDef ta) { rect = rect.ContractedBy(2f); GUI.DrawTexture(rect, ta.ColorTexture); if (Widgets.ButtonInvisible(rect)) { selectedAssignment = ta; SoundDefOf.Tick_High.PlayOneShotOnCamera(); } GUI.color = Color.white; if (Mouse.IsOver(rect)) { Widgets.DrawHighlight(rect); } Text.Font = GameFont.Small; Text.Anchor = TextAnchor.MiddleCenter; GUI.color = Color.white; Widgets.Label(rect, ta.LabelCap); Text.Anchor = TextAnchor.UpperLeft; if (selectedAssignment == ta) { Widgets.DrawBox(rect, 2); } else { UIHighlighter.HighlightOpportunity(rect, ta.cachedHighlightNotSelectedTag); } }
public bool ButtonText(string label, ref bool setting, bool dev, ref float modifier, string highlightTag = null, bool extend = false) { Rect rect = this.GetRect(30, null, extend); if (dev) { Rect r = rect.RightPart(0.25f); rect = rect.LeftPart(0.75f); if (Widgets.ButtonText(r.LeftHalf(), "-")) { modifier--; } if (Widgets.ButtonText(r.RightHalf(), "+")) { modifier++; } } if (Widgets.ButtonText(rect, label, true, true, true)) { setting = !setting; } if (highlightTag != null) { UIHighlighter.HighlightOpportunity(rect, highlightTag); } if (!highlightTag.NullOrEmpty()) { TooltipHandler.TipRegion(rect, highlightTag); } this.Gap(this.verticalSpacing); return(setting); }
public override void DrawOnGUI(Rect rect, int maxThresholdMarkers = int.MaxValue, float customMargin = -1F, bool drawArrows = true, bool doTooltip = true, Rect?rectForTooltip = null) { //base.DrawOnGUI(rect, maxThresholdMarkers, customMargin, drawArrows, doTooltip); if (rect.height > 70f) { var num = (rect.height - 70f) / 2f; rect.height = 70f; rect.y += num; } if (Mouse.IsOver(rect)) { Widgets.DrawHighlight(rect); } TooltipHandler.TipRegion(rect, new TipSignal(GetTipString, rect.GetHashCode())); var num2 = 14f; var num3 = num2 + 15f; if (rect.height < 50f) { num2 *= Mathf.InverseLerp(0f, 50f, rect.height); } Text.Font = rect.height <= 55f ? GameFont.Tiny : GameFont.Small; Text.Anchor = TextAnchor.LowerLeft; var rect2 = new Rect(rect.x + num3 + (rect.width * 0.1f), rect.y, rect.width - num3 - (rect.width * 0.1f), rect.height / 2f); Widgets.Label(rect2, LabelCap); Text.Anchor = TextAnchor.UpperLeft; var rect3 = new Rect(rect.x, rect.y + (rect.height / 2f), rect.width, rect.height / 2f); rect3 = new Rect(rect3.x + num3, rect3.y, rect3.width - (num3 * 2f), rect3.height - num2); Widgets.FillableBar(rect3, CurLevelPercentage); //else Widgets.FillableBar(rect3, this.CurLevelPercentage); //Widgets.FillableBarChangeArrows(rect3, this.GUIChangeArrow); if (threshPercents != null) { foreach (var threshPct in threshPercents) { DrawBarThreshold(rect3, threshPct); } } var curInstantLevelPercentage = CurInstantLevelPercentage; if (curInstantLevelPercentage >= 0f) { DrawBarInstantMarkerAt(rect3, curInstantLevelPercentage); } if (!def.tutorHighlightTag.NullOrEmpty()) { UIHighlighter.HighlightOpportunity(rect, def.tutorHighlightTag); } Text.Font = GameFont.Small; }
public static void DrawResponseButton(Rect rect, Pawn pawn, bool paintable) { if (HostilityResponseModeUtility.< > f__mg$cache0 == null) { HostilityResponseModeUtility.< > f__mg$cache0 = new Func <Pawn, HostilityResponseMode>(HostilityResponseModeUtility.DrawResponseButton_GetResponse); } Func <Pawn, HostilityResponseMode> getPayload = HostilityResponseModeUtility.< > f__mg$cache0; if (HostilityResponseModeUtility.< > f__mg$cache1 == null) { HostilityResponseModeUtility.< > f__mg$cache1 = new Func <Pawn, IEnumerable <Widgets.DropdownMenuElement <HostilityResponseMode> > >(HostilityResponseModeUtility.DrawResponseButton_GenerateMenu); } Func <Pawn, IEnumerable <Widgets.DropdownMenuElement <HostilityResponseMode> > > menuGenerator = HostilityResponseModeUtility.< > f__mg$cache1; Texture2D icon = pawn.playerSettings.hostilityResponse.GetIcon(); Widgets.Dropdown <Pawn, HostilityResponseMode>(rect, pawn, getPayload, menuGenerator, null, icon, null, null, delegate { PlayerKnowledgeDatabase.KnowledgeDemonstrated(ConceptDefOf.HostilityResponse, KnowledgeAmount.SpecificInteraction); }, paintable); UIHighlighter.HighlightOpportunity(rect, "HostilityResponse"); TooltipHandler.TipRegion(rect, string.Concat(new string[] { "HostilityReponseTip".Translate(), "\n\n", "HostilityResponseCurrentMode".Translate(), ": ", pawn.playerSettings.hostilityResponse.GetLabel() })); }
public static void DoAssignDrugPolicyButtons(Rect rect, Pawn pawn) { int num = Mathf.FloorToInt((rect.width - 4f) * 0.714285731f); int num2 = Mathf.FloorToInt((rect.width - 4f) * 0.2857143f); float x = rect.x; Rect rect2 = new Rect(x, rect.y + 2f, num, rect.height - 4f); string text = pawn.drugs.CurrentPolicy.label; if (pawn.story != null && pawn.story.traits != null) { Trait trait = pawn.story.traits.GetTrait(TraitDefOf.DrugDesire); if (trait != null) { text = text + " (" + trait.Label + ")"; } } Widgets.Dropdown(rect2, pawn, (Pawn p) => p.drugs.CurrentPolicy, Button_GenerateMenu, text.Truncate(rect2.width), null, pawn.drugs.CurrentPolicy.label, null, delegate { PlayerKnowledgeDatabase.KnowledgeDemonstrated(ConceptDefOf.DrugPolicies, KnowledgeAmount.Total); }, paintable: true); x += (float)num; x += 4f; Rect rect3 = new Rect(x, rect.y + 2f, num2, rect.height - 4f); if (Widgets.ButtonText(rect3, "AssignTabEdit".Translate())) { Find.WindowStack.Add(new Dialog_ManageDrugPolicies(pawn.drugs.CurrentPolicy)); } UIHighlighter.HighlightOpportunity(rect2, "ButtonAssignDrugs"); UIHighlighter.HighlightOpportunity(rect3, "ButtonAssignDrugs"); x += (float)num2; }
protected void DoBottomButtons(Rect rect, string nextLabel = null, string midLabel = null, Action midAct = null, bool showNext = true) { float y = rect.y + rect.height - 38f; Text.Font = GameFont.Small; string label = "Back".Translate(); Rect rect2 = new Rect(rect.x, y, Page.BottomButSize.x, Page.BottomButSize.y); if ((Widgets.ButtonText(rect2, label, true, false, true) || KeyBindingDefOf.Cancel.KeyDownEvent) && this.CanDoBack()) { this.DoBack(); } if (showNext) { if (nextLabel.NullOrEmpty()) { nextLabel = "Next".Translate(); } Rect rect3 = new Rect(rect.x + rect.width - Page.BottomButSize.x, y, Page.BottomButSize.x, Page.BottomButSize.y); if ((Widgets.ButtonText(rect3, nextLabel, true, false, true) || KeyBindingDefOf.Accept.KeyDownEvent) && this.CanDoNext()) { this.DoNext(); } UIHighlighter.HighlightOpportunity(rect3, "NextPage"); } if (midAct != null) { Rect rect4 = new Rect(rect.x + rect.width / 2f - Page.BottomButSize.x / 2f, y, Page.BottomButSize.x, Page.BottomButSize.y); if (Widgets.ButtonText(rect4, midLabel, true, false, true)) { midAct(); } } }
public virtual void DoButton(Rect rect) { Text.Font = GameFont.Small; string labelCap = this.def.LabelCap; if ((!this.def.validWithoutMap || this.def == MainButtonDefOf.World) && Find.VisibleMap == null) { Widgets.DrawAtlas(rect, Widgets.ButtonSubtleAtlas); if (Event.current.type == EventType.MouseDown && Mouse.IsOver(rect)) { Event.current.Use(); } return; } string label = labelCap; float buttonBarPercent = this.ButtonBarPercent; SoundDef mouseoverCategory = SoundDefOf.MouseoverCategory; if (Widgets.ButtonTextSubtle(rect, label, buttonBarPercent, -1f, mouseoverCategory, default(Vector2))) { this.InterfaceTryActivate(); } if (Find.MainTabsRoot.OpenTab != this.def && !Find.WindowStack.NonImmediateDialogWindowOpen) { UIHighlighter.HighlightOpportunity(rect, this.def.cachedHighlightTagClosed); } if (!this.def.description.NullOrEmpty()) { TooltipHandler.TipRegion(rect, this.def.description); } }
protected void DoBottomButtons(Rect rect, string nextLabel = null, string midLabel = null, Action midAct = null, bool showNext = true, bool doNextOnKeypress = true) { float y = rect.y + rect.height - 38f; Text.Font = GameFont.Small; string label = "Back".Translate(); if ((Widgets.ButtonText(new Rect(rect.x, y, BottomButSize.x, BottomButSize.y), label) || KeyBindingDefOf.Cancel.KeyDownEvent) && CanDoBack()) { DoBack(); } if (showNext) { if (nextLabel.NullOrEmpty()) { nextLabel = "Next".Translate(); } Rect rect2 = new Rect(rect.x + rect.width - BottomButSize.x, y, BottomButSize.x, BottomButSize.y); if ((Widgets.ButtonText(rect2, nextLabel) || (doNextOnKeypress && KeyBindingDefOf.Accept.KeyDownEvent)) && CanDoNext()) { DoNext(); } UIHighlighter.HighlightOpportunity(rect2, "NextPage"); } if (midAct != null && Widgets.ButtonText(new Rect(rect.x + rect.width / 2f - BottomButSize.x / 2f, y, BottomButSize.x, BottomButSize.y), midLabel)) { midAct(); } }
public static void DoAssignDrugPolicyButtons(Rect rect, ColonistGroup group) { int num = Mathf.FloorToInt((rect.width - 4f) * 0.714285731f); int num2 = Mathf.FloorToInt((rect.width - 4f) * 0.2857143f); float x = rect.x; Rect rect2 = new Rect(x, rect.y + 2f, num, rect.height - 4f); string text = group.pawns.First().drugs.CurrentPolicy.label; Widgets.Dropdown(rect2, group, (ColonistGroup g) => g.pawns.First().drugs.CurrentPolicy, Button_GenerateMenu, text.Truncate(rect2.width), null, group.pawns.First().drugs.CurrentPolicy.label, null, delegate { PlayerKnowledgeDatabase.KnowledgeDemonstrated(ConceptDefOf.DrugPolicies, KnowledgeAmount.Total); }, paintable: true); x += (float)num; x += 4f; Rect rect3 = new Rect(x, rect.y + 2f, num2, rect.height - 4f); if (Widgets.ButtonText(rect3, "AssignTabEdit".Translate())) { var window = new Dialog_ManageDrugPolicies(group.pawns.First().drugs.CurrentPolicy); Find.WindowStack.Add(window); } UIHighlighter.HighlightOpportunity(rect2, "ButtonAssignDrugs"); UIHighlighter.HighlightOpportunity(rect3, "ButtonAssignDrugs"); x += (float)num2; }
public void AlertsReadoutOnGUI() { if (Event.current.type == EventType.Layout) { return; } if (this.activeAlerts.Count == 0) { return; } Alert alert = null; AlertPriority alertPriority = AlertPriority.Critical; bool flag = false; float num = Find.LetterStack.LastTopY - (float)this.activeAlerts.Count * 28f; Rect rect = new Rect((float)UI.screenWidth - 154f, num, 154f, this.lastFinalY - num); float num2 = GenUI.BackgroundDarkAlphaForText(); if (num2 > 0.001f) { GUI.color = new Color(1f, 1f, 1f, num2); Widgets.DrawShadowAround(rect); GUI.color = Color.white; } float num3 = num; if (num3 < 0f) { num3 = 0f; } for (int i = 0; i < this.PriosInDrawOrder.Count; i++) { AlertPriority alertPriority2 = this.PriosInDrawOrder[i]; for (int j = 0; j < this.activeAlerts.Count; j++) { Alert alert2 = this.activeAlerts[j]; if (alert2.Priority == alertPriority2) { if (!flag) { alertPriority = alertPriority2; flag = true; } Rect rect2 = alert2.DrawAt(num3, alertPriority2 != alertPriority); if (Mouse.IsOver(rect2)) { alert = alert2; this.mouseoverAlertIndex = j; } num3 += rect2.height; } } } this.lastFinalY = num3; UIHighlighter.HighlightOpportunity(rect, "Alerts"); if (alert != null) { alert.DrawInfoPane(); PlayerKnowledgeDatabase.KnowledgeDemonstrated(ConceptDefOf.Alerts, KnowledgeAmount.FrameDisplayed); } }
private void DoManualPrioritiesCheckbox() { Text.Font = GameFont.Small; GUI.color = Color.white; Text.Anchor = TextAnchor.UpperLeft; Rect rect = new Rect(5f, 5f, 140f, 30f); bool useWorkPriorities = Current.Game.playSettings.useWorkPriorities; Widgets.CheckboxLabeled(rect, "ManualPriorities".Translate(), ref Current.Game.playSettings.useWorkPriorities); if (useWorkPriorities != Current.Game.playSettings.useWorkPriorities) { foreach (Pawn item in PawnsFinder.AllMapsWorldAndTemporary_Alive) { if (item.Faction == Faction.OfPlayer && item.workSettings != null) { item.workSettings.Notify_UseWorkPrioritiesChanged(); } } } if (Current.Game.playSettings.useWorkPriorities) { GUI.color = new Color(1f, 1f, 1f, 0.5f); Text.Font = GameFont.Tiny; Widgets.Label(new Rect(rect.x, rect.y + rect.height + 4f, rect.width, 60f), "PriorityOneDoneFirst".Translate()); Text.Font = GameFont.Small; GUI.color = Color.white; } if (!Current.Game.playSettings.useWorkPriorities) { UIHighlighter.HighlightOpportunity(rect, "ManualPriorities-Off"); } }
// Resizes the tabs if more than 6 visible public static bool DoTabs_Prefix(IInspectPane pane) { try { int count = pane.CurTabs.Count(x => x.IsVisible); if (count > 6) { tabWidth = PaneWidth / count; } else { tabWidth = 72f; } float y = pane.PaneTopY - TabHeight; float num = PaneWidth - tabWidth; float width = 0f; bool flag = false; foreach (InspectTabBase current in pane.CurTabs) { if (current.IsVisible) { Rect rect = new Rect(num, y, tabWidth, TabHeight); width = num; Text.Font = GameFont.Small; if (Widgets.ButtonText(rect, current.labelKey.Translate())) { InterfaceToggleTab(current, pane); } bool flag2 = current.GetType() == pane.OpenTabType; if (!flag2 && !current.TutorHighlightTagClosed.NullOrEmpty()) { UIHighlighter.HighlightOpportunity(rect, current.TutorHighlightTagClosed); } if (flag2) { current.DoTabGUI(); pane.RecentHeight = 700f; flag = true; } num -= tabWidth; } } if (flag) { GUI.DrawTexture(new Rect(0f, y, width, TabHeight), InspectTabButtonFillTex); } } catch (Exception ex) { Log.ErrorOnce(ex.ToString(), 742783); } return(false); }
public override void DoWindowContents(Rect inRect) { base.DoWindowContents(inRect); Text.Font = GameFont.Small; float num = (float)(inRect.width / 2.0); float num2 = 0f; float num3 = 0f; for (int i = 0; i < this.desPanelsCached.Count; i++) { Rect rect = new Rect(num2 * num, (float)(num3 * 32.0), num, 32f); rect.height += 1f; if (num2 == 0.0) { rect.width += 1f; } if (Widgets.ButtonTextSubtle(rect, this.desPanelsCached[i].def.LabelCap, 0f, 8f, SoundDefOf.MouseoverCategory, new Vector2(-1f, -1f))) { this.ClickedCategory(this.desPanelsCached[i]); } if (this.selectedDesPanel != this.desPanelsCached[i]) { UIHighlighter.HighlightOpportunity(rect, this.desPanelsCached[i].def.cachedHighlightClosedTag); } num2 = (float)(num2 + 1.0); if (num2 > 1.0) { num2 = 0f; num3 = (float)(num3 + 1.0); } } }
public bool DoGUI_Label(Rect rect) { bool commandIsTriggered = false; KeyCode keyCode = (gizmo.hotKey != null) ? gizmo.hotKey.MainKey : KeyCode.None; if (keyCode != KeyCode.None && !GizmoGridDrawer.drawnHotKeys.Contains(keyCode)) { Rect rect2 = new Rect(rect.x + 5f, rect.y + 5f, rect.width - 10f, 18f); Widgets.Label(rect2, keyCode.ToStringReadable()); GizmoGridDrawer.drawnHotKeys.Add(keyCode); if (gizmo.hotKey.KeyDownEvent) { commandIsTriggered = true; Event.current.Use(); } } if (Widgets.ButtonInvisible(rect, false)) { commandIsTriggered = true; } string labelCap = gizmo.LabelCap; if (!labelCap.NullOrEmpty()) { float num = Text.CalcHeight(labelCap, rect.width); Rect rect3 = new Rect(rect.x, rect.yMax - num + 12f, rect.width, num); GUI.DrawTexture(rect3, TexUI.GrayTextBG); GUI.color = Color.white; Text.Anchor = TextAnchor.UpperCenter; Widgets.Label(rect3, labelCap); Text.Anchor = TextAnchor.UpperLeft; } GUI.color = Color.white; if ((bool)Designator_Build_DoToolTip_PropertyInfo.GetValue(gizmo, null)) { TipSignal tip = gizmo.Desc; if (gizmo.disabled && !gizmo.disabledReason.NullOrEmpty()) { string text = tip.text; tip.text = string.Concat(new string[] { text, "\n\n", "DisabledCommand".Translate(), ": ", gizmo.disabledReason }); } TooltipHandler.TipRegion(rect, tip); } if (!gizmo.HighlightTag.NullOrEmpty() && (Find.WindowStack.FloatMenu == null || !Find.WindowStack.FloatMenu.windowRect.Overlaps(rect))) { UIHighlighter.HighlightOpportunity(rect, gizmo.HighlightTag); } return(commandIsTriggered); }
private static Bill DoListing(BillStack __instance, Rect rect, Func <Dictionary <string, List <FloatMenuOption> > > labeledSortingActions, ref Vector2 scrollPosition, ref float viewHeight) { Bill result = null; GUI.BeginGroup(rect); Text.Font = GameFont.Small; if (__instance.Count < 15) { var rect2 = new Rect(0f, 0f, 150f, 29f); if (Widgets.ButtonText(rect2, "AddBill".Translate())) { // Outfitter Code var items = labeledSortingActions.Invoke().Keys.Select( label => { var fmo = labeledSortingActions.Invoke()[label]; return(Tools.MakeMenuItemForLabel(label, fmo)); }).ToList(); Tools.LabelMenu = new FloatMenuLabels(items); Find.WindowStack.Add(Tools.LabelMenu); } UIHighlighter.HighlightOpportunity(rect2, "AddBill"); } Text.Anchor = TextAnchor.UpperLeft; GUI.color = Color.white; var outRect = new Rect(0f, 35f, rect.width, (float)(rect.height - 35.0)); var viewRect = new Rect(0f, 0f, (float)(outRect.width - 16.0), viewHeight); Widgets.BeginScrollView(outRect, ref scrollPosition, viewRect); var num = 0f; for (var i = 0; i < __instance.Count; i++) { var bill = __instance.Bills[i]; var rect3 = bill.DoInterface(0f, num, viewRect.width, i); if (!bill.DeletedOrDereferenced && Mouse.IsOver(rect3)) { result = bill; } num = (float)(num + (rect3.height + 6.0)); } if (Event.current.type == EventType.Layout) { viewHeight = (float)(num + 60.0); } Widgets.EndScrollView(); GUI.EndGroup(); DoBwmPostfix?.Invoke(ref rect); return(result); }
protected override void FillTab() { IStoreSettingsParent storeSettingsParent = this.SelStoreSettingsParent; StorageSettings settings = storeSettingsParent.GetStoreSettings(); Rect position = new Rect(0f, 0f, ITab_Storage.WinSize.x, ITab_Storage.WinSize.y).ContractedBy(10f); GUI.BeginGroup(position); if (this.IsPrioritySettingVisible) { Text.Font = GameFont.Small; Rect rect = new Rect(0f, 0f, 160f, this.TopAreaHeight - 6f); if (Widgets.ButtonText(rect, "Priority".Translate() + ": " + settings.Priority.Label().CapitalizeFirst(), true, false, true)) { List <FloatMenuOption> list = new List <FloatMenuOption>(); foreach (StoragePriority storagePriority in Enum.GetValues(typeof(StoragePriority))) { if (storagePriority != StoragePriority.Unstored) { StoragePriority localPr = storagePriority; list.Add(new FloatMenuOption(localPr.Label().CapitalizeFirst(), delegate { settings.Priority = localPr; }, MenuOptionPriority.Default, null, null, 0f, null, null)); } } Find.WindowStack.Add(new FloatMenu(list)); } UIHighlighter.HighlightOpportunity(rect, "StoragePriority"); } ThingFilter parentFilter = null; if (storeSettingsParent.GetParentStoreSettings() != null) { parentFilter = storeSettingsParent.GetParentStoreSettings().filter; } Rect rect2 = new Rect(0f, this.TopAreaHeight, position.width, position.height - this.TopAreaHeight); Bill[] first = (from b in BillUtility.GlobalBills() where b is Bill_Production && b.GetStoreZone() == storeSettingsParent && b.recipe.WorkerCounter.CanPossiblyStoreInStockpile((Bill_Production)b, b.GetStoreZone()) select b).ToArray <Bill>(); ThingFilterUI.DoThingFilterConfigWindow(rect2, ref this.scrollPosition, settings.filter, parentFilter, 8, null, null, null, null); Bill[] second = (from b in BillUtility.GlobalBills() where b is Bill_Production && b.GetStoreZone() == storeSettingsParent && b.recipe.WorkerCounter.CanPossiblyStoreInStockpile((Bill_Production)b, b.GetStoreZone()) select b).ToArray <Bill>(); IEnumerable <Bill> enumerable = first.Except(second); foreach (Bill current in enumerable) { Messages.Message("MessageBillValidationStoreZoneInsufficient".Translate(new object[] { current.LabelCap, current.billStack.billGiver.LabelShort.CapitalizeFirst(), current.GetStoreZone().label }), current.billStack.billGiver as Thing, MessageTypeDefOf.RejectInput, false); } PlayerKnowledgeDatabase.KnowledgeDemonstrated(ConceptDefOf.StorageTab, KnowledgeAmount.FrameDisplayed); GUI.EndGroup(); }
public override void DoCell(Rect rect, Pawn pawn, PawnTable table) { if (Widgets.ButtonText(rect, "AddBill".Translate(), true, false, true)) { Find.WindowStack.Add(new FloatMenu(RecipeOptionsMaker(pawn))); } UIHighlighter.HighlightOpportunity(rect, "AddBill"); }
private static bool CustomInfoCardButtonWorker(Rect rect) { MouseoverSounds.DoRegion(rect); TooltipHandler.TipRegionByKey(rect, "DefInfoTip"); bool result = Widgets.ButtonImage(rect, Textures.InfoButtonNarrow, GUI.color, true); UIHighlighter.HighlightOpportunity(rect, "InfoCard"); return(result); }
protected override void FillTab() { IStoreSettingsParent selStoreSettingsParent = this.SelStoreSettingsParent; StorageSettings settings = selStoreSettingsParent.GetStoreSettings(); Vector2 winSize = ITab_Storage.WinSize; float x = winSize.x; Vector2 winSize2 = ITab_Storage.WinSize; Rect position = new Rect(0f, 0f, x, winSize2.y).ContractedBy(10f); GUI.BeginGroup(position); if (this.IsPrioritySettingVisible) { Text.Font = GameFont.Small; Rect rect = new Rect(0f, 0f, 160f, (float)(this.TopAreaHeight - 6.0)); if (Widgets.ButtonText(rect, "Priority".Translate() + ": " + settings.Priority.Label(), true, false, true)) { List <FloatMenuOption> list = new List <FloatMenuOption>(); IEnumerator enumerator = Enum.GetValues(typeof(StoragePriority)).GetEnumerator(); try { while (enumerator.MoveNext()) { StoragePriority storagePriority = (StoragePriority)enumerator.Current; if (storagePriority != 0) { StoragePriority localPr = storagePriority; list.Add(new FloatMenuOption(localPr.Label().CapitalizeFirst(), delegate { settings.Priority = localPr; }, MenuOptionPriority.Default, null, null, 0f, null, null)); } } } finally { IDisposable disposable; if ((disposable = (enumerator as IDisposable)) != null) { disposable.Dispose(); } } Find.WindowStack.Add(new FloatMenu(list)); } UIHighlighter.HighlightOpportunity(rect, "StoragePriority"); } ThingFilter parentFilter = null; if (selStoreSettingsParent.GetParentStoreSettings() != null) { parentFilter = selStoreSettingsParent.GetParentStoreSettings().filter; } Rect rect2 = new Rect(0f, this.TopAreaHeight, position.width, position.height - this.TopAreaHeight); ThingFilterUI.DoThingFilterConfigWindow(rect2, ref this.scrollPosition, settings.filter, parentFilter, 8, (IEnumerable <ThingDef>)null, (IEnumerable <SpecialThingFilterDef>)null, (List <ThingDef>)null); PlayerKnowledgeDatabase.KnowledgeDemonstrated(ConceptDefOf.StorageTab, KnowledgeAmount.FrameDisplayed); GUI.EndGroup(); }
//private static void DoTabs(IInspectPane pane) private static void Postfix(IInspectPane pane) { float TAB_WIDTH = TABLIST_WIDTH / Math.Max(pane.CurTabs.Count(arg => arg.IsVisible), 6); try { float y = pane.PaneTopY - 30f; float num = TABLIST_WIDTH - TAB_WIDTH; // mod float width = 0f; bool flag = false; foreach (InspectTabBase current in pane.CurTabs) { if (current.IsVisible) { Rect rect = new Rect(num, y, TAB_WIDTH, 30f); width = num; var labelsize = Text.CalcSize(current.labelKey.Translate()); if (labelsize.x > TAB_WIDTH) { Text.Font = GameFont.Tiny; } else { Text.Font = GameFont.Small; } if (Widgets.ButtonText(rect, current.labelKey.Translate(), true, false, true)) { InspectPaneUtility.DoTabs.InterfaceToggleTab(current, pane); } bool flag2 = current.GetType() == pane.OpenTabType; if (!flag2 && !current.TutorHighlightTagClosed.NullOrEmpty()) { UIHighlighter.HighlightOpportunity(rect, current.TutorHighlightTagClosed); } if (flag2) { current.DoTabGUI(); pane.RecentHeight = 700f; flag = true; } num -= TAB_WIDTH; } } if (flag) { GUI.DrawTexture(new Rect(0f, y, width, 30f), InspectPaneUtility.DoTabs.InspectTabButtonFillTex); } } catch (Exception ex) { Verse.Log.ErrorOnce(ex.ToString(), 742783); } }
public override void DrawOnGUI(Rect rect, int maxThresholdMarkers = 2147483647, float customMargin = -1f, bool drawArrows = true, bool doTooltip = true) { if (rect.height > 70f) { float num = (rect.height - 70f) / 2f; rect.height = 70f; rect.y += num; } if (Mouse.IsOver(rect)) { Widgets.DrawHighlight(rect); } if (doTooltip) { TooltipHandler.TipRegion(rect, new TipSignal(() => this.GetTipString(), rect.GetHashCode())); } float num2 = 14f; float num3 = (customMargin < 0f) ? (num2 + 15f) : customMargin; if (rect.height < 50f) { num2 *= Mathf.InverseLerp(0f, 50f, rect.height); } Text.Font = ((rect.height <= 55f) ? GameFont.Tiny : GameFont.Small); Text.Anchor = TextAnchor.LowerLeft; Rect rect2 = new Rect(rect.x + num3 + rect.width * 0.1f, rect.y, rect.width - num3 - rect.width * 0.1f, rect.height / 2f); Widgets.Label(rect2, this.LabelCap); Text.Anchor = TextAnchor.UpperLeft; Rect rect3 = new Rect(rect.x, rect.y + rect.height / 2f, rect.width, rect.height / 2f); rect3 = new Rect(rect3.x + num3, rect3.y, rect3.width - num3 * 2f, rect3.height - num2); Widgets.FillableBar(rect3, this.CurLevelPercentage, ModTextures.GreenTex); if (drawArrows) { Widgets.FillableBarChangeArrows(rect3, this.GUIChangeArrow); } if (this.threshPercents != null) { for (int i = 0; i < Mathf.Min(this.threshPercents.Count, maxThresholdMarkers); i++) { this.DrawBarThreshold(rect3, this.threshPercents[i]); } } float curInstantLevelPercentage = this.CurInstantLevelPercentage; if (curInstantLevelPercentage >= 0f) { this.DrawBarInstantMarkerAt(rect3, curInstantLevelPercentage); } if (!this.def.tutorHighlightTag.NullOrEmpty()) { UIHighlighter.HighlightOpportunity(rect, this.def.tutorHighlightTag); } Text.Font = GameFont.Small; }
private static bool InfoCardButtonWorker(float x, float y) { Rect rect = new Rect(x, y, 24f, 24f); TooltipHandler.TipRegion(rect, "DefInfoTip".Translate()); bool result = Widgets.ButtonImage(rect, StaticConstructorOnGameStart.Info, GUI.color); UIHighlighter.HighlightOpportunity(rect, "InfoCard"); return(result); }
private static bool InfoCardButtonWorker(float x, float y) { Rect rect = new Rect(x, y, 24f, 24f); TooltipHandler.TipRegion(rect, "ToolTipHere"); bool result = Widgets.ButtonImage(rect, infoTex, GUI.color); UIHighlighter.HighlightOpportunity(rect, "InfoCard"); return(result); }
public void HighlightAllTags() { if (this.highlightTags != null) { for (int i = 0; i < this.highlightTags.Count; i++) { UIHighlighter.HighlightTag(this.highlightTags[i]); } } }
static bool InfoCardButtonWorker(float x, float y) { Rect rect = new Rect(x, y, 24f, 24f); TooltipHandler.TipRegion(rect, (TipSignal)"DefInfoTip".Translate()); bool flag = Widgets.ButtonImage(rect, GraphicsCache.Info, GUI.color); UIHighlighter.HighlightOpportunity(rect, "InfoCard"); return(flag); }
public override string GetExplanation() { UIHighlighter.HighlightTag("MainTab-StoryTab-Closed"); foreach (ModContentPackWrapper MCPW in StoryManager.StoryHandler.ModFolder) { if (MCPW.HasUnseenMissions) { UIHighlighter.HighlightTag(MCPW.identifier + "-StoryHighlight"); } } return(base.GetExplanation()); }
public override void LessonOnGUI() { foreach (Thing t in this.ThingsToSelect()) { TutorUtility.DrawLabelOnThingOnGUI(t, this.def.onMapInstruction); } if (this.RelevantBill() == null) { UIHighlighter.HighlightTag("AddBill"); } base.LessonOnGUI(); }
public static bool ButtonTextLine(this Listing_Standard L, string label, string highlightTag = null) { Rect rect = L.GetRect(Text.LineHeight); bool result = Widgets.ButtonText(rect, label, true, true, true); if (highlightTag != null) { UIHighlighter.HighlightOpportunity(rect, highlightTag); } L.Gap(L.verticalSpacing); return(result); }
public bool ButtonTextLine(string label, string highlightTag = null, bool extend = false) { Rect rect = this.GetRect(Text.LineHeight, null, extend); bool result = Widgets.ButtonText(rect, label, true, true, true); if (highlightTag != null) { UIHighlighter.HighlightOpportunity(rect, highlightTag); } this.Gap(this.verticalSpacing); return(result); }
public override void DoHeader(Rect rect, PawnTable table) { base.DoHeader(rect, table); Rect rect2 = new Rect(rect.x, rect.y + (rect.height - 65f), Mathf.Min(rect.width, 360f), 32f); if (Widgets.ButtonText(rect2, "ManageOutfits".Translate(), true, false, true)) { Find.WindowStack.Add(new Dialog_ManageOutfits(null)); PlayerKnowledgeDatabase.KnowledgeDemonstrated(ConceptDefOf.Outfits, KnowledgeAmount.Total); } UIHighlighter.HighlightOpportunity(rect2, "ManageOutfits"); }