Beispiel #1
0
        public void UpdateCurrentConditioning()
        {
            var options = this.StartingConditioning.Where(x => x.IsValid()).Select(con =>
            {
                var opt = new PS_ScrollView <PS_Conditioning_Data> .ScrollOption <PS_Conditioning_Data>
                {
                    Index   = 0,
                    Value   = con,
                    Label   = con.ToShortPrettyString(),
                    ToolTip = con.ToPrettyString()
                };
                opt.ButtonAction = delegate { this.SetConditioningToRemove(con); };
                opt.ButtonText   = "PS_Remove".Translate();
                return(opt);
            }).ToList();

            CurrentConditioningScrollView.TrySetOptions(options);
        }
Beispiel #2
0
        public void UpdateCurrentTraits(List <Trait> traits)
        {
            var options = traits.Select(trait =>
            {
                var black    = PS_TraitHelper.IsBlacklisted(trait);
                var wasAdded = StartingConditioning?.Where(x => x.AddedTraitDefName == trait.def.defName).Any() ?? false;
                var valid    = !(black || wasAdded);
                if (CheatMode)
                {
                    valid = true;
                }

                var opt = new PS_ScrollView <Trait> .ScrollOption <Trait>
                {
                    Index     = 0,
                    Value     = trait,
                    Label     = trait.LabelCap,
                    ToolTip   = trait.TipString(Pawn),
                    HasButton = valid
                };
                if (trait.def.defName == "PS_Trait_BotchedConditioning" && trait.Degree == -1)
                {
                    opt.ButtonAction = delegate { SetFixingBotch(); };
                    opt.ButtonText   = "PS_Fix".Translate();
                    opt.HasButton    = true;
                }
                if (valid && trait.def.degreeDatas.Count < 2)
                {
                    opt.ButtonAction = delegate { RemoveTrait(trait); };
                    opt.ButtonText   = "PS_Remove".Translate();
                }
                else if (valid)
                {
                    opt.ButtonAction = delegate { ShowDegreeOptions(trait); };
                    opt.ButtonText   = "PS_Change".Translate();
                }
                return(opt);
            }).ToList();

            CurrentTraitScrollView.TrySetOptions(options);
        }
Beispiel #3
0
        public void Init(Rect rect)
        {
            this.ScrollPosition = new Vector2(0, 0);
            this.Initalized     = true;

            var addTraitDrawRect = GetRecForGridLocation(1, 0, width: 1, height: 4).Rounded();
            var paddedAdd        = new Rect(addTraitDrawRect.x + 5f, addTraitDrawRect.y + 5f + 20f, addTraitDrawRect.width - 10f, addTraitDrawRect.height - 10f).Rounded();

            AddTraitScrollView = new PS_ScrollView <Trait>(paddedAdd);

            var curTraitDrawRect = GetRecForGridLocation(0, 0, width: 1, height: 2).Rounded();
            var paddedcurt       = new Rect(curTraitDrawRect.x + 5f, curTraitDrawRect.y + 5f + 20f, curTraitDrawRect.width - 10f, curTraitDrawRect.height - 20f).Rounded();

            CurrentTraitScrollView = new PS_ScrollView <Trait>(paddedcurt);

            var curConDrawRect = GetRecForGridLocation(0, 2, width: 1, height: 2).Rounded();
            var paddedcurtcon  = new Rect(curTraitDrawRect.x + 5f, curConDrawRect.y + 5f + 30f, curTraitDrawRect.width - 10f, curTraitDrawRect.height - 20f).Rounded();

            CurrentConditioningScrollView = new PS_ScrollView <PS_Conditioning_Data>(paddedcurtcon);

            UpdateCurrentTraits(this.CurrentTraits);
            UpdateAddableTraits(this.CurrentTraits);
            UpdateCurrentConditioning();
        }