From 6eb915c129fc90c6f4c82ae097dd6ffad5239efc Mon Sep 17 00:00:00 2001 From: chai Date: Mon, 25 Jan 2021 14:28:30 +0800 Subject: +scripts --- .../Scripts/XMainClient/XPandoraSDKDocument.cs | 448 +++++++++++++++++++++ 1 file changed, 448 insertions(+) create mode 100644 Client/Assets/Scripts/XMainClient/XPandoraSDKDocument.cs (limited to 'Client/Assets/Scripts/XMainClient/XPandoraSDKDocument.cs') diff --git a/Client/Assets/Scripts/XMainClient/XPandoraSDKDocument.cs b/Client/Assets/Scripts/XMainClient/XPandoraSDKDocument.cs new file mode 100644 index 00000000..51eb45b5 --- /dev/null +++ b/Client/Assets/Scripts/XMainClient/XPandoraSDKDocument.cs @@ -0,0 +1,448 @@ +using System; +using System.Collections.Generic; +using KKSG; +using MiniJSON; +using UnityEngine; +using XMainClient.UI.UICommon; +using XUpdater; +using XUtliPoolLib; + +namespace XMainClient +{ + internal class XPandoraSDKDocument : XSingleton + { + private bool hasLogin = false; + + public void PandoraLogin() + { + XSingleton.singleton.AddLog("XPandoraMgr try login", null, null, null, null, null, XDebugColor.XDebug_None); + bool flag = !XSingleton.singleton.IsSystemOpened(XSysDefine.XSys_PandoraSDK); + if (!flag) + { + bool flag2 = XSingleton.singleton.XPandoraManager == null; + if (flag2) + { + XSingleton.singleton.AddErrorLog("XPandoraMgr Component missing", null, null, null, null, null); + } + else + { + bool flag3 = XSingleton.singleton.XPlayerData == null; + if (!flag3) + { + int @int = XSingleton.singleton.GetInt("PandoraSDKUseHttps"); + XSingleton.singleton.AddLog("XPandoraMgr https = " + @int, null, null, null, null, null, XDebugColor.XDebug_None); + XSingleton.singleton.XPandoraManager.SetUseHttps(@int); + XSingleton.singleton.AddGreenLog("PandoraLogin--------------------------------------------", null, null, null, null, null); + string acctype = "test"; + bool flag4 = XSingleton.singleton.AccountType == LoginType.LOGIN_QQ_PF; + if (flag4) + { + acctype = "qq"; + } + else + { + bool flag5 = XSingleton.singleton.AccountType == LoginType.LGOIN_WECHAT_PF; + if (flag5) + { + acctype = "wx"; + } + } + string payToken = "test"; + string payBill = XSingleton.singleton.XPlatform.GetPayBill(); + bool flag6 = payBill != ""; + if (flag6) + { + Dictionary dictionary = Json.Deserialize(payBill) as Dictionary; + bool flag7 = dictionary != null; + if (flag7) + { + object obj; + bool flag8 = dictionary.TryGetValue("pay_token", out obj); + if (flag8) + { + payToken = obj.ToString(); + } + } + } + string platID = ""; + bool flag9 = XSingleton.singleton.XPlatform.Platfrom() == XPlatformType.Android; + if (flag9) + { + platID = "1"; + } + else + { + bool flag10 = XSingleton.singleton.XPlatform.Platfrom() == XPlatformType.IOS; + if (flag10) + { + platID = "0"; + } + } + XSingleton.singleton.XPandoraManager.PandoraLogin(XSingleton.singleton.OpenID, acctype, XSingleton.singleton.AreaId, XSingleton.singleton.ServerID.ToString(), XSingleton.singleton.AppId, XSingleton.singleton.XPlayerData.RoleID.ToString(), XSingleton.singleton.TokenCache, payToken, XSingleton.singleton.Version, platID); + this.hasLogin = true; + } + } + } + } + + public void PandoraLogout() + { + XSingleton.singleton.AddLog("PandoraLogout", null, null, null, null, null, XDebugColor.XDebug_None); + bool flag = this.hasLogin; + if (flag) + { + bool flag2 = XSingleton.singleton.XPandoraManager == null; + if (!flag2) + { + XSingleton.singleton.AddGreenLog("PandoraLogout--------------------------------------------", null, null, null, null, null); + XSingleton.singleton.XPandoraManager.PandoraLogout(); + this.hasLogin = false; + } + } + } + + public void CheckPandoraPLPanel() + { + XSingleton.singleton.AddLog("PandoraSDK CheckPandoraPLPanel", null, null, null, null, null, XDebugColor.XDebug_None); + bool flag = !XSingleton.singleton.IsSystemOpened(XSysDefine.XSys_PandoraSDK); + if (!flag) + { + bool flag2 = XSingleton.singleton.XPandoraManager == null; + if (!flag2) + { + bool flag3 = XSingleton.singleton.SceneType != SceneType.SCENE_HALL; + if (!flag3) + { + bool flag4 = !this.hasLogin; + if (!flag4) + { + XSingleton.singleton.AddGreenLog("PandoraSDK CheckPandoraPLPanel ---------------------------", null, null, null, null, null); + this.ResetAllPopPLParent(); + XSingleton.singleton.XPandoraManager.PopPLPanel(); + } + } + } + } + } + + public void ResetAllPopPLParent() + { + bool flag = !XSingleton.singleton.IsSystemOpened(XSysDefine.XSys_PandoraSDK); + if (!flag) + { + bool flag2 = XSingleton.singleton.XPandoraManager == null; + if (!flag2) + { + bool flag3 = !this.hasLogin; + if (!flag3) + { + DlgBase.singleton.SetVisible(true, true); + XSingleton.singleton.XPandoraManager.SetPandoraPanelParent("pop", DlgBase.singleton.uiBehaviour.gameObject); + DlgBase.singleton.SetVisible(false, true); + } + } + } + } + + public void NoticePandoraShareResult(string result) + { + bool flag = !XSingleton.singleton.IsSystemOpened(XSysDefine.XSys_PandoraSDK); + if (!flag) + { + bool flag2 = XSingleton.singleton.XPandoraManager == null; + if (!flag2) + { + XSingleton.singleton.AddLog("NoticePandoraShareResult result = " + result, null, null, null, null, null, XDebugColor.XDebug_None); + XSingleton.singleton.XPandoraManager.NoticePandoraShareResult(result); + } + } + } + + public void NoticePandoraBuyGoodsResult(string result) + { + bool flag = !XSingleton.singleton.IsSystemOpened(XSysDefine.XSys_PandoraSDK); + if (!flag) + { + bool flag2 = XSingleton.singleton.XPandoraManager == null; + if (!flag2) + { + XSingleton.singleton.AddLog("NoticePandoraBuyGoodsResult result = " + result, null, null, null, null, null, XDebugColor.XDebug_None); + XSingleton.singleton.XPandoraManager.NoticePandoraBuyGoodsResult(result); + } + } + } + + public void CloseAllPandoraPanel() + { + bool flag = !XSingleton.singleton.IsSystemOpened(XSysDefine.XSys_PandoraSDK); + if (!flag) + { + bool flag2 = XSingleton.singleton.XPandoraManager == null; + if (!flag2) + { + XSingleton.singleton.AddLog("Pandora CloseAllPandoraPanel", null, null, null, null, null, XDebugColor.XDebug_None); + XSingleton.singleton.XPandoraManager.CloseAllPandoraPanel(); + } + } + } + + public void ClosePandoraTabPanel(string module) + { + bool flag = !XSingleton.singleton.IsSystemOpened(XSysDefine.XSys_PandoraSDK); + if (!flag) + { + bool flag2 = XSingleton.singleton.XPandoraManager == null; + if (!flag2) + { + XSingleton.singleton.AddLog("Pandora ClosePandoraTabPanel", null, null, null, null, null, XDebugColor.XDebug_None); + XSingleton.singleton.XPandoraManager.ClosePandoraTabPanel(module); + } + } + } + + public bool IsActivityTabShow(int sysID) + { + bool flag = !XSingleton.singleton.IsSystemOpened(XSysDefine.XSys_PandoraSDK); + bool result; + if (flag) + { + result = false; + } + else + { + bool flag2 = XSingleton.singleton.XPandoraManager == null; + if (flag2) + { + result = false; + } + else + { + XSingleton.singleton.AddLog("IsActivityTabShow sysID = " + sysID, null, null, null, null, null, XDebugColor.XDebug_None); + result = XSingleton.singleton.XPandoraManager.IsActivityTabShow(sysID); + } + } + return result; + } + + public bool IsPandoraSDKTab(XSysDefine sys, string module) + { + List pandoraSDKTabListInfo = XSingleton.singleton.GetPandoraSDKTabListInfo(module); + bool flag = pandoraSDKTabListInfo != null; + if (flag) + { + for (int i = 0; i < pandoraSDKTabListInfo.Count; i++) + { + bool flag2 = pandoraSDKTabListInfo[i].sysID == (int)sys; + if (flag2) + { + return true; + } + } + } + return false; + } + + public List GetPandoraSDKTabListInfo(string module) + { + bool flag = !XSingleton.singleton.IsSystemOpened(XSysDefine.XSys_PandoraSDK); + List result; + if (flag) + { + result = null; + } + else + { + bool flag2 = XSingleton.singleton.XPandoraManager == null; + if (flag2) + { + result = null; + } + else + { + List list = new List(); + List allTabInfo = XSingleton.singleton.XPandoraManager.GetAllTabInfo(); + for (int i = 0; i < allTabInfo.Count; i++) + { + bool flag3 = allTabInfo[i].moduleName == module; + if (flag3) + { + XSingleton.singleton.AddLog("GetPandoraSDKTabInfo find moduleName = " + module, null, null, null, null, null, XDebugColor.XDebug_None); + list.Add(allTabInfo[i]); + } + } + result = this.SortPandoraTab(list); + } + } + return result; + } + + public static int ComparePandoraSDKTab(ActivityTabInfo tab1, ActivityTabInfo tab2) + { + return tab1.sort - tab2.sort; + } + + public List SortPandoraTab(List resultList) + { + List list = new List(); + int i = 0; + while (i < resultList.Count) + { + bool flag = resultList[i].sort != 999; + if (flag) + { + list.Add(resultList[i]); + resultList.RemoveAt(i); + } + else + { + i++; + } + } + list.Sort(new Comparison(XPandoraSDKDocument.ComparePandoraSDKTab)); + list.AddRange(resultList); + return list; + } + + public void ShowPandoraTab(int sysID, bool show, GameObject parent) + { + bool flag = !XSingleton.singleton.IsSystemOpened(XSysDefine.XSys_PandoraSDK); + if (!flag) + { + bool flag2 = XSingleton.singleton.XPandoraManager == null; + if (!flag2) + { + ActivityTabInfo pandoraSDKTabInfo = this.GetPandoraSDKTabInfo(sysID); + bool flag3 = pandoraSDKTabInfo == null; + if (!flag3) + { + if (show) + { + this.ResetAllPopPLParent(); + } + if (show) + { + XSingleton.singleton.XPandoraManager.SetPandoraPanelParent(pandoraSDKTabInfo.moduleName, parent); + } + Dictionary dictionary = new Dictionary(); + dictionary["type"] = (show ? "open" : "hide"); + dictionary["content"] = pandoraSDKTabInfo.activityName; + string json = Json.Serialize(dictionary); + XSingleton.singleton.XPandoraManager.PandoraDoJson(json); + } + } + } + } + + public ActivityTabInfo GetPandoraSDKTabInfo(int sysID) + { + bool flag = !XSingleton.singleton.IsSystemOpened(XSysDefine.XSys_PandoraSDK); + ActivityTabInfo result; + if (flag) + { + result = null; + } + else + { + bool flag2 = XSingleton.singleton.XPandoraManager == null; + if (flag2) + { + result = null; + } + else + { + XSingleton.singleton.AddLog("GetPandoraSDKTabInfo sysID = " + sysID, null, null, null, null, null, XDebugColor.XDebug_None); + List allTabInfo = XSingleton.singleton.XPandoraManager.GetAllTabInfo(); + for (int i = 0; i < allTabInfo.Count; i++) + { + bool flag3 = allTabInfo[i].sysID == sysID; + if (flag3) + { + XSingleton.singleton.AddLog("GetPandoraSDKTabInfo find tabName = " + sysID, null, null, null, null, null, XDebugColor.XDebug_None); + return allTabInfo[i]; + } + } + result = null; + } + } + return result; + } + + public bool HasRedpoint(string module) + { + bool flag = !XSingleton.singleton.IsSystemOpened(XSysDefine.XSys_PandoraSDK); + bool result; + if (flag) + { + result = false; + } + else + { + bool flag2 = XSingleton.singleton.XPandoraManager == null; + if (flag2) + { + result = false; + } + else + { + List allTabInfo = XSingleton.singleton.XPandoraManager.GetAllTabInfo(); + for (int i = 0; i < allTabInfo.Count; i++) + { + bool flag3 = allTabInfo[i].moduleName == module && allTabInfo[i].tabShow && allTabInfo[i].redPointShow; + if (flag3) + { + return true; + } + } + result = false; + } + } + return result; + } + + public void PandoraDoJson(string json) + { + bool flag = !XSingleton.singleton.IsSystemOpened(XSysDefine.XSys_PandoraSDK); + if (!flag) + { + bool flag2 = XSingleton.singleton.XPandoraManager == null; + if (!flag2) + { + XSingleton.singleton.XPandoraManager.PandoraDoJson(json); + } + } + } + + public void PandoraOnJsonEvent(string json) + { + bool flag = !XSingleton.singleton.IsSystemOpened(XSysDefine.XSys_PandoraSDK); + if (!flag) + { + bool flag2 = XSingleton.singleton.XPandoraManager == null; + if (!flag2) + { + XSingleton.singleton.XPandoraManager.OnJsonPandoraEvent(json); + } + } + } + + public void SetLastFailSceneID(uint id) + { + bool flag = !XSingleton.singleton.IsSystemOpened(XSysDefine.XSys_PandoraSDK); + if (!flag) + { + bool flag2 = XSingleton.singleton.XPandoraManager == null; + if (!flag2) + { + List intList = XSingleton.singleton.GetIntList("PandoraSDKCheckFailSceneType"); + SceneType sceneType = XSingleton.singleton.GetSceneType(id); + int item = XFastEnumIntEqualityComparer.ToInt(sceneType); + bool flag3 = intList.Contains(item); + if (flag3) + { + XSingleton.singleton.XPandoraManager.PopPreLossActivity(true); + } + } + } + } + } +} -- cgit v1.1-26-g67d0