Пример #1
0
        public static StringBuilder GetPerThreadStringBuilder()
        {
            s_PerThreadStringBuilderPool = s_PerThreadStringBuilderPool ?? new StructList <PoolItem>();
            if (s_PerThreadStringBuilderPool.Count == 0)
            {
                s_PerThreadStringBuilderPool.Add(new PoolItem()
                {
                    active  = false,
                    builder = new StringBuilder(128)
                });
            }

            for (int i = 0; i < s_PerThreadStringBuilderPool.size; i++)
            {
                if (s_PerThreadStringBuilderPool.array[i].active == false)
                {
                    s_PerThreadStringBuilderPool.array[i].active = true;
                    return(s_PerThreadStringBuilderPool.array[i].builder);
                }
            }

            PoolItem retn = new PoolItem()
            {
                active  = true,
                builder = new StringBuilder(128)
            };

            s_PerThreadStringBuilderPool.Add(retn);
            return(retn.builder);
        }
Пример #2
0
 public SimpleRectPacker(int totalWidth, int totalHeight, int padding)
 {
     this.totalWidth            = totalWidth;
     this.totalHeight           = totalHeight;
     this.padding               = padding;
     this.rectList              = new StructList <PackedRect>();
     this.possibleCollisionList = new StructList <PackedRect>();
 }
Пример #3
0
 public StructListDebugView(StructList <T> structList)
 {
     this.structList = structList;
     array           = structList.ToArray();
 }