summaryrefslogtreecommitdiff
path: root/Client/Assets/Scripts/XMainClient/Guild/XGuildTaskRefreshResultDlg.cs
blob: c35b8f4a6bd6e5c1d01a0c3b58c076be33eb7079 (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
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
using System;
using UILib;
using XMainClient.UI;
using XMainClient.UI.UICommon;
using XUtliPoolLib;

namespace XMainClient
{
	internal class XGuildTaskRefreshResultDlg : DlgBase<XGuildTaskRefreshResultDlg, XGuildTaskRefreshResultDlgBehavior>
	{
		public override string fileName
		{
			get
			{
				return "Guild/DailyTaskResult";
			}
		}

		public override bool autoload
		{
			get
			{
				return true;
			}
		}

		public uint AfterScore { get; set; }

		public uint BeforeScore { get; set; }

		private XFx _fx1;

		private XFx _fx2;

		private uint _fx1Token;

		private uint _fx2Token;

		protected override void OnLoad()
		{
			base.OnLoad();
		}

		public override void RegisterEvent()
		{
			base.RegisterEvent();
		}

		protected override void OnUnload()
		{
			XSingleton<XTimerMgr>.singleton.KillTimer(this._fx1Token);
			XSingleton<XTimerMgr>.singleton.KillTimer(this._fx2Token);
			this._fx1Token = 0u;
			this._fx2Token = 0u;
			bool flag = this._fx1 != null;
			if (flag)
			{
				XSingleton<XFxMgr>.singleton.DestroyFx(this._fx1, true);
				this._fx1 = null;
			}
			bool flag2 = this._fx2 != null;
			if (flag2)
			{
				XSingleton<XFxMgr>.singleton.DestroyFx(this._fx2, true);
				this._fx2 = null;
			}
			base.OnUnload();
		}

		protected override void Init()
		{
			base.Init();
			base.uiBehaviour.blockBtn.RegisterClickEventHandler(new ButtonClickEventHandler(this.OnClose));
		}

		protected override void OnShow()
		{
			base.OnShow();
			base.uiBehaviour.TweenGroup.ResetTween(true);
			base.uiBehaviour.TweenGroup.PlayTween(true);
			base.uiBehaviour.beforeSprite.SetSprite(base.uiBehaviour.beforeSprite.spriteName.Substring(0, base.uiBehaviour.beforeSprite.spriteName.Length - 1) + this.BeforeScore);
			base.uiBehaviour.afterSprite.SetSprite(base.uiBehaviour.afterSprite.spriteName.Substring(0, base.uiBehaviour.afterSprite.spriteName.Length - 1) + this.AfterScore);
			bool flag = this.BeforeScore < this.AfterScore;
			if (flag)
			{
				base.uiBehaviour.resultLabel.SetText(XSingleton<UiUtility>.singleton.ReplaceReturn(XStringDefineProxy.GetString("DailyTaskRefreshUp")));
			}
			else
			{
				bool flag2 = this.BeforeScore == this.AfterScore;
				if (flag2)
				{
					base.uiBehaviour.resultLabel.SetText(XSingleton<UiUtility>.singleton.ReplaceReturn(XStringDefineProxy.GetString("DailyTaskRefreshEqual")));
				}
				else
				{
					base.uiBehaviour.resultLabel.SetText(XSingleton<UiUtility>.singleton.ReplaceReturn(XStringDefineProxy.GetString("DailyTaskRefreshDown")));
				}
			}
			IXPositionGroup ixpositionGroup = base.uiBehaviour.transform.GetComponent("PositionGroup") as IXPositionGroup;
			this._fx1Token = XSingleton<XTimerMgr>.singleton.SetTimer(ixpositionGroup.GetGroup(0).x, new XTimerMgr.ElapsedEventHandler(this.DelayCreateFx), 1);
			this._fx2Token = XSingleton<XTimerMgr>.singleton.SetTimer(ixpositionGroup.GetGroup(1).x, new XTimerMgr.ElapsedEventHandler(this.DelayCreateFx), 2);
		}

		protected override void OnHide()
		{
			XSingleton<XTimerMgr>.singleton.KillTimer(this._fx1Token);
			XSingleton<XTimerMgr>.singleton.KillTimer(this._fx2Token);
			this._fx1Token = 0u;
			this._fx2Token = 0u;
			bool flag = this._fx1 != null;
			if (flag)
			{
				XSingleton<XFxMgr>.singleton.DestroyFx(this._fx1, true);
				this._fx1 = null;
			}
			bool flag2 = this._fx2 != null;
			if (flag2)
			{
				XSingleton<XFxMgr>.singleton.DestroyFx(this._fx2, true);
				this._fx2 = null;
			}
			base.OnHide();
		}

		private void DelayCreateFx(object o = null)
		{
			int num = (int)o;
			bool flag = num == 1;
			if (flag)
			{
				this._fx1 = XSingleton<XFxMgr>.singleton.CreateUIFx("Effects/FX_Particle/UIfx/UI_fptx_Clip01", base.uiBehaviour.m_FxDepth, false);
			}
			else
			{
				this._fx2 = XSingleton<XFxMgr>.singleton.CreateUIFx("Effects/FX_Particle/UIfx/UI_fptx_Clip02", base.uiBehaviour.m_FxDepth2, false);
			}
		}

		public override void StackRefresh()
		{
			base.StackRefresh();
		}

		private bool OnClose(IXUIButton uiSprite)
		{
			this.SetVisible(false, true);
			return true;
		}
	}
}