Beispiel #1
0
        private StateEntity <T> GetEntity(T stateType)
        {
            int             index  = mStateSet.FindIndex((item) => { return(stateType.Equals(item.StateType)); });
            StateEntity <T> entity = null;

            if (index >= 0)
            {
                entity = mStateSet[index];
            }
            return(entity);
        }
Beispiel #2
0
        /// <summary>
        /// 添加一个新状态
        /// </summary>
        /// <param name="stateType">状态类别</param>
        /// <returns></returns>
        public StateEntity <T> AddState(T stateType)
        {
            StateEntity <T> entity = GetEntity(stateType);

            if (entity == null)
            {
                entity = new StateEntity <T>(stateType, this);
                mStateSet.Add(entity);
            }
            return(entity);
        }