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/XMainClient/SysIntCache.cs | 64 ++++++++++++++++++++++++ 1 file changed, 64 insertions(+) create mode 100644 Client/Assets/Scripts/XMainClient/SysIntCache.cs (limited to 'Client/Assets/Scripts/XMainClient/SysIntCache.cs') diff --git a/Client/Assets/Scripts/XMainClient/SysIntCache.cs b/Client/Assets/Scripts/XMainClient/SysIntCache.cs new file mode 100644 index 00000000..0e59a24e --- /dev/null +++ b/Client/Assets/Scripts/XMainClient/SysIntCache.cs @@ -0,0 +1,64 @@ +using System; + +namespace XMainClient +{ + public class SysIntCache + { + public uint[] flags = null; + + public SysIntCache(int sysCount) + { + int num = sysCount / 32; + int num2 = sysCount % 32; + bool flag = num2 > 0; + if (flag) + { + num++; + } + this.flags = new uint[num]; + } + + public void SetFlag(int flag, bool add) + { + int num = flag / 32; + bool flag2 = num >= 0 && num < this.flags.Length; + if (flag2) + { + flag -= num * 4 * 8; + if (add) + { + this.flags[num] |= 1u << flag; + } + else + { + this.flags[num] &= ~(1u << flag); + } + } + } + + public bool IsFlag(int flag) + { + int num = flag / 32; + bool flag2 = num >= 0 && num < this.flags.Length; + bool result; + if (flag2) + { + flag -= num * 4 * 8; + result = ((this.flags[num] & 1u << flag) > 0u); + } + else + { + result = false; + } + return result; + } + + public void Clear() + { + for (int i = 0; i < this.flags.Length; i++) + { + this.flags[i] = 0u; + } + } + } +} -- cgit v1.1-26-g67d0