DebugLogIndexList.cs 585 B

12345678910111213141516171819202122232425262728293031323334
  1. namespace IngameDebugConsole
  2. {
  3. public class DebugLogIndexList
  4. {
  5. private int[] indices;
  6. private int size;
  7. public int Count { get { return size; } }
  8. public int this[int index] { get { return indices[index]; } }
  9. public DebugLogIndexList()
  10. {
  11. indices = new int[64];
  12. size = 0;
  13. }
  14. public void Add( int index )
  15. {
  16. if( size == indices.Length )
  17. {
  18. int[] indicesNew = new int[size * 2];
  19. System.Array.Copy( indices, 0, indicesNew, 0, size );
  20. indices = indicesNew;
  21. }
  22. indices[size++] = index;
  23. }
  24. public void Clear()
  25. {
  26. size = 0;
  27. }
  28. }
  29. }