summaryrefslogtreecommitdiff
path: root/Client/Assets/Scripts/XMainClient/DungeonShareView.cs
blob: ff9e06b5c504c59b0a72b26cbc96207b7c6cfb45 (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
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
using System;
using UILib;
using XMainClient.UI;
using XMainClient.UI.UICommon;
using XUtliPoolLib;

namespace XMainClient
{
	internal class DungeonShareView : DlgBase<DungeonShareView, DungeonShareBehavior>
	{
		public override string fileName
		{
			get
			{
				return "Battle/DungeonShareDlg";
			}
		}

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

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

		private uint _token;

		private bool _hideMaqueeView = false;

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

		protected override void OnUnload()
		{
			this.ResetTimer();
			base.OnUnload();
		}

		protected override void Init()
		{
			base.Init();
			this.InitProperties();
		}

		protected override void OnHide()
		{
			this.ResetTimer();
			XScreenShotShareDocument specificDocument = XDocuments.GetSpecificDocument<XScreenShotShareDocument>(XScreenShotShareDocument.uuID);
			specificDocument.SpriteID = 0u;
			specificDocument.CurShareBgType = ShareBgType.NoneType;
			bool flag = this._hideMaqueeView && DlgBase<XChatMaqueeView, XChatMaqueeBehaviour>.singleton.IsLoaded();
			if (flag)
			{
				this._hideMaqueeView = false;
				DlgBase<XChatMaqueeView, XChatMaqueeBehaviour>.singleton.SetAlpha(1f);
			}
			base.OnHide();
		}

		private void ResetTimer()
		{
			bool flag = this._token > 0u;
			if (flag)
			{
				XSingleton<XTimerMgr>.singleton.KillTimer(this._token);
			}
			this._token = 0u;
		}

		protected override void OnShow()
		{
			base.OnShow();
			base.uiBehaviour._shareBtn.SetAlpha(1f);
			base.uiBehaviour._closeBtn.gameObject.SetActive(true);
			base.uiBehaviour._firstLabel.gameObject.SetActive(true);
			this.ResetPlatformShareBtnState();
			this.RefreshShareContent();
			this.RefreshPersonalInfo();
		}

		private void InitProperties()
		{
			base.uiBehaviour._shareBtn.RegisterClickEventHandler(new ButtonClickEventHandler(this.OnClickShareBtn));
			base.uiBehaviour._wechat_SpecialTarget.RegisterClickEventHandler(new ButtonClickEventHandler(this.OnclickWcSpecialShare));
			base.uiBehaviour._wechat_ZoneTarget.RegisterClickEventHandler(new ButtonClickEventHandler(this.OnclickWcZoneShare));
			base.uiBehaviour._QQ_specialTarget.RegisterClickEventHandler(new ButtonClickEventHandler(this.OnclickQQSpecialShare));
			base.uiBehaviour._QQ_ZoneTarget.RegisterClickEventHandler(new ButtonClickEventHandler(this.OnclickQQZoneShare));
			base.uiBehaviour._closeBtn.RegisterClickEventHandler(new ButtonClickEventHandler(this.OnclickClose));
			base.uiBehaviour._noteLabel.SetText("");
		}

		private bool OnclickClose(IXUIButton button)
		{
			this.ResetData();
			this.SetVisibleWithAnimation(false, null);
			bool flag = DlgBase<SpriteSystemDlg, TabDlgBehaviour>.singleton.IsVisible();
			if (flag)
			{
				DlgBase<SpriteSystemDlg, TabDlgBehaviour>.singleton.RefreshTopUI();
			}
			return true;
		}

		private bool OnclickQQZoneShare(IXUIButton button)
		{
			XSingleton<XScreenShotMgr>.singleton.SendStatisticToServer(ShareOpType.Share, DragonShareType.DungeonShare);
			XSingleton<XScreenShotMgr>.singleton.ShareScreen(false);
			this.SetVisible(false, true);
			return true;
		}

		private bool OnclickQQSpecialShare(IXUIButton button)
		{
			XSingleton<XScreenShotMgr>.singleton.SendStatisticToServer(ShareOpType.Share, DragonShareType.DungeonShare);
			XSingleton<XScreenShotMgr>.singleton.ShareScreen(true);
			this.SetVisible(false, true);
			return true;
		}

		private bool OnclickWcZoneShare(IXUIButton button)
		{
			XSingleton<XScreenShotMgr>.singleton.SendStatisticToServer(ShareOpType.Share, DragonShareType.DungeonShare);
			XSingleton<XScreenShotMgr>.singleton.ShareScreen(false);
			this.SetVisible(false, true);
			return true;
		}

		private bool OnclickWcSpecialShare(IXUIButton button)
		{
			XSingleton<XScreenShotMgr>.singleton.SendStatisticToServer(ShareOpType.Share, DragonShareType.DungeonShare);
			XSingleton<XScreenShotMgr>.singleton.ShareScreen(true);
			this.SetVisible(false, true);
			return true;
		}

		private bool OnClickShareBtn(IXUIButton button)
		{
			bool flag = XSingleton<UiUtility>.singleton.CheckPlatfomStatus();
			if (flag)
			{
				base.uiBehaviour._wechatShare.gameObject.SetActive(false);
				base.uiBehaviour._QQShare.gameObject.SetActive(false);
				base.uiBehaviour._shareBtn.SetAlpha(0f);
				base.uiBehaviour._closeBtn.gameObject.SetActive(false);
				bool flag2 = DlgBase<XChatMaqueeView, XChatMaqueeBehaviour>.singleton.IsVisible();
				if (flag2)
				{
					DlgBase<XChatMaqueeView, XChatMaqueeBehaviour>.singleton.SetAlpha(0f);
					this._hideMaqueeView = true;
				}
				base.uiBehaviour._firstLabel.gameObject.SetActive(false);
				this._token = XSingleton<XTimerMgr>.singleton.SetTimer(0.2f, new XTimerMgr.ElapsedEventHandler(this.ResetShareBtn), null);
				XSingleton<XScreenShotMgr>.singleton.CaptureScreenshot(null);
			}
			return true;
		}

		private void ResetShareBtn(object param)
		{
			base.uiBehaviour._shareBtn.SetAlpha(1f);
			base.uiBehaviour._closeBtn.gameObject.SetActive(true);
			base.uiBehaviour._firstLabel.gameObject.SetActive(true);
			bool flag = this._hideMaqueeView && DlgBase<XChatMaqueeView, XChatMaqueeBehaviour>.singleton.IsLoaded();
			if (flag)
			{
				this._hideMaqueeView = false;
				DlgBase<XChatMaqueeView, XChatMaqueeBehaviour>.singleton.SetAlpha(1f);
			}
			this.RefreshPlatformShareBtnState();
			this._token = 0u;
		}

		private void RefreshPlatformShareBtnState()
		{
			base.uiBehaviour._QQShare.gameObject.SetActive(XSingleton<XLoginDocument>.singleton.Channel == XAuthorizationChannel.XAuthorization_QQ);
			base.uiBehaviour._QQ_ZoneTarget.gameObject.SetActive(XSingleton<XLoginDocument>.singleton.Channel == XAuthorizationChannel.XAuthorization_QQ);
			base.uiBehaviour._QQ_specialTarget.gameObject.SetActive(XSingleton<XLoginDocument>.singleton.Channel == XAuthorizationChannel.XAuthorization_QQ);
			base.uiBehaviour._wechatShare.gameObject.SetActive(XSingleton<XLoginDocument>.singleton.Channel == XAuthorizationChannel.XAuthorization_WeChat);
			base.uiBehaviour._wechat_SpecialTarget.gameObject.SetActive(XSingleton<XLoginDocument>.singleton.Channel == XAuthorizationChannel.XAuthorization_WeChat);
			base.uiBehaviour._wechat_ZoneTarget.gameObject.SetActive(XSingleton<XLoginDocument>.singleton.Channel == XAuthorizationChannel.XAuthorization_WeChat);
		}

		private void ResetPlatformShareBtnState()
		{
			base.uiBehaviour._logoQQ.gameObject.SetActive(XSingleton<XLoginDocument>.singleton.Channel == XAuthorizationChannel.XAuthorization_QQ);
			base.uiBehaviour._logoWechat.gameObject.SetActive(XSingleton<XLoginDocument>.singleton.Channel == XAuthorizationChannel.XAuthorization_WeChat);
			base.uiBehaviour._wechatShare.gameObject.SetActive(false);
			base.uiBehaviour._QQShare.gameObject.SetActive(false);
		}

		private void RefreshSharePlatform()
		{
			bool flag = XSingleton<XLoginDocument>.singleton.Channel == XAuthorizationChannel.XAuthorization_QQ;
			if (flag)
			{
				base.uiBehaviour._QQShare.gameObject.SetActive(true);
				base.uiBehaviour._logoQQ.gameObject.SetActive(true);
				base.uiBehaviour._logoWechat.gameObject.SetActive(false);
				base.uiBehaviour._wechatShare.gameObject.SetActive(false);
			}
			else
			{
				bool flag2 = XSingleton<XLoginDocument>.singleton.Channel == XAuthorizationChannel.XAuthorization_WeChat;
				if (flag2)
				{
					base.uiBehaviour._wechatShare.gameObject.SetActive(true);
					base.uiBehaviour._logoWechat.gameObject.SetActive(true);
					base.uiBehaviour._logoQQ.gameObject.SetActive(false);
					base.uiBehaviour._QQShare.gameObject.SetActive(false);
				}
			}
		}

		private void RefreshPersonalInfo()
		{
			base.uiBehaviour._nameLabel.SetText(XSingleton<XAttributeMgr>.singleton.XPlayerData.Name);
			base.uiBehaviour._serverLabel.SetText(XSingleton<XClientNetwork>.singleton.Server);
		}

		private void RefreshShareContent()
		{
			XScreenShotShareDocument specificDocument = XDocuments.GetSpecificDocument<XScreenShotShareDocument>(XScreenShotShareDocument.uuID);
			XTuple<string, string> shareBgTexturePath = specificDocument.GetShareBgTexturePath();
			bool flag = !string.IsNullOrEmpty(shareBgTexturePath.Item1);
			if (flag)
			{
				base.uiBehaviour._bgTexture.SetTexturePath("atlas/UI/common/Pic/" + shareBgTexturePath.Item1);
			}
			XAchievementDocument specificDocument2 = XDocuments.GetSpecificDocument<XAchievementDocument>(XAchievementDocument.uuID);
			bool flag2 = specificDocument2.FirstPassSceneID != 0u && specificDocument.CurShareBgType == ShareBgType.DungeonType;
			if (flag2)
			{
				base.uiBehaviour._bgText.gameObject.SetActive(true);
				base.uiBehaviour._bgText.SetSprite(shareBgTexturePath.Item2);
				base.uiBehaviour._firstLabel.gameObject.SetActive(true);
			}
			else
			{
				base.uiBehaviour._bgText.gameObject.SetActive(false);
			}
		}

		private void ResetData()
		{
			XAchievementDocument specificDocument = XDocuments.GetSpecificDocument<XAchievementDocument>(XAchievementDocument.uuID);
			specificDocument.FirstPassSceneID = 0u;
			XScreenShotShareDocument specificDocument2 = XDocuments.GetSpecificDocument<XScreenShotShareDocument>(XScreenShotShareDocument.uuID);
			specificDocument2.SpriteID = 0u;
			specificDocument2.CurShareBgType = ShareBgType.NoneType;
		}

		public void RefreshShareResult(string result)
		{
		}
	}
}