Beispiel #1
0
        protected override void DoContent(Rect rect)
        {
            Title = _presetList.EditMode || (_rules.Pawn == null) ? Lang.Get("Dialog_Restrictions.TitlePreset", _type.Label, _presetList.Selected.Name.Bold()) : Lang.Get("Dialog_Restrictions.TitlePawn", _type.Label, _rules.Pawn.Name.ToStringFull.Bold(), _rules.Type.Label);

            _color = GUI.color;

            var vGrid = rect.GetVGrid(4f, 42f, -1f);

            DoHeader(vGrid[1]);

            var hGrid = vGrid[2].GetHGrid(8f, 200f, -1f, -1f);

            _presetList.DoContent(hGrid[1]);
            DoCategories(hGrid[2], hGrid[3]);
        }
Beispiel #2
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);
        }