public override void Draw(Rect rect) { var hGrid = rect.GetHGrid(GUIPlus.LargePadding, -1f, -1f); var l = new ListingPlus(); l.Begin(hGrid[1]); l.Label(Lang.Get("Dialog_Config.Tab.Content.Layout").Bold()); if (l.ButtonText(Lang.Get("Dialog_Config.Tab.Content.Layout.Preset"))) { var presets = new List <FloatMenuOption> { new FloatMenuOption(Lang.Get("Dialog_Config.Tab.Content.Layout.Preset.Default"), LoadDefaultPreset), new FloatMenuOption("Dubs Bad Hygiene", () => TryLoadPreset(LayoutPresets.DubsBadHygiene, "DBH")), new FloatMenuOption("A RimWorld of Magic", () => TryLoadPreset(LayoutPresets.RimWorldOfMagic, "RoM")) }; Find.WindowStack.Add(new FloatMenu(presets)); } l.GapLine(); l.Gap(); l.Label(Lang.Get("Alert.MoreComingSoon").Italic()); l.Gap(); l.Gap(); var wrap = Text.WordWrap; Text.WordWrap = true; l.Label("A GUI for editing the layout and content is being developed but in the meanwhile advanced users can edit the layout in Docked/Floating.xml files found in the config folder.\n\nFor custom needs use <Need DefName=\"someNeed\">\nFor custom skills use <Skill DefName=\"someSkill\">"); Text.WordWrap = wrap; l.End(); }
public override void Draw(Rect rect) { var vGrid = rect.GetVGrid(GUIPlus.LargePadding, 40f, -1f, 10f); var l = new ListingPlus(); l.Begin(vGrid[1]); l.Label("This mod was brought to you by:".Bold()); l.GapLine(); l.End(); l.BeginScrollView(vGrid[2], ref _scrollPosition, ref _viewRect); l.Label(Persistent.GetCredits()); l.Gap(); l.Label("A special thanks to everyone above and countless others who have helped along the way."); l.Label(("❤️".Color("FF0011") + " Jaxe".Italic()).Bold()); l.Gap(); l.EndScrollView(ref _viewRect); }
public override void Draw(Rect rect) { var hGrid = rect.GetHGrid(GUIPlus.LargePadding, -1f, -1f); var l = new ListingPlus(); l.Begin(hGrid[1]); l.RangeSlider(Theme.RefreshRate); l.GapLine(); l.Gap(); l.Label(Lang.Get("Theme.HudPosition").Bold()); l.BoolToggle(Theme.HudDocked); l.RangeSlider(Theme.HudAnchor, !Theme.HudDocked.Value); l.RangeSliderEntry(Theme.HudOffsetX, ref _hudOffsetXText, 1, !Theme.HudDocked.Value); l.RangeSliderEntry(Theme.HudOffsetY, ref _hudOffsetYText, 2, !Theme.HudDocked.Value); l.GapLine(); l.Gap(); l.Label(Lang.Get("Theme.HudDimensions").Bold()); l.RangeSliderEntry(Theme.HudWidth, ref _hudWidthText, 3, !Theme.HudDocked.Value); l.RangeSliderEntry(Theme.HudHeight, ref _hudHeightText, 4, !Theme.HudDocked.Value); l.GapLine(); l.Gap(); l.Label(Lang.Get("Theme.InspectPane").Bold()); l.BoolToggle(Theme.InspectPaneTabModify); l.BoolToggle(Theme.InspectPaneTabAddLog, Theme.InspectPaneTabModify.Value && !Theme.HudDocked.Value); l.RangeSliderEntry(Theme.InspectPaneHeight, ref _inspectPaneHeightText, 5, Theme.InspectPaneTabModify.Value); l.RangeSlider(Theme.InspectPaneTabWidth, Theme.InspectPaneTabModify.Value); l.RangeSlider(Theme.InspectPaneMinTabs, Theme.InspectPaneTabModify.Value); l.End(); l.Begin(hGrid[2]); l.TextStyleEditor(Theme.RegularTextStyle); l.RangeSlider(Theme.LabelWidth); l.RangeSlider(Theme.ValueWidth); l.GapLine(); l.Gap(); l.TextStyleEditor(Theme.LargeTextStyle, !Theme.HudDocked.Value); l.GapLine(); l.Gap(); l.TextStyleEditor(Theme.SmallTextStyle); l.GapLine(); l.Gap(); l.Label(Lang.Get("Theme.OtherOptions").Bold()); l.BoolToggle(Theme.ShowDecimals); l.BoolToggle(Theme.LetterCompress); l.RangeSlider(Theme.LetterPadding, Theme.LetterCompress.Value); l.End(); }
protected override void DrawContent(Rect rect) { var l = new ListingPlus(); l.Begin(rect); _includeDocked = l.CheckboxLabeled(Lang.Get("Dialog_SavePreset.IncludeDocked"), _includeDocked, enabled: !_includeDocked || _includeFloating); _includeFloating = l.CheckboxLabeled(Lang.Get("Dialog_SavePreset.IncludeFloating"), _includeFloating, enabled: !_includeFloating || _includeDocked); l.GapLine(); _includeHeight = l.CheckboxLabeled(Lang.Get("Dialog_SavePreset.IncludeHeight"), _includeHeight); _includeWidth = l.CheckboxLabeled(Lang.Get("Dialog_SavePreset.IncludeWidth"), _includeWidth); _includeTabs = l.CheckboxLabeled(Lang.Get("Dialog_SavePreset.IncludeTabs"), _includeTabs, enabled: _includeDocked); l.GapLine(); l.Label(Lang.Get("Dialog_SavePreset.Name")); GUI.SetNextControlName(NameControl); _name = l.TextEntry(_name); GUI.FocusControl(NameControl); l.Gap(); var buttonGrid = l.GetButtonGrid(-1f, -1f); if (GUIPlus.DrawButton(buttonGrid[1], Lang.Get("Button.Save"), enabled: Persistent.IsValidFilename(_name))) { Save(); } if (GUIPlus.DrawButton(buttonGrid[2], Lang.Get("Button.Cancel"))) { Close(); } l.End(); }
private Rect DrawTitle(Rect rect) { if (Title.NullOrEmpty()) { return(rect); } var header = new ListingPlus(); header.Begin(rect); header.Label(Title, font: GameFont.Medium); if (!string.IsNullOrEmpty(Subtitle)) { var titleSize = GUIPlus.GetTextSize(Title, GUIPlus.GetGameFontStyle(GameFont.Medium)); var titleOffset = titleSize.x + GUIPlus.MediumPadding; var subtitleRect = new Rect(rect.x + titleOffset, rect.y, rect.width - titleOffset, titleSize.y); GUIPlus.DrawText(subtitleRect, Subtitle, style: Theme.SmallTextStyle); } header.GapLine(); header.End(); var contentRect = new Rect(rect.x, rect.y + header.CurHeight, rect.width, rect.height - header.CurHeight); if (doCloseButton) { contentRect.height -= CloseButtonOffset; } return(contentRect); }
public override void Draw(Rect rect) { var hGrid = rect.GetHGrid(GUIPlus.LargePadding, -1f, -1f); var bubbles = new ListingPlus(); bubbles.Begin(hGrid[1]); var hasBubbles = Mod_Bubbles.Instance.IsActive; bubbles.Label(Lang.Get("Integration.Bubbles").Bold(), Mod_Bubbles.Description); if (!hasBubbles) { bubbles.LinkLabel(Lang.Get("Integration.GetMod"), Mod_Bubbles.Url, Mod_Bubbles.Url); } var bubblesActive = hasBubbles && Mod_Bubbles.Activated.Value; bubbles.BoolToggle(Mod_Bubbles.Activated, hasBubbles); bubbles.BoolToggle(Mod_Bubbles.DoNonPlayer, bubblesActive); bubbles.BoolToggle(Mod_Bubbles.DoAnimals, bubblesActive); bubbles.GapLine(5f); bubbles.RangeSlider(Mod_Bubbles.ScaleStart, bubblesActive); bubbles.RangeSlider(Mod_Bubbles.MinScale, bubblesActive); bubbles.RangeSlider(Mod_Bubbles.MaxWidth, bubblesActive); bubbles.RangeSlider(Mod_Bubbles.Spacing, bubblesActive); bubbles.RangeSlider(Mod_Bubbles.StartOffset, bubblesActive); bubbles.RangeSlider(Mod_Bubbles.OffsetDirection, bubblesActive); bubbles.GapLine(5f); bubbles.RangeSlider(Mod_Bubbles.StartOpacity, bubblesActive); bubbles.RangeSlider(Mod_Bubbles.MouseOverOpacity, bubblesActive); bubbles.RangeSlider(Mod_Bubbles.MinTime, bubblesActive); bubbles.RangeSlider(Mod_Bubbles.FadeStart, bubblesActive); bubbles.RangeSlider(Mod_Bubbles.FadeLength, bubblesActive); bubbles.RangeSlider(Mod_Bubbles.MaxPerPawn, bubblesActive); bubbles.GapLine(5f); bubbles.RangeSlider(Mod_Bubbles.FontSize, bubblesActive); bubbles.RangeSlider(Mod_Bubbles.PaddingX, bubblesActive); bubbles.RangeSlider(Mod_Bubbles.PaddingY, bubblesActive); bubbles.End(); var pawnRules = new ListingPlus(); pawnRules.Begin(hGrid[2]); pawnRules.Label(Lang.Get("Integration.PawnRules").Bold(), Mod_PawnRules.Description); var hasPawnRules = Mod_PawnRules.Instance.IsActive; if (!hasPawnRules) { pawnRules.LinkLabel(Lang.Get("Integration.GetMod"), Mod_PawnRules.Url, Mod_PawnRules.Url); } pawnRules.BoolToggle(Mod_PawnRules.ReplaceFoodSelector, hasPawnRules); pawnRules.BoolToggle(Mod_PawnRules.HideGizmo, hasPawnRules); pawnRules.End(); }
public override void DoWindowContents(Rect inRect) { var listing = new ListingPlus(); listing.Begin(inRect); listing.Label("RimHUD has automatically deactivated due to the following error(s):".Bold()); listing.Label(_info.Message); if (_info.IsExternalError) { listing.Label(_info.PossibleMod == null ? "The error appears to be from outside RimHUD." : $"The error appears to be have been caused by the mod '{_info.PossibleMod.Bold()}'.", color: Color.yellow); } listing.Gap(); listing.Label("Stacktrace:".Bold(), font: GameFont.Tiny); listing.End(); var grid = inRect.GetVGrid(0f, listing.CurHeight, -1f, GUIPlus.SmallButtonHeight + GUIPlus.MediumPadding); Widgets.DrawMenuSection(grid[2]); var stacktraceRect = grid[2].ContractedBy(GUIPlus.SmallPadding); var stacktraceList = new ListingPlus(); stacktraceList.BeginScrollView(stacktraceRect, ref _scrollPosition, ref _scrollView); stacktraceList.Label(_info.StackTrace, font: GameFont.Tiny); stacktraceList.EndScrollView(ref _scrollView); grid[3].yMin += GUIPlus.MediumPadding; var buttonGrid = grid[3].GetHGrid(GUIPlus.MediumPadding, ButtonWidth, -1f, ButtonWidth, ButtonWidth); if (GUIPlus.DrawButton(buttonGrid[1], "Copy to clipboard", font: GameFont.Tiny)) { GUIUtility.systemCopyBuffer = $"[[RimHUD Auto-deactivation report]]\n{_info.Text}"; Mod.Message("RimHUD Auto-deactivation details copied to clipboard"); } if (GUIPlus.DrawButton(buttonGrid[3], "Reactivate", font: GameFont.Tiny)) { Close(); State.Activated = true; } if (GUIPlus.DrawButton(buttonGrid[4], "Close", font: GameFont.Tiny)) { Close(); } }
public override void Draw(Rect rect) { var hGrid = rect.GetHGrid(GUIPlus.LargePadding, -1f, -1f); var l = new ListingPlus(); l.Begin(hGrid[1]); var hasBubbles = Bubbles.Instance.IsActive; l.Label(Lang.Get("Integration.Bubbles").Bold(), Bubbles.Description); if (!hasBubbles) { l.LinkLabel(Lang.Get("Integration.GetMod"), Bubbles.Url, Bubbles.Url); } var bubblesActive = hasBubbles && Bubbles.Activated.Value; l.BoolToggle(Bubbles.Activated, hasBubbles); l.BoolToggle(Bubbles.DoNonPlayer, bubblesActive); l.BoolToggle(Bubbles.DoAnimals, bubblesActive); l.GapLine(); l.RangeSlider(Bubbles.ScaleStart, bubblesActive); l.RangeSlider(Bubbles.MinScale, bubblesActive); l.RangeSlider(Bubbles.MaxWidth, bubblesActive); l.RangeSlider(Bubbles.Spacing, bubblesActive); l.RangeSlider(Bubbles.StartOffset, bubblesActive); l.RangeSlider(Bubbles.OffsetDirection, bubblesActive); l.GapLine(); l.RangeSlider(Bubbles.StartOpacity, bubblesActive); l.RangeSlider(Bubbles.MouseOverOpacity, bubblesActive); l.RangeSlider(Bubbles.MinTime, bubblesActive); l.RangeSlider(Bubbles.FadeStart, bubblesActive); l.RangeSlider(Bubbles.FadeLength, bubblesActive); l.RangeSlider(Bubbles.MaxPerPawn, bubblesActive); l.GapLine(); l.RangeSlider(Bubbles.FontSize, bubblesActive); l.RangeSlider(Bubbles.PaddingX, bubblesActive); l.RangeSlider(Bubbles.PaddingY, bubblesActive); l.GapLine(); l.End(); }
private Rect DrawTitle(Rect rect) { if (Title.NullOrEmpty()) { return(rect); } var header = new ListingPlus(); header.Begin(rect); header.Label(Title, font: GameFont.Medium); header.GapLine(); header.End(); var contentRect = new Rect(rect.x, rect.y + header.CurHeight, rect.width, rect.height - header.CurHeight); if (doCloseButton) { contentRect.height -= CloseButtonOffset; } return(contentRect); }
public override void Draw(Rect rect) { var hGrid = rect.GetHGrid(GUIPlus.LargePadding, -1f, -1f); var l = new ListingPlus(); var selected = _selected; l.BeginScrollView(hGrid[1], ref _scrollPosition, ref _viewRect); l.Label(Lang.Get("Theme.HudColors").Bold()); l.GapLine(); l.ColorOptionSelect(Theme.MainTextColor, ref _selected); l.ColorOptionSelect(Theme.DisabledColor, ref _selected); l.ColorOptionSelect(Theme.CriticalColor, ref _selected); l.ColorOptionSelect(Theme.WarningColor, ref _selected); l.ColorOptionSelect(Theme.InfoColor, ref _selected); l.ColorOptionSelect(Theme.GoodColor, ref _selected); l.ColorOptionSelect(Theme.ExcellentColor, ref _selected); l.ColorOptionSelect(Theme.BarBackgroundColor, ref _selected); l.ColorOptionSelect(Theme.BarMainColor, ref _selected); l.ColorOptionSelect(Theme.BarLowColor, ref _selected); l.ColorOptionSelect(Theme.BarThresholdColor, ref _selected); l.ColorOptionSelect(Theme.SelectorTextColor, ref _selected); l.ColorOptionSelect(Theme.SelectorBackgroundColor, ref _selected); l.ColorOptionSelect(Theme.LineColor, ref _selected); l.Gap(); l.Label(Lang.Get("Theme.FactionColors").Bold()); l.GapLine(); l.ColorOptionSelect(Theme.FactionOwnColor, ref _selected); l.ColorOptionSelect(Theme.FactionAlliedColor, ref _selected); l.ColorOptionSelect(Theme.FactionIndependentColor, ref _selected); l.ColorOptionSelect(Theme.FactionHostileColor, ref _selected); l.ColorOptionSelect(Theme.FactionWildColor, ref _selected); l.Gap(); l.Label(Lang.Get("Theme.SkillColors").Bold()); l.GapLine(); l.ColorOptionSelect(Theme.SkillMinorPassionColor, ref _selected); l.ColorOptionSelect(Theme.SkillMajorPassionColor, ref _selected); l.Gap(); var hasBubbles = Mod_Bubbles.Instance.IsActive; l.Label(Lang.Get("Integration.Bubbles.Colors").Bold()); l.GapLine(); l.ColorOptionSelect(Mod_Bubbles.ForeColor, ref _selected, hasBubbles); l.ColorOptionSelect(Mod_Bubbles.BackColor, ref _selected, hasBubbles); l.ColorOptionSelect(Mod_Bubbles.SelectedForeColor, ref _selected, hasBubbles); l.ColorOptionSelect(Mod_Bubbles.SelectedBackColor, ref _selected, hasBubbles); l.EndScrollView(ref _viewRect); l.Begin(hGrid[2]); if (_selected != null) { if (_selected != selected) { ParseColor(); } l.Label(Lang.Get("Dialog_Config.Tab.Colors.Editor", _selected.Label).Bold()); l.GapLine(); l.RangeSliderEntry(_hue, ref _hueText, 1); l.RangeSliderEntry(_saturation, ref _saturationText, 2); l.RangeSliderEntry(_lightness, ref _lightnessText, 3); l.RangeSliderEntry(_alpha, ref _alphaText, 4); l.GapLine(); var newColor = Color.HSVToRGB(_hue.Value.ToPercentageFloat(), _saturation.Value.ToPercentageFloat(), _lightness.Value.ToPercentageFloat()); newColor.a = _alpha.Value.ToPercentageFloat(); _selected.Value = newColor; var sampleRect = l.GetRect(30f); Widgets.DrawBoxSolid(sampleRect, _selected.Value); } l.End(); }
public override void Draw(Rect rect) { var l = new ListingPlus(); var hGrid = rect.GetHGrid(GUIPlus.LargePadding, -1f, EditorWidth); l.Begin(hGrid[1]); l.Label(Lang.Get("Dialog_Config.Tab.Content.Editor", GetMode()).Bold()); var editorRect = l.GetRemaining(); _editor.Draw(editorRect); l.End(); l.Begin(hGrid[2]); l.Label(Lang.Get("Dialog_Config.Tab.Content.Layout").Bold()); DrawModeSelector(l); l.Gap(); DrawPresetSelector(l); var importExportGrid = l.GetButtonGrid(-1f, -1f); if (GUIPlus.DrawButton(importExportGrid[1], Lang.Get("Dialog_Config.Tab.Content.Layout.SavePreset"))) { Dialog_SavePreset.Open(); } if (GUIPlus.DrawButton(importExportGrid[2], Lang.Get("Dialog_Config.Tab.Content.Layout.ManagePresets"))) { Dialog_Presets.Open(); } l.Gap(); var canAddContainer = _editor.CanAddContainer; var canAddRow = _editor.CanAddRow; var canAddElement = _editor.CanAddElement; var hasSelected = _editor.HasSelected; l.Label(Lang.Get("Dialog_Config.Tab.Content.Component").Bold()); var moveButtonsGrid = l.GetButtonGrid(-1f, -1f); if (GUIPlus.DrawButton(moveButtonsGrid[1], Lang.Get("Dialog_Config.Tab.Content.Component.MoveUp"), enabled: hasSelected && _editor.Selected.CanMoveUp)) { _editor.Selected.MoveUp(); } if (GUIPlus.DrawButton(moveButtonsGrid[2], Lang.Get("Dialog_Config.Tab.Content.Component.MoveDown"), enabled: hasSelected && _editor.Selected.CanMoveDown)) { _editor.Selected.MoveDown(); } if (l.ButtonText(Lang.Get("Dialog_Config.Tab.Content.Component.Remove"), enabled: hasSelected && _editor.Selected.CanRemove)) { _editor.Selected.Remove(); return; } if (canAddContainer && l.ButtonText(Lang.Get("Dialog_Config.Tab.Content.Component.Stack"), Lang.Get("Dialog_Config.Tab.Content.Component.StackDesc"))) { HudModel.StackComponents.Select(item => new FloatMenuOption(item.Label, () => _editor.Add(item))).ShowMenu(); } if (canAddContainer && l.ButtonText(Lang.Get("Dialog_Config.Tab.Content.Component.Panel"), Lang.Get("Dialog_Config.Tab.Content.Component.PanelDesc"))) { _editor.Add(HudModel.PanelComponent); } if (canAddRow && l.ButtonText(Lang.Get("Dialog_Config.Tab.Content.Component.Row"), Lang.Get("Dialog_Config.Tab.Content.Component.RowDesc"))) { _editor.Add(HudModel.RowComponent); } if (canAddElement && l.ButtonText(Lang.Get("Dialog_Config.Tab.Content.Component.Element"), Lang.Get("Dialog_Config.Tab.Content.Component.ElementDesc"))) { HudModel.ElementComponents.Select(item => new FloatMenuOption(item.Label, () => _editor.Add(item))).ShowMenu(); } var statRecordGrid = l.GetButtonGrid(-1f, -1f); if (canAddElement && GUIPlus.DrawButton(statRecordGrid[1], Lang.Get("Dialog_Config.Tab.Content.Component.Stat"), enabled: HudModel.StatComponents.Length > 0)) { HudModel.StatComponents.Select(item => new FloatMenuOption(item.Label, () => _editor.Add(item))).ShowMenu(); } if (canAddElement && GUIPlus.DrawButton(statRecordGrid[2], Lang.Get("Dialog_Config.Tab.Content.Component.Record"), enabled: HudModel.RecordComponents.Length > 0)) { HudModel.RecordComponents.Select(item => new FloatMenuOption(item.Label, () => _editor.Add(item))).ShowMenu(); } var customButtonsGrid = l.GetButtonGrid(-1f, -1f); if (canAddElement && GUIPlus.DrawButton(customButtonsGrid[1], Lang.Get("Dialog_Config.Tab.Content.Component.Need"), enabled: HudModel.NeedComponents.Length > 0)) { HudModel.NeedComponents.Select(item => new FloatMenuOption(item.Label, () => _editor.Add(item))).ShowMenu(); } if (canAddElement && GUIPlus.DrawButton(customButtonsGrid[2], Lang.Get("Dialog_Config.Tab.Content.Component.SkillOrTraining"), enabled: HudModel.SkillAndTrainingComponents.Length > 0)) { HudModel.SkillAndTrainingComponents.Select(item => new FloatMenuOption(item.Label, () => _editor.Add(item))).ShowMenu(); } l.End(); if (!hasSelected || _editor.Selected.IsRoot) { return; } var selectedRect = hGrid[2].GetVGrid(GUIPlus.MediumPadding, -1f, SelectedHeight)[2]; l.Begin(selectedRect); l.Label(Lang.Get("Dialog_Config.Tab.Content.Selected").Bold() + _editor.Selected.Label.Bold().Italic()); var targets = HudTarget.None; if (l.CheckboxLabeled(Lang.Get("Model.Target.PlayerHumanlike"), _editor.Selected.Targets.HasTarget(HudTarget.PlayerHumanlike), enabled: _editor.Selected.Targets != HudTarget.PlayerHumanlike)) { targets |= HudTarget.PlayerHumanlike; } if (l.CheckboxLabeled(Lang.Get("Model.Target.PlayerCreature"), _editor.Selected.Targets.HasTarget(HudTarget.PlayerCreature), enabled: _editor.Selected.Targets != HudTarget.PlayerCreature)) { targets |= HudTarget.PlayerCreature; } if (l.CheckboxLabeled(Lang.Get("Model.Target.OtherHumanlike"), _editor.Selected.Targets.HasTarget(HudTarget.OtherHumanlike), enabled: _editor.Selected.Targets != HudTarget.OtherHumanlike)) { targets |= HudTarget.OtherHumanlike; } if (l.CheckboxLabeled(Lang.Get("Model.Target.OtherCreature"), _editor.Selected.Targets.HasTarget(HudTarget.OtherCreature), enabled: _editor.Selected.Targets != HudTarget.OtherCreature)) { targets |= HudTarget.OtherCreature; } _editor.Selected.Targets = targets; if (_editor.Selected.Type == LayoutItemType.Stack || _editor.Selected.Type == LayoutItemType.Panel) { _editor.Selected.FillHeight = l.CheckboxLabeled(Lang.Get("Dialog_Config.Tab.Content.Selected.Filled"), _editor.Selected.FillHeight, Lang.Get("Dialog_Config.Tab.Content.Selected.FilledDesc")); } l.End(); }