From 6eb915c129fc90c6f4c82ae097dd6ffad5239efc Mon Sep 17 00:00:00 2001 From: chai Date: Mon, 25 Jan 2021 14:28:30 +0800 Subject: +scripts --- Client/Assets/Scripts/XUtliPoolLib/SeqList.cs | 66 +++++++++++++++++++++++++++ 1 file changed, 66 insertions(+) create mode 100644 Client/Assets/Scripts/XUtliPoolLib/SeqList.cs (limited to 'Client/Assets/Scripts/XUtliPoolLib/SeqList.cs') 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 + { + 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 buff; + + private short m_dim = 2; + + private short m_count = 1; + + public SeqList() + { + this.buff = new List(); + this.Reset(2, 1); + } + + public SeqList(short dim, short count) + { + this.buff = new List(); + 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)); + } + } + } +} -- cgit v1.1-26-g67d0