summaryrefslogtreecommitdiff
path: root/Client/Assets/Scripts/XUtliPoolLib/SeqList.cs
blob: d11c601869e2dec65d9a1606cbd94e12fc6aea93 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
using System;
using System.Collections.Generic;

namespace XUtliPoolLib
{
	public class SeqList<T>
	{
		public short Count
		{
			get
			{
				return this.m_count;
			}
		}

		public short Dim
		{
			get
			{
				return this.m_dim;
			}
		}

		public T this[int index, int dim]
		{
			get
			{
				return this.buff[index * (int)this.m_dim + dim];
			}
			set
			{
				this.buff[index * (int)this.m_dim + dim] = value;
			}
		}

		public List<T> buff;

		private short m_dim = 2;

		private short m_count = 1;

		public SeqList()
		{
			this.buff = new List<T>();
			this.Reset(2, 1);
		}

		public SeqList(short dim, short count)
		{
			this.buff = new List<T>();
			this.Reset(dim, count);
		}

		public void Reset(short dim, short count)
		{
			this.m_dim = dim;
			this.m_count = count;
			this.buff.Clear();
			this.buff.Capacity = (int)(this.m_dim * this.m_count);
			for (int i = 0; i < this.buff.Capacity; i++)
			{
				this.buff.Add(default(T));
			}
		}
	}
}