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); }
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>(); }
public StructListDebugView(StructList <T> structList) { this.structList = structList; array = structList.ToArray(); }