diff options
Diffstat (limited to 'Client/Assets/Scripts/XUtliPoolLib/SeqList.cs')
-rw-r--r-- | Client/Assets/Scripts/XUtliPoolLib/SeqList.cs | 66 |
1 files changed, 66 insertions, 0 deletions
diff --git a/Client/Assets/Scripts/XUtliPoolLib/SeqList.cs b/Client/Assets/Scripts/XUtliPoolLib/SeqList.cs new file mode 100644 index 00000000..d11c6018 --- /dev/null +++ b/Client/Assets/Scripts/XUtliPoolLib/SeqList.cs @@ -0,0 +1,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));
+ }
+ }
+ }
+}
|