summaryrefslogtreecommitdiff
path: root/Client/Assets/Scripts/XUtliPoolLib/SeqListRef.cs
blob: 16140cb022555a85aff27e466595484229330343 (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
using System;

namespace XUtliPoolLib
{
	public struct SeqListRef<T> : ISeqListRef<T>, ISeqRef
	{
		public int Count
		{
			get
			{
				return (int)this.count;
			}
		}

		public T this[int index, int key]
		{
			get
			{
				return this.dataHandler.ReadValue<T>(SeqListRef<T>.parser, this.allSameMask, this.startOffset, index, key);
			}
		}

		public static CVSReader.ValueParse<T> parser;

		public DataHandler dataHandler;

		public byte count;

		public byte allSameMask;

		public ushort startOffset;

		public void Read(XBinaryReader stream, DataHandler dh)
		{
			this.count = stream.ReadByte();
			this.allSameMask = 1;
			this.startOffset = 0;
			bool flag = this.count > 0;
			if (flag)
			{
				this.allSameMask = stream.ReadByte();
				this.startOffset = stream.ReadUInt16();
			}
			this.dataHandler = dh;
		}

		public override string ToString()
		{
			string text = "";
			for (int i = 0; i < (int)this.count; i++)
			{
				bool flag = i == (int)(this.count - 1);
				if (flag)
				{
					text += string.Format("{0}={1}", this[i, 0], this[i, 1]);
				}
				else
				{
					text += string.Format("{0}={1}|", this[i, 0], this[i, 1]);
				}
			}
			return text;
		}
	}
}