public void AddToLayer(int layer)
        {
            RemoveFromLayer(this.layer);

            this.layer = layer;
            priHolder.Init();
            priHolder = SpriteManager.AddPrimitiveGroupToLayer(layer, priHolder);
        }
        internal void Remove(SetIndexer <SpritePrimitiveGroup> data)
        {
            int idx = data.nodeIndex;

            baseContainer.Remove(data);

            if (idx < baseContainer.size)
            {
                baseContainer[idx].priHolder.nodeIndex = idx;
            }
        }
示例#3
0
        public SetIndexer <T> Add(SetIndexer <T> data)
        {
            if (data.nodeIndex != -1)
            {
                return(SetIndexer <T> .Null);
            }

            if (size == maxSize)
            {
                T[] tmp = new T[maxSize * 2];

                System.Array.Copy(datas, tmp, maxSize);
                datas    = tmp;
                maxSize *= 2;
            }

            datas[size] = data.value;
            return(new SetIndexer <T>(size++, data.value, hashID));
        }
示例#4
0
        public void Remove(SetIndexer <T> data)
        {
            int i = data.nodeIndex;

            if (i == -1 || data.parentHashID != this.hashID)
            {
                return;
            }

            int t = size - 1;

            if (i < maxSize && t < maxSize)
            {
                datas[i] = datas[t];
                datas[t] = default(T);
                size--;
            }

            return;
        }
 public SpritePrimitiveGroup()
 {
     priHolder = new SetIndexer <SpritePrimitiveGroup>(this);
 }
 internal static void RemovePrimitiveGroupFromLayer(int id, SetIndexer <SpritePrimitiveGroup> group)
 {
     instance._RemovePrimitiveGroupFromLayer(id, group);
 }
 internal static SetIndexer <SpritePrimitiveGroup> AddPrimitiveGroupToLayer(int id, SetIndexer <SpritePrimitiveGroup> group)
 {
     return(instance._AddPrimitiveGroupToLayer(id, group));
 }
        void _RemovePrimitiveGroupFromLayer(int id, SetIndexer <SpritePrimitiveGroup> primitive)
        {
            SpriteLayer layer = _GetLayer(id);

            layer.Remove(primitive);
        }
        SetIndexer <SpritePrimitiveGroup> _AddPrimitiveGroupToLayer(int id, SetIndexer <SpritePrimitiveGroup> group)
        {
            SpriteLayer layer = _GetLayer(id);

            return(layer.Add(group));
        }
 internal SetIndexer <SpritePrimitiveGroup> Add(SetIndexer <SpritePrimitiveGroup> data)
 {
     return(baseContainer.Add(data));
 }