summaryrefslogtreecommitdiff
path: root/Client/Assets/Scripts/XMainClient/MadDuckSiegeDocument.cs
blob: 775e86cb44ccb57b227ebd8a9e1ee741e7a94b32 (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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
using System;
using System.Collections.Generic;
using XMainClient.UI.UICommon;
using XUtliPoolLib;

namespace XMainClient
{
	internal class MadDuckSiegeDocument : XDocComponent
	{
		public override uint ID
		{
			get
			{
				return MadDuckSiegeDocument.uuID;
			}
		}

		public static MadDuckSiegeDocument Doc
		{
			get
			{
				return XSingleton<XGame>.singleton.Doc.GetXComponent(MadDuckSiegeDocument.uuID) as MadDuckSiegeDocument;
			}
		}

		public XThemeActivityDocument ActDoc
		{
			get
			{
				return XSingleton<XGame>.singleton.Doc.GetXComponent(XThemeActivityDocument.uuID) as XThemeActivityDocument;
			}
		}

		public int systemID
		{
			get
			{
				return XFastEnumIntEqualityComparer<XSysDefine>.ToInt(this.sys);
			}
		}

		public SuperActivityTime.RowData ActInfo
		{
			get
			{
				bool flag = this._actInfo != null;
				SuperActivityTime.RowData actInfo;
				if (flag)
				{
					actInfo = this._actInfo;
				}
				else
				{
					XTempActivityDocument specificDocument = XDocuments.GetSpecificDocument<XTempActivityDocument>(XTempActivityDocument.uuID);
					this._actInfo = specificDocument.GetDataBySystemID((uint)this.systemID);
					bool flag2 = this._actInfo == null;
					if (flag2)
					{
						XSingleton<XDebug>.singleton.AddErrorLog("SuperActivityTime SystemID:" + this.systemID + "No Find", null, null, null, null, null);
					}
					actInfo = this._actInfo;
				}
				return actInfo;
			}
		}

		public List<SuperActivityTask.RowData> ActTask
		{
			get
			{
				bool flag = this._ActTask == null;
				if (flag)
				{
					this._ActTask = XTempActivityDocument.Doc.GetDataByActivityType(this.ActInfo.actid);
				}
				return this._ActTask;
			}
		}

		public new static readonly uint uuID = XSingleton<XCommon>.singleton.XHash("MadDuckSiegeDocument");

		public uint sceneID = uint.Parse(XSingleton<XGlobalConfig>.singleton.GetValue("MadDuckSceneID"));

		public XSysDefine sys = XSysDefine.XSys_ThemeActivity_MadDuck;

		private SuperActivityTime.RowData _actInfo = null;

		public string[] cost = XSingleton<XGlobalConfig>.singleton.GetValue("DuckTickets").Split(new char[]
		{
			'='
		});

		private List<SuperActivityTask.RowData> _ActTask = null;

		protected override void EventSubscribe()
		{
			base.EventSubscribe();
			base.RegisterEvent(XEventDefine.XEvent_ActivityTaskUpdate, new XComponent.XEventHandler(this.OnTaskChange));
		}

		private bool OnTaskChange(XEventArgs e)
		{
			XActivityTaskUpdatedArgs xactivityTaskUpdatedArgs = e as XActivityTaskUpdatedArgs;
			bool flag = xactivityTaskUpdatedArgs.xActID == this.ActInfo.actid;
			if (flag)
			{
				bool flag2 = DlgBase<XThemeActivityView, XThemeActivityBehaviour>.singleton.m_MadDuckHandler != null && DlgBase<XThemeActivityView, XThemeActivityBehaviour>.singleton.m_MadDuckHandler.m_ActivityExchangeRewardHandler != null && DlgBase<XThemeActivityView, XThemeActivityBehaviour>.singleton.m_MadDuckHandler.m_ActivityExchangeRewardHandler.IsVisible();
				if (flag2)
				{
					DlgBase<XThemeActivityView, XThemeActivityBehaviour>.singleton.m_MadDuckHandler.m_ActivityExchangeRewardHandler.RefreshList(false);
				}
			}
			return true;
		}

		protected override void OnReconnected(XReconnectedEventArgs arg)
		{
		}

		public bool GetRedPoint()
		{
			ulong itemCount = XBagDocument.BagDoc.GetItemCount(int.Parse(this.cost[0]));
			return itemCount >= ulong.Parse(this.cost[1]);
		}
	}
}