diff options
author | chai <chaifix@163.com> | 2021-01-25 14:28:30 +0800 |
---|---|---|
committer | chai <chaifix@163.com> | 2021-01-25 14:28:30 +0800 |
commit | 6eb915c129fc90c6f4c82ae097dd6ffad5239efc (patch) | |
tree | 7dd2be50edf41f36b60fac84696e731c13afe617 /Client/Assets/Scripts/XMainClient/UI/GameCommunityHandler.cs |
+scripts
Diffstat (limited to 'Client/Assets/Scripts/XMainClient/UI/GameCommunityHandler.cs')
-rw-r--r-- | Client/Assets/Scripts/XMainClient/UI/GameCommunityHandler.cs | 358 |
1 files changed, 358 insertions, 0 deletions
diff --git a/Client/Assets/Scripts/XMainClient/UI/GameCommunityHandler.cs b/Client/Assets/Scripts/XMainClient/UI/GameCommunityHandler.cs new file mode 100644 index 00000000..1433a267 --- /dev/null +++ b/Client/Assets/Scripts/XMainClient/UI/GameCommunityHandler.cs @@ -0,0 +1,358 @@ +using System;
+using System.Collections.Generic;
+using KKSG;
+using MiniJSON;
+using UILib;
+using UnityEngine;
+using XMainClient.UI.UICommon;
+using XUpdater;
+using XUtliPoolLib;
+
+namespace XMainClient.UI
+{
+ internal class GameCommunityHandler : DlgHandlerBase
+ {
+ protected override string FileName
+ {
+ get
+ {
+ return "GameSystem/GameCommunityDlg";
+ }
+ }
+
+ private XMainInterfaceDocument _doc = null;
+
+ private int _bgWidthDelta;
+
+ private bool _widthInit = false;
+
+ public IXUISprite m_Bg;
+
+ public Transform m_SystemParent;
+
+ protected override void Init()
+ {
+ base.Init();
+ this._doc = XDocuments.GetSpecificDocument<XMainInterfaceDocument>(XMainInterfaceDocument.uuID);
+ this.m_Bg = (base.transform.Find("Bg/Bg").GetComponent("XUISprite") as IXUISprite);
+ this.m_SystemParent = base.transform.Find("Bg/Sys");
+ XSingleton<XChatIFlyMgr>.singleton.RefreshWebViewConfig();
+ }
+
+ protected override void OnShow()
+ {
+ base.OnShow();
+ bool flag = XSingleton<XLoginDocument>.singleton.Channel == XAuthorizationChannel.XAuthorization_QQ;
+ int num = 0;
+ int num2 = 0;
+ for (int i = 0; i < this._doc.GameCommunityReader.Table.Length; i++)
+ {
+ GameCommunityTable.RowData rowData = this._doc.GameCommunityReader.Table[i];
+ IXUIButton ixuibutton = this.m_SystemParent.Find(rowData.ButtonName).GetComponent("XUIButton") as IXUIButton;
+ ixuibutton.SetVisible(false);
+ GameObject gameObject = ixuibutton.gameObject.transform.Find("RedPoint").gameObject;
+ bool flag2 = i == 0;
+ if (flag2)
+ {
+ num2 = ixuibutton.spriteWidth;
+ bool flag3 = !this._widthInit;
+ if (flag3)
+ {
+ this._widthInit = true;
+ this._bgWidthDelta = this.m_Bg.spriteWidth - num2;
+ }
+ }
+ bool flag4 = (ulong)XSingleton<XAttributeMgr>.singleton.XPlayerData.Level < (ulong)((long)rowData.OpenLevel);
+ if (!flag4)
+ {
+ bool flag5 = !XSingleton<XGameSysMgr>.singleton.IsSystemOpened((XSysDefine)rowData.SysID);
+ if (!flag5)
+ {
+ bool flag6 = !this.LoginStateTrue(rowData);
+ if (!flag6)
+ {
+ bool flag7 = rowData.ID == 13;
+ if (flag7)
+ {
+ bool flag8 = this.IsSuportReplay();
+ if (flag8)
+ {
+ ixuibutton.SetVisible(true);
+ ixuibutton.gameObject.transform.localPosition = new Vector3((float)(num * num2), 0f);
+ ixuibutton.ID = (ulong)((long)rowData.ID);
+ ixuibutton.RegisterClickEventHandler(new ButtonClickEventHandler(this.OnSysBtnClick));
+ num++;
+ }
+ }
+ else
+ {
+ bool flag9 = rowData.ID == 12;
+ if (flag9)
+ {
+ bool flag10 = this.GetQuestionnaireStage() == 0;
+ if (!flag10)
+ {
+ ixuibutton.SetVisible(true);
+ ixuibutton.gameObject.transform.localPosition = new Vector3((float)(num * num2), 0f);
+ ixuibutton.ID = (ulong)((long)rowData.ID);
+ ixuibutton.RegisterClickEventHandler(new ButtonClickEventHandler(this.OnSysBtnClick));
+ num++;
+ gameObject.SetActive(XSingleton<XGameSysMgr>.singleton.GetSysRedPointStateConsiderBlock(XSysDefine.XSys_Questionnaire));
+ }
+ }
+ else
+ {
+ bool flag11 = rowData.ID == 14;
+ if (flag11)
+ {
+ XSingleton<XDebug>.singleton.AddLog("Is show tv: ", this._doc.ShowWebView.ToString(), null, null, null, null, XDebugColor.XDebug_None);
+ bool flag12 = SystemInfo.processorType.StartsWith("Intel");
+ int num3 = int.Parse(XSingleton<XGlobalConfig>.singleton.GetValue("HideWebView"));
+ bool flag13 = SystemInfo.systemMemorySize >= XSingleton<XGlobalConfig>.singleton.GetInt("WebMemory");
+ XSingleton<XDebug>.singleton.AddLog("memory: ", flag13.ToString(), " x86: ", flag12.ToString(), " hide: ", num3.ToString(), XDebugColor.XDebug_None);
+ bool flag14 = this._doc.ShowWebView && num3 != 1 && !flag12 && flag13;
+ ixuibutton.SetVisible(flag14);
+ bool flag15 = flag14;
+ if (flag15)
+ {
+ ixuibutton.gameObject.transform.localPosition = new Vector3((float)(num * num2), 0f);
+ ixuibutton.RegisterClickEventHandler(new ButtonClickEventHandler(this.OnSysBtnClick));
+ num++;
+ ixuibutton.ID = (ulong)((long)rowData.ID);
+ }
+ }
+ else
+ {
+ bool flag16 = rowData.ID == 8 && (XSingleton<XLoginDocument>.singleton.GetLaunchTypeServerInfo() != StartUpType.StartUp_QQ || XSingleton<XLoginDocument>.singleton.Channel != XAuthorizationChannel.XAuthorization_QQ);
+ if (!flag16)
+ {
+ bool flag17 = rowData.ID == 9 && (XSingleton<XLoginDocument>.singleton.GetLaunchTypeServerInfo() != StartUpType.StartUp_WX || XSingleton<XLoginDocument>.singleton.Channel != XAuthorizationChannel.XAuthorization_WeChat);
+ if (!flag17)
+ {
+ ixuibutton.SetVisible(true);
+ ixuibutton.gameObject.transform.localPosition = new Vector3((float)(num * num2), 0f);
+ ixuibutton.ID = (ulong)((long)rowData.ID);
+ ixuibutton.RegisterClickEventHandler(new ButtonClickEventHandler(this.OnSysBtnClick));
+ num++;
+ gameObject.SetActive(XSingleton<XGameSysMgr>.singleton.GetSysRedPointStateConsiderBlock((XSysDefine)rowData.SysID));
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ this.m_Bg.spriteWidth = this._bgWidthDelta + num * num2;
+ }
+
+ private bool OnSysBtnClick(IXUIButton btn)
+ {
+ Dictionary<string, string> dictionary = new Dictionary<string, string>();
+ ulong id = btn.ID;
+ ulong num = id - 1UL;
+ if (num <= 15UL)
+ {
+ switch ((uint)num)
+ {
+ case 0u:
+ {
+ PtcC2G_CloseHintNtf ptcC2G_CloseHintNtf = new PtcC2G_CloseHintNtf();
+ ptcC2G_CloseHintNtf.Data.systemid = (uint)XFastEnumIntEqualityComparer<XSysDefine>.ToInt(XSysDefine.XSys_GC_XinYueVIP);
+ XSingleton<XClientNetwork>.singleton.Send(ptcC2G_CloseHintNtf);
+ XSingleton<XGameSysMgr>.singleton.SetSysRedPointState(XSysDefine.XSys_GC_XinYueVIP, false);
+ XSingleton<XGameSysMgr>.singleton.RecalculateRedPointState(XSysDefine.XSys_GameCommunity, true);
+ GameObject gameObject = btn.gameObject.transform.Find("RedPoint").gameObject;
+ gameObject.SetActive(false);
+ string text = string.Format("{0}?game_id={1}&opencode={2}&partition_id={3}&role_id={4}", new object[]
+ {
+ XSingleton<XGlobalConfig>.singleton.GetValue("XinYueInternalURL"),
+ XSingleton<XClientNetwork>.singleton.GameId,
+ XSingleton<XClientNetwork>.singleton.OpenCode,
+ XSingleton<XClientNetwork>.singleton.ServerID,
+ XSingleton<XAttributeMgr>.singleton.XPlayerData.RoleID
+ });
+ XSingleton<XDebug>.singleton.AddLog("url = " + text, null, null, null, null, null, XDebugColor.XDebug_None);
+ dictionary["url"] = text;
+ dictionary["screendir"] = "SENSOR";
+ XSingleton<XUpdater.XUpdater>.singleton.XPlatform.SendExtDara("open_url", Json.Serialize(dictionary));
+ break;
+ }
+ case 6u:
+ XSingleton<UiUtility>.singleton.OpenHtmlUrl("DeepLinkAddress");
+ break;
+ case 7u:
+ case 8u:
+ DlgBase<XQQWXGameCenterPrivilegeView, XQQWXGameCenterPrivilegeBehaviour>.singleton.SetVisibleWithAnimation(true, null);
+ break;
+ case 9u:
+ {
+ string text = string.Format("{0}?partition={1}&roleid={2}&area={3}&algorithm={4}&version={5}×tamp={6}&appid={7}&openid={8}&sig={9}&encode={10}", new object[]
+ {
+ XSingleton<XGlobalConfig>.singleton.GetValue("MicroCommunityURL"),
+ XSingleton<XClientNetwork>.singleton.ServerID,
+ XSingleton<XAttributeMgr>.singleton.XPlayerData.RoleID,
+ XSingleton<XClientNetwork>.singleton.AreaId,
+ "v2",
+ XSingleton<XUpdater.XUpdater>.singleton.Version,
+ XSingleton<UiUtility>.singleton.GetTimeStamp(),
+ XSingleton<XClientNetwork>.singleton.AppId,
+ XSingleton<XLoginDocument>.singleton.OpenID,
+ XSingleton<XUpdater.XUpdater>.singleton.XPlatform.GetMD5(string.Format("{0}{1}", XSingleton<XClientNetwork>.singleton.MSDKKey, XSingleton<UiUtility>.singleton.GetTimeStamp())),
+ "2"
+ });
+ XSingleton<XDebug>.singleton.AddLog("url = " + text, null, null, null, null, null, XDebugColor.XDebug_None);
+ dictionary["url"] = text;
+ dictionary["screendir"] = "SENSOR";
+ XSingleton<XUpdater.XUpdater>.singleton.XPlatform.SendExtDara("open_url", Json.Serialize(dictionary));
+ break;
+ }
+ case 10u:
+ XSingleton<UiUtility>.singleton.OpenHtmlUrl("HordeInsideAddress");
+ break;
+ case 11u:
+ {
+ PtcC2G_CancelRedDotReq ptcC2G_CancelRedDotReq = new PtcC2G_CancelRedDotReq();
+ ptcC2G_CancelRedDotReq.Data.systemid = (uint)XFastEnumIntEqualityComparer<XSysDefine>.ToInt(XSysDefine.XSys_Questionnaire);
+ XSingleton<XClientNetwork>.singleton.Send(ptcC2G_CancelRedDotReq);
+ XSingleton<XGameSysMgr>.singleton.SetSysRedPointState(XSysDefine.XSys_Questionnaire, false);
+ XSingleton<XGameSysMgr>.singleton.RecalculateRedPointState(XSysDefine.XSys_GameCommunity, true);
+ GameObject gameObject2 = btn.gameObject.transform.Find("RedPoint").gameObject;
+ gameObject2.SetActive(false);
+ int questionnaireStage = this.GetQuestionnaireStage();
+ dictionary["url"] = XSingleton<XGlobalConfig>.singleton.GetValue(string.Format("QuestionnaireUrl{0}", questionnaireStage));
+ dictionary["screendir"] = "SENSOR";
+ XSingleton<XUpdater.XUpdater>.singleton.XPlatform.SendExtDara("open_url", Json.Serialize(dictionary));
+ break;
+ }
+ case 12u:
+ this.OnReplayClick(btn);
+ break;
+ case 13u:
+ DlgBase<WebView, WebViewBehaviour>.singleton.SetVisible(true, true);
+ break;
+ case 14u:
+ {
+ XSingleton<UiUtility>.singleton.CloseSysAndNoticeServer((uint)XFastEnumIntEqualityComparer<XSysDefine>.ToInt(XSysDefine.XSys_GC_XiaoYueGuanJia));
+ btn.gameObject.transform.Find("RedPoint").gameObject.SetActive(false);
+ string text2 = ((int)Application.platform == 11) ? "1" : "0";
+ string text = string.Format("{0}?game_id={1}&opencode={2}&sig={3}×tamp={4}&role_id={5}&partition_id={6}&plat_id={7}", new object[]
+ {
+ XSingleton<XGlobalConfig>.singleton.GetValue("XiaoYueUrl"),
+ XSingleton<XGlobalConfig>.singleton.GetValue("XiaoYueGameID"),
+ XSingleton<XClientNetwork>.singleton.OpenCode,
+ XSingleton<XUpdater.XUpdater>.singleton.XPlatform.GetMD5(string.Format("{0}{1}", XSingleton<XClientNetwork>.singleton.MSDKKey, XSingleton<UiUtility>.singleton.GetTimeStamp())),
+ XSingleton<UiUtility>.singleton.GetTimeStamp(),
+ XSingleton<UiUtility>.singleton.GetRoleId(),
+ XSingleton<XClientNetwork>.singleton.ServerID,
+ text2
+ });
+ XSingleton<XDebug>.singleton.AddLog("url = " + text, null, null, null, null, null, XDebugColor.XDebug_None);
+ dictionary["url"] = text;
+ dictionary["screendir"] = "SENSOR";
+ XSingleton<XUpdater.XUpdater>.singleton.XPlatform.SendExtDara("open_url", Json.Serialize(dictionary));
+ break;
+ }
+ case 15u:
+ XSingleton<UiUtility>.singleton.OpenHtmlUrl("LibaozhongxinUrl");
+ break;
+ }
+ }
+ return true;
+ }
+
+ private bool LoginStateTrue(GameCommunityTable.RowData data)
+ {
+ bool flag = (int)Application.platform == 7 || Application.platform == 0;
+ bool result;
+ if (flag)
+ {
+ result = true;
+ }
+ else
+ {
+ switch (XSingleton<XLoginDocument>.singleton.Channel)
+ {
+ case XAuthorizationChannel.XAuthorization_QQ:
+ result = data.QQ;
+ break;
+ case XAuthorizationChannel.XAuthorization_WeChat:
+ result = data.WX;
+ break;
+ case XAuthorizationChannel.XAuthorization_Guest:
+ result = data.YK;
+ break;
+ default:
+ result = false;
+ break;
+ }
+ }
+ return result;
+ }
+
+ public bool IsSuportReplay()
+ {
+ bool flag = (int)Application.platform == 8;
+ return flag && !this.isIpadMode() && XSingleton<XUpdater.XUpdater>.singleton.XPlatform.CheckStatus("is_screen_record_available", "");
+ }
+
+ private bool isIpadMode()
+ {
+ return false;
+ }
+
+ private bool OnReplayClick(IXUIButton btn)
+ {
+ bool flag = DlgBase<ReplaykitDlg, ReplayBehaviour>.singleton.isPlaying || DlgBase<ReplaykitDlg, ReplayBehaviour>.singleton.isReadyPlaying;
+ if (flag)
+ {
+ XSingleton<XDebug>.singleton.AddLog("Close Replay..", null, null, null, null, null, XDebugColor.XDebug_None);
+ DlgBase<ReplaykitDlg, ReplayBehaviour>.singleton.OnStopClick(null);
+ }
+ else
+ {
+ bool isBroadcast = DlgBase<BroadMiniDlg, BroadcastMiniBehaviour>.singleton.isBroadcast;
+ if (isBroadcast)
+ {
+ XSingleton<XDebug>.singleton.AddLog("replay isBroadcasting", null, null, null, null, null, XDebugColor.XDebug_None);
+ XSingleton<UiUtility>.singleton.ShowSystemTip(XStringDefineProxy.GetString("Replay_IsBroadcasting"), "fece00");
+ }
+ else
+ {
+ bool flag2 = XSingleton<XUpdater.XUpdater>.singleton.XPlatform.CheckStatus("is_broadcasting", "");
+ XSingleton<XDebug>.singleton.AddLog("open: ", flag2.ToString(), null, null, null, null, XDebugColor.XDebug_None);
+ bool flag3 = !flag2;
+ if (flag3)
+ {
+ DlgBase<ReplaykitDlg, ReplayBehaviour>.singleton.OpenRepaly();
+ }
+ else
+ {
+ bool flag4 = (int) Application.platform == 7;
+ if (flag4)
+ {
+ DlgBase<ReplaykitDlg, ReplayBehaviour>.singleton.Show(true);
+ }
+ }
+ }
+ }
+ return true;
+ }
+
+ private int GetQuestionnaireStage()
+ {
+ uint level = XSingleton<XAttributeMgr>.singleton.XPlayerData.Level;
+ SeqList<int> sequenceList = XSingleton<XGlobalConfig>.singleton.GetSequenceList("QuestionnaireLevel", true);
+ for (int i = 0; i < (int)sequenceList.Count; i++)
+ {
+ bool flag = (ulong)level >= (ulong)((long)sequenceList[i, 0]) && (ulong)level <= (ulong)((long)sequenceList[i, 1]);
+ if (flag)
+ {
+ return i + 1;
+ }
+ }
+ return 0;
+ }
+ }
+}
|