From 6eb915c129fc90c6f4c82ae097dd6ffad5239efc Mon Sep 17 00:00:00 2001 From: chai Date: Mon, 25 Jan 2021 14:28:30 +0800 Subject: +scripts --- .../Scripts/XMainClient/XCharacterDocument.cs | 72 ++++++++++++++++++++++ 1 file changed, 72 insertions(+) create mode 100644 Client/Assets/Scripts/XMainClient/XCharacterDocument.cs (limited to 'Client/Assets/Scripts/XMainClient/XCharacterDocument.cs') diff --git a/Client/Assets/Scripts/XMainClient/XCharacterDocument.cs b/Client/Assets/Scripts/XMainClient/XCharacterDocument.cs new file mode 100644 index 00000000..526224da --- /dev/null +++ b/Client/Assets/Scripts/XMainClient/XCharacterDocument.cs @@ -0,0 +1,72 @@ +using System; +using XUtliPoolLib; + +namespace XMainClient +{ + internal class XCharacterDocument : XDocComponent + { + public override uint ID + { + get + { + return XCharacterDocument.uuID; + } + } + + public XCharacterInfoView InfoView + { + get + { + return this._info_view; + } + set + { + this._info_view = value; + } + } + + public new static readonly uint uuID = XSingleton.singleton.XHash("CharacterDocument"); + + private XCharacterInfoView _info_view = null; + + protected override void EventSubscribe() + { + base.EventSubscribe(); + base.RegisterEvent(XEventDefine.XEvent_AttributeChange, new XComponent.XEventHandler(this.OnAttributeChange)); + } + + public static uint GetCharacterPPT() + { + return (uint)XSingleton.singleton.XPlayerData.GetAttr(XAttributeDefine.XAttr_POWER_POINT_Basic); + } + + public static XAttributes GetCharacterAttr() + { + return XSingleton.singleton.XPlayerData; + } + + protected bool OnAttributeChange(XEventArgs e) + { + bool flag = this._info_view != null && this._info_view.active; + if (flag) + { + XAttrChangeEventArgs xattrChangeEventArgs = e as XAttrChangeEventArgs; + XAttributeDefine attrKey = xattrChangeEventArgs.AttrKey; + if (attrKey == XAttributeDefine.XAttr_POWER_POINT_Basic) + { + this._info_view.SetPowerpoint(true, (uint)xattrChangeEventArgs.DeltaValue); + } + } + return true; + } + + protected override void OnReconnected(XReconnectedEventArgs arg) + { + bool flag = this.InfoView != null && this.InfoView.IsVisible(); + if (flag) + { + this._info_view.SetPowerpoint(true, XCharacterDocument.GetCharacterPPT()); + } + } + } +} -- cgit v1.1-26-g67d0