コード例 #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
        private bool AddAction([NotNull] ILevelUpAction action, bool ignoreOrder = false)
        {
            LevelUpActionPriority levelUpActionPriority = (this.LevelUpActions.Count <= 0) ? LevelUpActionPriority.Visual : this.LevelUpActions[this.LevelUpActions.Count - 1].Priority;

            if (ignoreOrder || this.AutoCommit || action.Priority >= levelUpActionPriority)
            {
                if (!this.m_RecalculatePreview)
                {
                    if (!action.Check(this.State, this.Preview))
                    {
                        return(false);
                    }
                    this.LevelUpActions.Add(action);
                    action.Apply(this.State, this.Preview);
                    this.State.OnApplyAction();
                    if (this.Doll != null)
                    {
                        this.Doll.UpdateMechanicsEntities(this.Preview);
                    }
                    if (!this.m_ApplyingPlan)
                    {
                        this.m_PlanChanged = true;
                    }
                    return(true);
                }
                else
                {
                    this.LevelUpActions.Add(action);
                }
            }
            else
            {
                for (int i = 0; i < this.LevelUpActions.Count; i++)
                {
                    if (this.LevelUpActions[i].Priority > action.Priority)
                    {
                        this.LevelUpActions.Insert(i, action);
                        this.m_RecalculatePreview = true;
                        break;
                    }
                }
            }
            this.UpdatePreview();
            bool flag = this.LevelUpActions.Contains(action);

            if (flag && !this.m_ApplyingPlan)
            {
                this.m_PlanChanged = true;
            }
            return(flag);
        }
コード例 #3
0
 private static bool IsDefaultBuildPriority(LevelUpActionPriority priority)
 {
     return(priority != LevelUpActionPriority.Visual && priority != LevelUpActionPriority.Race && priority != LevelUpActionPriority.Class && priority != LevelUpActionPriority.ApplyClass && priority != LevelUpActionPriority.ApplySpellbook && priority != LevelUpActionPriority.ApplySkillPoints && priority != LevelUpActionPriority.Alignment);
 }