summaryrefslogtreecommitdiff
path: root/Client/Assets/Scripts/XUtliPoolLib/SeqList.cs
diff options
context:
space:
mode:
authorchai <chaifix@163.com>2021-01-25 14:28:30 +0800
committerchai <chaifix@163.com>2021-01-25 14:28:30 +0800
commit6eb915c129fc90c6f4c82ae097dd6ffad5239efc (patch)
tree7dd2be50edf41f36b60fac84696e731c13afe617 /Client/Assets/Scripts/XUtliPoolLib/SeqList.cs
+scripts
Diffstat (limited to 'Client/Assets/Scripts/XUtliPoolLib/SeqList.cs')
-rw-r--r--Client/Assets/Scripts/XUtliPoolLib/SeqList.cs66
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));
+ }
+ }
+ }
+}