예제 #1
0
        private static void _returnObject(BaseObject obj)
        {
            var classType = obj.GetType();
            var maxCount  = _maxCountMap.ContainsKey(classType) ? _maxCountMap[classType] : _defaultMaxCount;
            var pool      = _poolsMap.ContainsKey(classType) ? _poolsMap[classType] : _poolsMap[classType] = new List <BaseObject>();

            if (pool.Count < maxCount)
            {
                if (!pool.Contains(obj))
                {
                    pool.Add(obj);
                }
                else
                {
                    DragonBones.Assert(false, DragonBones.ARGUMENT_ERROR);
                }
            }
        }
예제 #2
0
        private static void _ReturnObject(BaseObject obj)
        {
            var classType = obj.GetType();
            var maxCount  = _maxCountMap.ContainsKey(classType) ? _maxCountMap[classType] : _defaultMaxCount;
            var pool      = _poolsMap.ContainsKey(classType) ? _poolsMap[classType] : _poolsMap[classType] = new List <BaseObject>();

            if (pool.Count < maxCount)
            {
                if (!pool.Contains(obj))
                {
                    pool.Add(obj);
                }
                else
                {
                    Helper.Assert(false, "The object is already in the pool.");
                }
            }
            else
            {
            }
        }