Пример #1
0
        public bool ButtonText(string label, string tooltip = null, bool enabled = true)
        {
            var result = GuiPlus.ButtonText(GetRect(ButtonHeight), label, tooltip, enabled);

            Gap(verticalSpacing);
            return(result);
        }
Пример #2
0
        public bool CheckboxPartial(string label, ref MultiCheckboxState state, string tooltip = null, bool enabled = true, bool allowPartialInCycle = false)
        {
            var result = GuiPlus.CheckboxPartial(GetRect(Text.LineHeight), label, ref state, tooltip, enabled, allowPartialInCycle);

            Gap(verticalSpacing);

            return(result);
        }
Пример #3
0
        public string TextEntryLabeled(string label, string text, string tooltip = null, int lineCount = 1)
        {
            var rect   = GetRect(Text.LineHeight * lineCount);
            var result = GuiPlus.TextEntryLabeled(rect, label, text, tooltip);

            Gap(verticalSpacing);
            return(result);
        }
Пример #4
0
        public bool RadioButtonInverted(string label, bool active, string tooltip = null, bool enabled = true)
        {
            var lineHeight = Text.LineHeight;
            var rect       = GetRect(lineHeight);

            if (!tooltip.NullOrEmpty())
            {
                if (Mouse.IsOver(rect))
                {
                    Widgets.DrawHighlight(rect);
                }
                TooltipHandler.TipRegion(rect, tooltip);
            }
            var result = GuiPlus.RadioButtonInverted(rect, label, active, enabled);

            Gap(verticalSpacing);
            return(result);
        }
Пример #5
0
        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();
            }
        }
Пример #6
0
        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);
        }