コード例 #1
0
        private void Init(int capacity)
        {
            if (capacity < 0)
            {
                capacity = 0;
            }

            this.count     = 0;
            this.size      = 0;
            this.capacity  = -1;
            this.fromIndex = 0;
            if (this.freePeek == null)
            {
                this.freePeek = PoolQueueCopyable <int> .Spawn(capacity);
            }
            this.freePeek.Clear();
            if (this.free == null)
            {
                this.free = PoolHashSetCopyable <int> .Spawn(capacity);
            }
            this.free.Clear();
            if (this.freePrepared == null)
            {
                this.freePrepared = PoolHashSetCopyable <int> .Spawn(capacity);
            }
            this.freePrepared.Clear();
            this.Resize_INTERNAL(capacity);
        }
コード例 #2
0
        public void CopyFrom(RefList <T> other)
        {
            ArrayUtils.Copy(in other.arr, ref this.arr);

            if (this.freePrepared != null)
            {
                PoolHashSetCopyable <int> .Recycle(ref this.freePrepared);
            }
            this.freePrepared = PoolHashSetCopyable <int> .Spawn(other.freePrepared.Count);

            this.freePrepared.CopyFrom(other.freePrepared);

            if (this.freePeek != null)
            {
                PoolQueueCopyable <int> .Recycle(ref this.freePeek);
            }
            this.freePeek = PoolQueueCopyable <int> .Spawn(other.freePeek.Count);

            this.freePeek.CopyFrom(other.freePeek);

            if (this.free != null)
            {
                PoolHashSetCopyable <int> .Recycle(ref this.free);
            }
            this.free = PoolHashSetCopyable <int> .Spawn(other.free.Count);

            this.free.CopyFrom(other.free);

            this.size         = other.size;
            this.capacity     = other.capacity;
            this.count        = other.count;
            this.fromIndex    = other.fromIndex;
            this.initCapacity = other.initCapacity;
        }
コード例 #3
0
 public void Initialize()
 {
     if (this.globalEventLogicItems == null)
     {
         this.globalEventLogicItems = PoolListCopyable <GlobalEventFrameItem> .Spawn(10);
     }
     if (this.globalEventLogicEvents == null)
     {
         this.globalEventLogicEvents = PoolHashSetCopyable <long> .Spawn();
     }
 }
コード例 #4
0
 public void Initialize(int capacity)
 {
     if (this.data == null)
     {
         this.data = PoolHashSetCopyable <KeyValuePair> .Spawn(capacity);
     }
     if (this.index == null)
     {
         this.index = PoolHashSetCopyable <long> .Spawn(capacity);
     }
 }
コード例 #5
0
ファイル: ArrayUtils.cs プロジェクト: word-ptr/ecs-submodule
        public static void Recycle <T, TCopy>(ref HashSetCopyable <T> list, TCopy copy) where TCopy : IArrayElementCopy <T>
        {
            if (list != null)
            {
                foreach (var item in list)
                {
                    copy.Recycle(item);
                }

                PoolHashSetCopyable <T> .Recycle(ref list);
            }
        }
コード例 #6
0
        void IPoolableSpawn.OnSpawn()
        {
            this.requests = PoolHashSet <Entity> .Spawn(Filter <TState, TEntity> .REQUESTS_CAPACITY);

            this.requestsRemoveEntity = PoolHashSet <Entity> .Spawn(Filter <TState, TEntity> .REQUESTS_CAPACITY);

            this.nodes = PoolArray <IFilterNode> .Spawn(Filter <TState, TEntity> .NODES_CAPACITY);

            this.data = PoolHashSetCopyable <Entity> .Spawn();

            this.dataContains = PoolHashSetCopyable <EntityId> .Spawn();
        }
コード例 #7
0
        public static void Copy <T>(HashSetCopyable <T> fromArr, ref HashSetCopyable <T> arr) where T : struct
        {
            if (fromArr == null)
            {
                if (arr != null)
                {
                    PoolHashSetCopyable <T> .Recycle(ref arr);
                }

                arr = null;
                return;
            }

            if (arr == null)
            {
                arr = PoolHashSetCopyable <T> .Spawn(fromArr.Count);
            }

            arr.CopyFrom(fromArr);
        }
コード例 #8
0
ファイル: ArrayUtils.cs プロジェクト: word-ptr/ecs-submodule
        public static void Copy <T, TCopy>(HashSetCopyable <T> fromArr, ref HashSetCopyable <T> arr, TCopy copy) where T : struct where TCopy : IArrayElementCopy <T>
        {
            if (fromArr == null)
            {
                if (arr != null)
                {
                    arr.Clear(copy);
                    PoolHashSetCopyable <T> .Recycle(ref arr);
                }

                arr = null;
                return;
            }

            if (arr == null)
            {
                arr = PoolHashSetCopyable <T> .Spawn();
            }

            arr.CopyFrom(fromArr, copy);
        }
コード例 #9
0
        public void CopyFrom(Filter <TState, TEntity> other)
        {
            this.id         = other.id;
            this.name       = other.name;
            this.nodesCount = other.nodesCount;

            ArrayUtils.Copy(other.nodes, ref this.nodes);

            if (this.data != null)
            {
                PoolHashSetCopyable <Entity> .Recycle(ref this.data);
            }
            this.data = PoolHashSetCopyable <Entity> .Spawn(other.data.Count);

            this.data.CopyFrom(other.data);

            if (this.dataContains != null)
            {
                PoolHashSetCopyable <EntityId> .Recycle(ref this.dataContains);
            }
            this.dataContains = PoolHashSetCopyable <EntityId> .Spawn(other.dataContains.Count);

            this.dataContains.CopyFrom(other.dataContains);
        }
コード例 #10
0
 public static void Recycle(HashSetCopyable <TValue> dic)
 {
     PoolHashSetCopyable <TValue> .pool.Recycle(dic);
 }
コード例 #11
0
        public static void Recycle(ref HashSetCopyable <TValue> dic)
        {
            PoolHashSetCopyable <TValue> .pool.Recycle(dic);

            dic = null;
        }
コード例 #12
0
 internal FilterEnumerator(IFilterInternal <TState> set)
 {
     this.set             = set;
     this.setEnumerator   = this.set.GetData().GetEnumerator();
     this.set.forEachMode = true;
 }
コード例 #13
0
 public static void Recycle(ref HashSetCopyable <TValue> dic)
 {
     Pools.current.PoolRecycle(ref dic);
 }