diff options
author | chai <chaifix@163.com> | 2021-01-25 14:28:30 +0800 |
---|---|---|
committer | chai <chaifix@163.com> | 2021-01-25 14:28:30 +0800 |
commit | 6eb915c129fc90c6f4c82ae097dd6ffad5239efc (patch) | |
tree | 7dd2be50edf41f36b60fac84696e731c13afe617 /Client/Assets/Scripts/XUtliPoolLib/SeqRef.cs |
+scripts
Diffstat (limited to 'Client/Assets/Scripts/XUtliPoolLib/SeqRef.cs')
-rw-r--r-- | Client/Assets/Scripts/XUtliPoolLib/SeqRef.cs | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/Client/Assets/Scripts/XUtliPoolLib/SeqRef.cs b/Client/Assets/Scripts/XUtliPoolLib/SeqRef.cs new file mode 100644 index 00000000..582eebb6 --- /dev/null +++ b/Client/Assets/Scripts/XUtliPoolLib/SeqRef.cs @@ -0,0 +1,39 @@ +using System;
+
+namespace XUtliPoolLib
+{
+ public struct SeqRef<T> : ISeqRef<T>, ISeqRef
+ {
+ public T this[int key]
+ {
+ get
+ {
+ return this.bufferRef[(int)this.startOffset + key];
+ }
+ }
+
+ public static CVSReader.ValueParse<T> parser;
+
+ public T[] bufferRef;
+
+ public ushort startOffset;
+
+ public SeqRef(T[] buffer)
+ {
+ this.bufferRef = buffer;
+ this.startOffset = 0;
+ }
+
+ public void Read(XBinaryReader stream, DataHandler dh)
+ {
+ ushort num = stream.ReadUInt16();
+ this.bufferRef = SeqRef<T>.parser.GetBuffer(dh);
+ this.startOffset = num;
+ }
+
+ public override string ToString()
+ {
+ return string.Format("{0}={1}", this[0], this[1]);
+ }
+ }
+}
|