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
|
using System;
using System.Collections.Generic;
using MiniJSON;
using UILib;
using UnityEngine;
using XMainClient.UI;
using XMainClient.UI.UICommon;
using XUpdater;
using XUtliPoolLib;
namespace XMainClient
{
internal class AdditionRemindDocument : XDocComponent
{
public override uint ID
{
get
{
return AdditionRemindDocument.uuID;
}
}
public new static readonly uint uuID = XSingleton<XCommon>.singleton.XHash("AdditionRemindDocument");
private bool is3G = false;
private static bool is_3g_tip = false;
private string cacheString = null;
private int uploadtime = 0;
public uint loginday = 10u;
public bool gm_is_3g = false;
public int FREQUENCY = 0;
public int LOGINTIME = 0;
private float lasttime = 10f;
protected override void OnReconnected(XReconnectedEventArgs arg)
{
}
public override void OnAttachToHost(XObject host)
{
base.OnAttachToHost(host);
this.is3G = ((int)Application.internetReachability == 1);
}
public override void Update(float fDeltaT)
{
base.Update(fDeltaT);
bool flag = Time.time - this.lasttime > 5f;
if (flag)
{
this.Free3GTimer();
this.lasttime = Time.time;
}
}
public void OnRecieveAdditionTip(string msg)
{
this.cacheString = msg;
bool flag = XSingleton<XGame>.singleton.CurrentStage.Stage == EXStage.Hall;
if (flag)
{
this.ShowAddtionUI();
}
}
public void Free3GTimer()
{
bool flag = this.LOGINTIME <= 0;
if (flag)
{
this.LOGINTIME = XSingleton<XGlobalConfig>.singleton.GetInt("Free3GTime");
}
bool flag2 = this.FREQUENCY <= 0;
if (flag2)
{
this.FREQUENCY = XSingleton<XGlobalConfig>.singleton.GetInt("Free3GDay");
}
bool flag3 = Time.time > (float)this.LOGINTIME && (this.is3G || this.gm_is_3g) && !AdditionRemindDocument.is_3g_tip && (ulong)this.loginday >= (ulong)((long)this.FREQUENCY) && !XSingleton<XLoginDocument>.singleton.freeflow && !DlgBase<ModalDlg, ModalDlgBehaviour>.singleton.IsVisible() && !XSingleton<XTutorialMgr>.singleton.InTutorial && DlgBase<XMainInterface, XMainInterfaceBehaviour>.singleton.IsVisible();
if (flag3)
{
this.UpdateFreeState();
AdditionRemindDocument.is_3g_tip = true;
string @string = XStringDefineProxy.GetString("REM_3G");
XSingleton<UiUtility>.singleton.ShowModalDialog(@string, XStringDefineProxy.GetString("REM_BUY"), XStringDefineProxy.GetString("COMMON_CANCEL"), new ButtonClickEventHandler(this.Show3GFreeUI));
}
}
public void SetFreeflowTime(uint time)
{
this.loginday = ((uint)(DateTime.UtcNow - new DateTime(1970, 1, 1, 0, 0, 0, 0)).TotalSeconds - time) / 3600u;
}
private void UpdateFreeState()
{
PtcC2G_UpdateFreeflowHintInfo ptcC2G_UpdateFreeflowHintInfo = new PtcC2G_UpdateFreeflowHintInfo();
TimeSpan timeSpan = DateTime.UtcNow - new DateTime(1970, 1, 1, 0, 0, 0, 0);
ptcC2G_UpdateFreeflowHintInfo.Data.hint_time = (uint)timeSpan.TotalSeconds;
XSingleton<XClientNetwork>.singleton.Send(ptcC2G_UpdateFreeflowHintInfo);
}
private bool Show3GFreeUI(IXUIButton button)
{
this.Open3GWebPage();
DlgBase<ModalDlg, ModalDlgBehaviour>.singleton.SetVisible(false, true);
return true;
}
public void Open3GWebPage()
{
int num = (XSingleton<XLoginDocument>.singleton.Channel == XAuthorizationChannel.XAuthorization_QQ) ? 2 : 1;
string value = XSingleton<XGlobalConfig>.singleton.GetValue("SignalKey");
Dictionary<string, string> dictionary = new Dictionary<string, string>();
dictionary["url"] = string.Format(XSingleton<XGlobalConfig>.singleton.GetValue("SignalFreeUrl"), new object[]
{
XSingleton<XLoginDocument>.singleton.OpenID,
num,
XSingleton<XUpdater.XUpdater>.singleton.XPlatform.UserMd5(string.Concat(new object[]
{
XSingleton<XLoginDocument>.singleton.OpenID,
num,
XSingleton<UiUtility>.singleton.GetTimeStamp(),
"1231_LongZhiGuApp",
XSingleton<UiUtility>.singleton.Decrypt(value)
})).ToLower(),
XSingleton<UiUtility>.singleton.GetTimeStamp(),
"1231_LongZhiGuApp",
XSingleton<XLoginDocument>.singleton.TokenCache
});
dictionary["screendir"] = "SENSOR";
bool isEditor = Application.isEditor;
if (isEditor)
{
Application.OpenURL(dictionary["url"]);
}
else
{
XSingleton<XUpdater.XUpdater>.singleton.XPlatform.SendExtDara("open_url", Json.Serialize(dictionary));
}
}
public void ShowAddtionUI()
{
bool inTutorial = XSingleton<XTutorialMgr>.singleton.InTutorial;
if (!inTutorial)
{
bool flag = !string.IsNullOrEmpty(this.cacheString);
if (flag)
{
XSingleton<UiUtility>.singleton.ShowModalDialog(this.cacheString, XStringDefineProxy.GetString(XStringDefine.COMMON_OK));
}
this.cacheString = null;
}
}
public override void OnEnterSceneFinally()
{
base.OnEnterSceneFinally();
bool flag = XSingleton<XGame>.singleton.CurrentStage.Stage == EXStage.Hall;
if (flag)
{
this.ShowAddtionUI();
bool flag2 = this.uploadtime < 1;
if (flag2)
{
this.OnUploadUrl();
}
}
}
public override void OnDetachFromHost()
{
this.uploadtime = 0;
base.OnDetachFromHost();
}
public void OnUploadUrl()
{
bool flag = XSingleton<PDatabase>.singleton.playerInfo != null;
if (flag)
{
this.uploadtime++;
PtcC2G_PicUrlNtf ptcC2G_PicUrlNtf = new PtcC2G_PicUrlNtf();
bool flag2 = XSingleton<XLoginDocument>.singleton.Channel == XAuthorizationChannel.XAuthorization_QQ;
if (flag2)
{
ptcC2G_PicUrlNtf.Data.url = XSingleton<PDatabase>.singleton.playerInfo.data.pictureLarge;
}
else
{
ptcC2G_PicUrlNtf.Data.url = XSingleton<PDatabase>.singleton.playerInfo.data.pictureMiddle;
}
XSingleton<XClientNetwork>.singleton.Send(ptcC2G_PicUrlNtf);
}
}
}
}
|