protected override void DoContent(Rect rect) { var listing = new Listing_StandardPlus(); listing.Begin(rect); listing.Label(_label); GUI.SetNextControlName("NameField"); _name = listing.TextEntry(_name); UI.FocusControl("NameField", this); listing.Gap(); listing.End(); var grid = rect.AdjustedBy(0f, listing.CurHeight, 0f, -listing.CurHeight).GetHGrid(4f, -1f, -1f); listing.Begin(grid[1]); if (listing.ButtonText(Lang.Get("Button.OK"), null, NameIsValid())) { CommitName(); } listing.End(); listing.Begin(grid[2]); if (listing.ButtonText(Lang.Get("Button.Cancel"))) { Close(); } listing.End(); }
public override void DoContent(Rect rect) { var listing = new Listing_StandardPlus(); listing.Begin(rect); listing.Label(Lang.Get("Dialog_PresetName.Label")); GUI.SetNextControlName("RenameField"); _name = listing.TextEntry(_name); var valid = NameIsValid(); if (!_focused) { UI.FocusControl("RenameField", this); _focused = true; } listing.Gap(); listing.End(); var grid = rect.AdjustedBy(0f, listing.CurHeight, 0f, -listing.CurHeight).GetHGrid(4f, 0f, 0f); listing.Begin(grid[0]); if (listing.ButtonText(Lang.Get("Button.OK"), null, valid)) { CommitName(); Close(); } listing.End(); listing.Begin(grid[1]); if (listing.ButtonText(Lang.Get("Button.Cancel"))) { Close(); } listing.End(); }
private void DoHeader(Rect rect) { var grid = rect.GetHGrid(8f, 200f, -1f, -1f); _headerList.Begin(grid[1]); _headerList.Label(Lang.Get("Preset.Header").Italic().Bold()); _headerList.GapLine(); _headerList.End(); _headerList.Begin(grid[2]); _headerList.Label(Lang.Get("Dialog_Restrictions.HeaderCategory").Italic().Bold()); _headerList.GapLine(); _headerList.End(); _headerList.Begin(grid[3]); _headerList.Label(_type.Categorization.Italic().Bold()); _headerList.GapLine(); _headerList.End(); }
protected override void DoContent(Rect rect) { var vGrid = rect.GetVGrid(4f, -1f, 30f, 30f); var hasPlans = _plans.Any(); if (hasPlans) { _listing.Begin(vGrid[1], true); foreach (var plan in _plans) { if (_listing.RadioButton(plan, _selected == plan)) { _selected = plan; } } } else { _listing.Begin(vGrid[1]); _listing.Label(Lang.Get("Dialog_Plans.NoneFound")); } _listing.End(); var tGrid = vGrid[2].GetHGrid(4f, -1f, -1f); var bGrid = vGrid[3].GetHGrid(4f, -1f, -1f); if (GuiPlus.ButtonText(tGrid[1], Lang.Get("Dialog_Plans.Import"), Lang.Get("Dialog_Plans.ImportDesc"), !_selected.NullOrEmpty())) { LoadPlan(); } if (GuiPlus.ButtonText(tGrid[2], Lang.Get("Dialog_Plans.Delete"), Lang.Get("Dialog_Plans.DeleteDesc"), !_selected.NullOrEmpty())) { Dialog_Alert.Open(Lang.Get("Dialog_Plans.ConfirmDelete", _selected), Dialog_Alert.Buttons.YesNo, DeletePlan); } if (GuiPlus.ButtonText(bGrid[1], Lang.Get("Dialog_Plans.Export"), Lang.Get("Dialog_Plans.ExportDesc"))) { Dialog_SetName.Open(Lang.Get("Dialog_SetName.PlanTitle"), Lang.Get("Dialog_SetName.PlanLabel"), SavePlan, Persistent.NameIsValid, Persistent.CreateDefaultName()); } if (GuiPlus.ButtonText(bGrid[2], "CloseButton".Translate())) { Close(); } }
protected override void DoContent(Rect rect) { if (!Registry.IsActive) { Close(); return; } Title = _type == null?Lang.Get("Dialog_Rules.Title", _pawn.Name.ToStringFull.Bold(), _preset.Type.Label) : Lang.Get("Dialog_Rules.TitleDefault", _type.LabelPlural.Bold()); var listing = new Listing_StandardPlus(); var hGrid = rect.GetHGrid(8f, 200f, -1f); var lGrid = hGrid[1].GetVGrid(4f, 42f, -1f); listing.Begin(lGrid[1]); listing.Label(Lang.Get("Preset.Header").Italic().Bold()); listing.GapLine(); listing.End(); _preset.DoContent(lGrid[2]); var vGrid = hGrid[2].GetVGrid(4f, 42f, -1f, 62f); listing.Begin(vGrid[1]); listing.Label(Lang.Get("Dialog_Rules.Configuration").Italic().Bold()); listing.GapLine(); listing.End(); var editMode = _preset.EditMode || (_template == _personalized); var color = GUI.color; if (!editMode) { GUI.color = GuiPlus.ReadOnlyColor; } listing.Begin(vGrid[2]); if (Registry.ShowFoodPolicy && listing.ButtonText(Lang.Get("Rules.FoodRestrictions", GetRestrictionDisplayName(_template.GetRestriction(RestrictionType.Food))), Lang.Get("Rules.FoodRestrictionsDesc")) && editMode) { ChangeRestriction(RestrictionType.Food); } if (_template.Type == PawnType.Colonist) { if (Registry.ShowBondingPolicy && listing.ButtonText(Lang.Get("Rules.BondingRestrictions", GetRestrictionDisplayName(_template.GetRestriction(RestrictionType.Bonding))), Lang.Get("Rules.BondingRestrictionsDesc")) && editMode) { ChangeRestriction(RestrictionType.Bonding); } if ((Registry.ShowFoodPolicy || Registry.ShowBondingPolicy) && (Registry.ShowAllowCourting || Registry.ShowAllowArtisan)) { listing.GapLine(); } if (Registry.ShowAllowCourting) { listing.CheckboxLabeled(Lang.Get("Rules.AllowCourting"), ref _template.AllowCourting, Lang.Get("Rules.AllowCourtingDesc"), editMode); } if (Registry.ShowAllowArtisan) { listing.CheckboxLabeled(Lang.Get("Rules.AllowArtisan"), ref _template.AllowArtisan, Lang.Get("Rules.AllowArtisanDesc"), editMode); } } if (Registry.ShowFoodPolicy || Registry.ShowBondingPolicy || Registry.ShowAllowCourting || Registry.ShowAllowArtisan) { listing.GapLine(); } listing.End(); if (_template.HasAddons) { var addonsRect = vGrid[2].GetVGrid(4f, listing.CurHeight, -1f)[2]; _addons.Begin(addonsRect, addonsRect.height <= _template.AddonsRectHeight); GuiPlus.DoAddonsListing(_addons, _template, editMode); _addons.End(); } GUI.color = color; var optionGrid = vGrid[3].GetVGrid(2f, -1f, -1f); listing.Begin(optionGrid[1]); if (listing.ButtonText(Lang.Get("Button.AssignTo"), Lang.Get("Button.AssignToDesc"), (_floatMenuAssign.Count > 0) && (!editMode || (_template == _personalized)))) { Find.WindowStack.Add(new FloatMenu(_floatMenuAssign)); } listing.End(); listing.Begin(optionGrid[2]); if (listing.ButtonText(_type == null ? Lang.Get("Button.ViewType", Lang.Get("PawnType.Individual")) : Lang.Get("Button.ViewTypeDefault", _type.LabelPlural), Lang.Get("Button.ViewTypeDesc"), !editMode || (_template == _personalized))) { Find.WindowStack.Add(new FloatMenu(_floatMenuViews)); } listing.End(); GUI.EndGroup(); if (GuiPlus.ButtonText(new Rect(rect.xMax - (80f - Margin), rect.yMax + (Margin * 2), OptionButtonSize, CloseButSize.y), Lang.Get("Button.GlobalOptions"), Lang.Get("Button.GlobalOptionsDesc"))) { Dialog_Global.Open(); } GUI.BeginGroup(windowRect); }