示例#1
0
        //GameManager call
        public static void ClearReleasedObjects()
        {
            for (int i = mObjectsList.Count - 1; i >= 0; i--)
            {
                if (mObjectsList[i].IsReleased)
                {
                    EntityObject obj = mObjectsList[i];
                    mObjectsList.RemoveAt(i);

                    //加入对象池
                    mRecycler.Push(obj);
                }
            }
        }
示例#2
0
        public static void ReleaseView(EntityObject entity)
        {
            if (entity != null)
            {
                ViewObject obj = mObjectsMap[entity];
                if (obj != null)
                {
                    if (EnableLog && LDebugger.EnableLog)
                    {
                        LDebugger.Log(LOG_TAG, "ReleaseView() {0}:{1}->{2}:{3}",
                                      entity.GetType().Name,
                                      entity.GetHashCode(),
                                      obj.GetRecycleType(),
                                      obj.GetInstanceID());
                    }

                    mObjectsMap.Remove(entity);
                    obj.ReleaseInFactory();
                    obj.gameObject.SetActive(false);
                    mRecycler.Push(obj);
                }
            }
        }