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

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

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

		public bool ZeroRewardBtnState = false;

		public double ZeroRewardEndTime = 0.0;

		protected override void OnReconnected(XReconnectedEventArgs arg)
		{
		}

		public void DealWithIDIPMessage(IdipMessage info)
		{
			DlgBase<XCommonHelpTipView, XCommonHelpTipBehaviour>.singleton.ShowHelp(XStringDefineProxy.GetString("IDIPTitle"), info.message);
		}

		public void DealWithIDIPTips(IdipPunishInfo info)
		{
			string text = XSingleton<UiUtility>.singleton.TimeFormatSince1970(info.endTime, XStringDefineProxy.GetString("IDIP_TIPS_TIME"), true);
			string label;
			switch (info.type)
			{
			case 1:
			{
				string arg = XSingleton<UiUtility>.singleton.TimeDuarationFormatString(info.banTime, 5);
				label = string.Format(XStringDefineProxy.GetString("IDIP_TIPS_IDSEALED"), arg, text);
				goto IL_198;
			}
			case 2:
			{
				string arg = XSingleton<UiUtility>.singleton.TimeDuarationFormatString(info.banTime, 5);
				label = string.Format(XStringDefineProxy.GetString("IDIP_TIPS_SILENCE"), arg, text);
				goto IL_198;
			}
			case 4:
			case 5:
			case 6:
			case 7:
			case 8:
			case 9:
			case 11:
				label = string.Format(XStringDefineProxy.GetString("IDIP_TIPS_RANK"), text);
				goto IL_198;
			case 10:
				label = string.Format(XStringDefineProxy.GetString("IDIP_TIPS_GUILDRANK"), text);
				goto IL_198;
			case 12:
			{
				bool flag = info.leftTime == 0;
				if (flag)
				{
					this.ZeroRewardBtnState = false;
					DlgBase<XMainInterface, XMainInterfaceBehaviour>.singleton.RefreshH5ButtonState(XSysDefine.XSys_IDIP_ZeroReward, true);
					return;
				}
				label = string.Format(XStringDefineProxy.GetString("IDIP_TIPS_ZEROREWARD"), text);
				this.ZeroRewardEndTime = (double)info.leftTime + this.GetNowTime();
				this.ZeroRewardBtnState = true;
				DlgBase<XMainInterface, XMainInterfaceBehaviour>.singleton.RefreshH5ButtonState(XSysDefine.XSys_IDIP_ZeroReward, true);
				goto IL_198;
			}
			case 13:
			case 14:
				label = string.Format(XStringDefineProxy.GetString("IDIP_TIPS_PLAY"), text);
				goto IL_198;
			}
			XSingleton<XDebug>.singleton.AddLog("Undefine IDIP Tips type.", info.type.ToString(), null, null, null, null, XDebugColor.XDebug_None);
			return;
			IL_198:
			XSingleton<UiUtility>.singleton.ShowModalDialog(label, XStringDefineProxy.GetString("COMMON_OK"));
		}

		private double GetNowTime()
		{
			return (double)(DateTime.Now.Ticks / 10000000L);
		}

		public string GetLeftTimeString()
		{
			int num = (int)(this.ZeroRewardEndTime - this.GetNowTime());
			bool flag = num < 0;
			string result;
			if (flag)
			{
				result = "0";
			}
			else
			{
				result = XSingleton<UiUtility>.singleton.TimeDuarationFormatString(num, 5);
			}
			return result;
		}
	}
}