summaryrefslogtreecommitdiff
path: root/Client/Assets/Scripts/XMainClient/XCharacterDocument.cs
blob: 526224da0e6f67eebc72d6d9e27d2865ec05a669 (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
66
67
68
69
70
71
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<XCommon>.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<XAttributeMgr>.singleton.XPlayerData.GetAttr(XAttributeDefine.XAttr_POWER_POINT_Basic);
		}

		public static XAttributes GetCharacterAttr()
		{
			return XSingleton<XAttributeMgr>.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());
			}
		}
	}
}