From 6eb915c129fc90c6f4c82ae097dd6ffad5239efc Mon Sep 17 00:00:00 2001 From: chai Date: Mon, 25 Jan 2021 14:28:30 +0800 Subject: +scripts --- .../Scripts/XMainClient/XPlayerAttributes.cs | 143 +++++++++++++++++++++ 1 file changed, 143 insertions(+) create mode 100644 Client/Assets/Scripts/XMainClient/XPlayerAttributes.cs (limited to 'Client/Assets/Scripts/XMainClient/XPlayerAttributes.cs') diff --git a/Client/Assets/Scripts/XMainClient/XPlayerAttributes.cs b/Client/Assets/Scripts/XMainClient/XPlayerAttributes.cs new file mode 100644 index 00000000..ceca8e32 --- /dev/null +++ b/Client/Assets/Scripts/XMainClient/XPlayerAttributes.cs @@ -0,0 +1,143 @@ +using System; +using KKSG; +using XMainClient.UI; +using XMainClient.UI.UICommon; +using XUtliPoolLib; + +namespace XMainClient +{ + internal class XPlayerAttributes : XRoleAttributes + { + public override uint ID + { + get + { + return XPlayerAttributes.uuID; + } + } + + public uint SkillPageIndex { get; set; } + + public new static readonly uint uuID = XSingleton.singleton.XHash("Player_Attributes"); + + public byte[] openedSystem = new byte[32]; + + public bool AutoPlayOn = false; + + public XPlayerAttributes() + { + this._manualUnitBuff = true; + this._security_Statistics = new XSecurityStatistics(); + } + + public override void InitAttribute(KKSG.Attribute attr) + { + base.InitAttribute(attr); + } + + public bool IsSystemOpened(uint sysID) + { + uint num = sysID / 8u; + int num2 = (int)(sysID % 8u); + int num3 = 1 << num2; + bool flag = (ulong)num >= (ulong)((long)this.openedSystem.Length); + bool result; + if (flag) + { + XSingleton.singleton.AddErrorLog("sys id out of range: ", sysID.ToString(), null, null, null, null); + result = false; + } + else + { + result = (((int)this.openedSystem[(int)num] & num3) != 0); + } + return result; + } + + public void CacheOpenSystem(uint sysID) + { + bool flag = !XSingleton.singleton.IsImmediatelyOpenSystem(sysID); + if (flag) + { + XSingleton.singleton.AddNewOpenSystem(sysID); + XSingleton.singleton.SetExternalString("OpenSys" + sysID); + } + else + { + this.ReallyOpenSystem(sysID); + bool flag2 = DlgBase.singleton.IsVisible(); + if (flag2) + { + DlgBase.singleton.OnSysChange((XSysDefine)sysID); + XSingleton.singleton.RecalculateRedPointState((XSysDefine)sysID, true); + } + } + } + + public void ReallyOpenSystem(uint sysID) + { + uint num = sysID / 8u; + int num2 = (int)(sysID % 8u); + int num3 = 1 << num2; + bool flag = (ulong)num >= (ulong)((long)this.openedSystem.Length); + if (flag) + { + XSingleton.singleton.AddErrorLog("open sys id out of range: ", sysID.ToString(), null, null, null, null); + } + else + { + byte[] array = this.openedSystem; + uint num4 = num; + array[(int)num4] = (byte)((int)array[(int)num4] | num3); + XSingleton.singleton.RecalculateRedPointState((XSysDefine)sysID, true); + XMainInterfaceDocument specificDocument = XDocuments.GetSpecificDocument(XMainInterfaceDocument.uuID); + specificDocument.OnSysOpen(); + } + } + + public void CloseSystem(uint sysID) + { + uint num = sysID / 8u; + int num2 = (int)(sysID % 8u); + int num3 = 1 << num2; + bool flag = (ulong)num >= (ulong)((long)this.openedSystem.Length); + if (flag) + { + XSingleton.singleton.AddErrorLog("close sys id out of range: ", sysID.ToString(), null, null, null, null); + } + else + { + byte[] array = this.openedSystem; + uint num4 = num; + array[(int)num4] = (byte)(array[(int)num4] & (int)(~(byte)num3)); + XSingleton.singleton.SetSysRedPointState((XSysDefine)sysID, false); + XMainInterfaceDocument specificDocument = XDocuments.GetSpecificDocument(XMainInterfaceDocument.uuID); + specificDocument.OnSysChange(); + } + } + + public void HPMPReset() + { + double attr = base.GetAttr(XAttributeDefine.XAttr_MaxHP_Total); + base.SetAttr(XAttributeDefine.XAttr_CurrentHP_Basic, attr); + double attr2 = base.GetAttr(XAttributeDefine.XAttr_MaxMP_Total); + base.SetAttr(XAttributeDefine.XAttr_CurrentMP_Basic, attr2); + } + + public long GetLevelUpExp(int level) + { + PlayerLevelTable.RowData byLevel = XSingleton.singleton.LevelTable.GetByLevel(level); + bool flag = byLevel != null; + long result; + if (flag) + { + result = byLevel.Exp; + } + else + { + result = 0L; + } + return result; + } + } +} -- cgit v1.1-26-g67d0