/// <summary>
            /// 增加状态
            /// </summary>
            /// <typeparam name="IS"></typeparam>
            /// <returns></returns>
            public IS AddState <IS>()
                where IS : class, IState <T>, new()
            {
                if (HasState <IS>() == true)
                {
                    FrameworkLog.ErrorFormat("状态已存在,添加状态失败. State:{0}", typeof(IS).Name);
                }
                IS state = new IS();

                this._stateDic.Add(typeof(IS).Name, state);
                return(state);
            }
Beispiel #2
0
            /// <summary>
            /// 创建对象池合集
            /// </summary>
            /// <param name="referenceType"></param>
            /// <returns></returns>
            private static bool CreateReferenceCollection(Type referenceType)
            {
                ReferenceCollection referenceCollection = null;

                if (_referenceCollections.TryGetValue(referenceType, out referenceCollection) == true)
                {
                    FrameworkLog.ErrorFormat("对象池已存在. referenceType:" + referenceType);
                    return(false);
                }
                referenceCollection = new ReferenceCollection(referenceType.Name);
                _referenceCollections.Add(referenceType, referenceCollection);
                return(true);
            }