Beispiel #1
0
 private StackDataMapping(LuaObjectPool luaObjectPool)
 {
     if (TypeTraits <T> .type == objType)
     {
         container = new Dictionary <T, int>(2017, new CompareObject());
     }
     else
     {
         container = new Dictionary <T, int>(17);
     }
     luaObjectPool.AttachDisposeListenter(Clear);
 }
Beispiel #2
0
            internal override void Destroy(LuaObjectPool objPool, int pos, bool bClean, bool bLogGC)
            {
                if (bClean)
                {
                    RemoveMapping(objPool, pos);
                    if (bLogGC)
                    {
                        Debugger.Log("destroy object {0}, id {1}", obj, pos);
                    }
                }

                obj = default(T);
            }
Beispiel #3
0
 private void RemoveMapping(LuaObjectPool objPool, int pos)
 {
     if (bObjectType)
     {
         if (obj != null)
         {
             StackDataMapping <object> .InstanceGet(objPool).Remove(obj, pos);
         }
     }
     else
     {
         StackDataMapping <T> .InstanceGet(objPool).Remove(obj, pos);
     }
 }
Beispiel #4
0
            internal override int Remove(LuaObjectPool objPool, int pos, bool bLogGC)
            {
                RemoveMapping(objPool, pos);

                int result = head.index;

                head.index = pos;
                if (bLogGC)
                {
                    Debugger.Log("gc object {0}, id {1}", obj, pos);
                }
                obj = default(T);

                return(result);
            }
Beispiel #5
0
            public static StackDataMapping <T> InstanceGet(LuaObjectPool luaObjectPool)
            {
#if !MULTI_STATE
                _instance = _instance ?? new StackDataMapping <T>(luaObjectPool);
                return(_instance);
#else
                StackDataMapping <T> _instance = null;
                if (!_instanceGroup.TryGetValue(luaObjectPool, out _instance) || _instance == null)
                {
                    _instance = new StackDataMapping <T>(luaObjectPool);
                    _instanceGroup[luaObjectPool] = _instance;
                }

                return(_instance);
#endif
            }
Beispiel #6
0
 internal virtual void Destroy(LuaObjectPool objPool, int pos, bool bClean, bool bLogGC)
 {
 }
Beispiel #7
0
 internal virtual int Remove(LuaObjectPool objPool, int pos, bool bLogGC)
 {
     return(-1);
 }