コード例 #1
0
        public void UpdateAddableTraits(List <Trait> currentTraits)
        {
            var traits = PS_TraitHelper.AllTraitsCompadable(currentTraits, IncludeBlack: CheatMode);

            var options = traits.Select(trait =>
                                        new PS_ScrollView <Trait> .ScrollOption <Trait>
            {
                Index        = 0,
                Value        = trait,
                Label        = trait.LabelCap,
                ToolTip      = trait.TipString(this.Pawn),
                ButtonText   = "PS_Add".Translate(),
                ButtonAction = delegate { this.AddTrait(trait); }
            }).ToList();

            AddTraitScrollView.TrySetOptions(options);
        }
コード例 #2
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);
        }
コード例 #3
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);
        }