summaryrefslogtreecommitdiff
path: root/Client/Assets/Scripts/XMainClient/mobaend.cs
blob: ad5e813d5c650392124b2f7cb0dc28607995ba55 (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
using System;
using System.Collections.Generic;
using KKSG;
using XMainClient.UI;
using XMainClient.UI.UICommon;
using XUtliPoolLib;

namespace XMainClient
{
	internal class mobaend
	{
		private static uint _token = 0u;

		private static bool _started = false;

		public static bool Do(List<XActor> actors)
		{
			bool flag = !mobaend._started;
			if (flag)
			{
				mobaend._started = true;
				mobaend.Start();
			}
			else
			{
				bool flag2 = !XSingleton<XCutScene>.singleton.IsPlaying;
				if (flag2)
				{
					mobaend._started = false;
					mobaend.End();
				}
			}
			return true;
		}

		private static void Start()
		{
			float interval = float.Parse(XSingleton<XGlobalConfig>.singleton.GetValue("MobaEndShowUITime"));
			mobaend._token = XSingleton<XTimerMgr>.singleton.SetTimer(interval, new XTimerMgr.ElapsedEventHandler(mobaend.ShowResult), null);
		}

		private static void ShowResult(object o = null)
		{
			DlgBase<MobaEndDlg, MobaBehaviour>.singleton.SetVisible(true, true);
			XLevelRewardDocument specificDocument = XDocuments.GetSpecificDocument<XLevelRewardDocument>(XLevelRewardDocument.uuID);
			DlgBase<MobaEndDlg, MobaBehaviour>.singleton.SetPic(specificDocument.MobaData.Result == HeroBattleOver.HeroBattleOver_Win);
		}

		private static void End()
		{
			XSingleton<XTimerMgr>.singleton.KillTimer(mobaend._token);
			DlgBase<MobaEndDlg, MobaBehaviour>.singleton.SetVisible(false, true);
			DlgBase<XLevelRewardView, XLevelRewardBehaviour>.singleton.CutSceneShowEnd();
		}
	}
}