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(); }
protected override void DrawContent(Rect rect) { var vGrid = rect.GetVGrid(GUIPlus.LargePadding, -1f, 70f); var l = new ListingPlus(); l.BeginScrollView(vGrid[1], ref _scrollPosition, ref _scrollView); foreach (var preset in LayoutPreset.UserList) { if (_selected == null) { _selected = preset; } if (l.RadioButton_NewTemp(preset.Label, _selected == preset)) { _selected = preset; } } l.EndScrollView(ref _scrollView); l.Begin(vGrid[2]); var buttonGrid = l.GetButtonGrid(-1f, -1f); if (GUIPlus.DrawButton(buttonGrid[1], Lang.Get("Dialog_Presets.Delete"), enabled: _selected?.IsUserMade ?? false)) { ConfirmDelete(); } if (GUIPlus.DrawButton(buttonGrid[2], Lang.Get("Button.Close"))) { Close(); } 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(); }