コード例 #1
0
 private bool RemoveAction <T>([CanBeNull] Predicate <T> predicate = null) where T : ILevelUpAction
 {
     if (this.AutoCommit)
     {
         return(false);
     }
     for (int i = 0; i < this.LevelUpActions.Count; i++)
     {
         ILevelUpAction        levelUpAction = this.LevelUpActions[i];
         LevelUpActionPriority priority      = levelUpAction.Priority;
         if (!(levelUpAction.GetType() != typeof(T)))
         {
             if (predicate == null || predicate((T)((object)levelUpAction)))
             {
                 this.LevelUpActions.RemoveAt(i);
                 this.m_RecalculatePreview = true;
                 if (!this.m_ApplyingPlan && priority > LevelUpActionPriority.Visual && priority < LevelUpActionPriority.Alignment)
                 {
                     this.m_PlanChanged = true;
                 }
                 return(true);
             }
         }
     }
     return(false);
 }
コード例 #2
0
        public static string MakeActionReadable(ILevelUpAction action)
        {
            var result = "";

            result += action.GetType().Name;
            if (action is AddArchetype addArchtype)
            {
                result += $"({addArchtype.Archetype.Name})";
            }
            if (action is AddStatPoint addStatPoint)
            {
                result += $"({addStatPoint.Attribute})";
            }
            if (action is ApplyClassMechanics applyClassMechanics)
            {
                result += $"()";
            }
            if (action is ApplySkillPoints applySkillPoints)
            {
                result += $"()";
            }
            if (action is ApplySpellbook applySpellbook)
            {
                result += $"()";
            }
            if (action is RemoveStatPoint removeStatPoint)
            {
                result += $"({removeStatPoint.Attribute})";
            }
            if (action is SelectAlignment selectAlignment)
            {
                result += $"({selectAlignment.Alignment})";
            }
            if (action is SelectClass selectClass)
            {
                var m_CharacterClass = Traverse.Create(selectClass).Field("m_CharacterClass").GetValue <BlueprintCharacterClass>();
                result += $"({m_CharacterClass.Name})";
            }
            if (action is SelectFeature selectFeature)
            {
                var selection = selectFeature.Selection;
                var item      = selectFeature.Item;
                result += $"({selection}, {item})";
            }
            if (action is SelectGender selectGender)
            {
                result += $"({selectGender.Gender})";
            }
            if (action is SelectName selectName)
            {
                result += $"({selectName.Name})";
            }
            if (action is SelectPortrait selectPortrait)
            {
                result += $"({selectPortrait.Portrait.name})";
            }
            if (action is SelectRace selectRace)
            {
                result += $"({selectRace.Race.Name})";
            }
            if (action is SelectRaceStat selectRaceStat)
            {
                result += $"({selectRaceStat.Attribute})";
            }
            if (action is SelectSpell selectSpell)
            {
                result += $"({selectSpell.Spellbook.Name}, {selectSpell.SpellList.name}, {selectSpell.SpellLevel}, {selectSpell.Spell.Name}, {selectSpell.SlotIndex})";
            }
            if (action is SelectVoice selectVoice)
            {
                result += $"({selectVoice.Voice.DisplayName})";
            }
            if (action is SpendAttributePoint spendAttributePoint)
            {
                result += $"({spendAttributePoint.Attribute})";
            }
            if (action is SpendSkillPoint spendSkillPoint)
            {
                result += $"({spendSkillPoint.Skill})";
            }
            result += ", " + action.Priority;
            return(result);
        }