public string GetAccessToken(ApolloPlatform platform) { string result = string.Empty; ApolloAccountInfo accountInfo = Singleton <ApolloHelper> .GetInstance().GetAccountInfo(false); if (accountInfo != null) { for (int i = 0; i < accountInfo.TokenList.Count; i++) { ApolloToken apolloToken = accountInfo.TokenList[i]; if (platform == ApolloPlatform.Wechat) { if (apolloToken != null && apolloToken.Type == ApolloTokenType.Access) { result = apolloToken.Value; } } else if ((platform == ApolloPlatform.QQ || platform == ApolloPlatform.Guest) && apolloToken != null && apolloToken.Type == ApolloTokenType.Access) { result = apolloToken.Value; } } } return(result); }
public static void SetUserToken() { ApolloAccountInfo accountInfo = Singleton <ApolloHelper> .GetInstance().GetAccountInfo(false); if (accountInfo != null) { ApolloToken token = accountInfo.GetToken(ApolloTokenType.Access); if (token != null) { NetworkAccelerator.setUserToken(accountInfo.OpenId, token.Value); } } }
public string GetAccountInfoStr(ref ApolloAccountInfo info) { string text = "===== Account Info =====\n"; text += string.Format("OpenId:{0}\n", info.get_OpenId()); text += string.Format("Pf:{0}\n", info.get_Pf()); text += string.Format("PfKey:{0}\n", info.get_PfKey()); text += string.Format("Platform:{0}\n", info.get_Platform()); text += "TokenList Begin:\n"; using (ListView <ApolloToken> .Enumerator enumerator = info.get_TokenList().GetEnumerator()) { while (enumerator.MoveNext()) { ApolloToken current = enumerator.get_Current(); text += string.Format("{0}:{1}\n", current.get_Type(), current.get_Value()); } } text += "TokenList End:\n"; text += "===== Account Info ====="; return(text); }
public bool Start() { bool flag = false; try { if (this.m_bInstall) { flag = TGALive.available(); if (flag) { string token = string.Empty; ApolloAccountInfo accountInfo = Singleton <ApolloHelper> .GetInstance().GetAccountInfo(false); if (accountInfo != null) { ApolloToken token2 = accountInfo.GetToken(ApolloTokenType.Access); if (token2 != null) { token = token2.Value; } } TGALive.start(token, 1); this.m_bStart = true; } } else { flag = false; } } catch (Exception ex) { Debug.Log("TGA" + ex.ToString()); flag = false; } return(flag); }
private void InitSys() { try { ApolloAccountInfo accountInfo = Singleton <ApolloHelper> .GetInstance().GetAccountInfo(false); string text = string.Empty; string text2 = string.Empty; if (accountInfo != null) { ApolloToken token = accountInfo.GetToken(ApolloTokenType.Access); if (token != null) { text2 = token.Value; } text = accountInfo.OpenId; } int num = 1; if (ApolloConfig.platform == ApolloPlatform.QQ) { num = 1; } else if (ApolloConfig.platform == ApolloPlatform.Wechat) { num = 2; } else if (ApolloConfig.platform == ApolloPlatform.Guest) { num = 3; } string text3 = string.Empty; string text4 = string.Empty; CRoleInfo masterRoleInfo = Singleton <CRoleInfoManager> .instance.GetMasterRoleInfo(); if (masterRoleInfo != null) { text3 = masterRoleInfo.Name; text4 = masterRoleInfo.HeadUrl; } string jsonString = string.Format("{{\"appid\" : \"{0}\",\"token\" : \"{1}\", \"accountType\":\"{2}\",\"areaid\":\"{3}\",\"openid\":\"{4}\",\"nikeName\":\"{5}\",\"avatarUrl\":\"{6}\",\"gameVersion\":\"{7}\" ,\"gameUid\":\"{8}\" ,\"gameCallObjName\":\"{9}\",\"gameCallObjMethd\":\"{10}\"}}", new object[] { ApolloConfig.GetAppID(), text2, num, MonoSingleton <TdirMgr> .GetInstance().SelectedTdir.logicWorldID, text, text3, text4, CVersion.GetAppVersion(), masterRoleInfo.playerUllUID, "BootObj/TGASys", "OnCallBack" }); TGALive.init(jsonString); this.m_bInstall = true; } catch (Exception ex) { Debug.Log("TGA" + ex.ToString()); } }
public void InitWechatLink() { if (ApolloConfig.platform != 1) { return; } ApolloAccountInfo accountInfo = Singleton <ApolloHelper> .GetInstance().GetAccountInfo(false); string text = "Smoba"; string openId = accountInfo.get_OpenId(); string text2 = "qq"; string text3 = string.Empty; string text4 = Singleton <CRoleInfoManager> .GetInstance().GetMasterRoleInfo().playerUllUID.ToString(); string text5 = string.Empty; string text6 = string.Empty; using (ListView <ApolloToken> .Enumerator enumerator = accountInfo.get_TokenList().GetEnumerator()) { while (enumerator.MoveNext()) { ApolloToken current = enumerator.get_Current(); if (ApolloConfig.platform == 1) { if (current.get_Type() == 1) { text5 = current.get_Value(); } } else if (ApolloConfig.platform == 2) { if (current.get_Type() == 3) { text6 = current.get_Value(); } if (current.get_Type() == 1) { text5 = current.get_Value(); } } } } if (ApolloConfig.platform == 2) { text2 = "qq"; if (Application.platform == RuntimePlatform.Android) { text3 = "1"; } else if (Application.platform == RuntimePlatform.IPhonePlayer) { text3 = "2"; } } else if (ApolloConfig.platform == 1) { text2 = "wx"; if (Application.platform == RuntimePlatform.Android) { text3 = "3"; } else if (Application.platform == RuntimePlatform.IPhonePlayer) { text3 = "4"; } } string text7 = MonoSingleton <TdirMgr> .GetInstance().SelectedTdir.logicWorldID.ToString(); string text8 = ApolloConfig.appID; if (ApolloConfig.platform == 1) { text8 = ApolloConfig.WXAppID; } string appVersion = CVersion.GetAppVersion(); string text9 = "1"; Dictionary <string, string> dictionary = new Dictionary <string, string>(); dictionary.Add("sOpenId", openId); dictionary.Add("sServiceType", text); dictionary.Add("sAcountType", text2); dictionary.Add("sArea", text3); dictionary.Add("sPartition", text7); dictionary.Add("sAppId", text8); dictionary.Add("sRoleId", text4); dictionary.Add("sAccessToken", text5); dictionary.Add("sPayToken", text6); dictionary.Add("sGameVer", appVersion); dictionary.Add("sPlatID", text9); this.m_bShowWeixinZone = false; if (ApolloConfig.platform == 1 && this.m_bOpenWeixinZone) { int @int = PlayerPrefs.GetInt("SHOW_WEIXINZONE"); if (@int >= 1) { this.m_bShowWeixinZone = true; } WeChatLink.Instance.BeginGetGameZoneUrl(dictionary, new Action <Dictionary <string, string> >(this.OnGetGameZoneUrl)); } }
private void InitPara() { ApolloAccountInfo accountInfo = Singleton <ApolloHelper> .GetInstance().GetAccountInfo(false); string text = "Smoba"; string openId = accountInfo.get_OpenId(); string text2 = "qq"; string text3 = string.Empty; string text4 = Singleton <CRoleInfoManager> .GetInstance().GetMasterRoleInfo().playerUllUID.ToString(); string text5 = string.Empty; string text6 = string.Empty; using (ListView <ApolloToken> .Enumerator enumerator = accountInfo.get_TokenList().GetEnumerator()) { while (enumerator.MoveNext()) { ApolloToken current = enumerator.get_Current(); if (ApolloConfig.platform == 1) { if (current.get_Type() == 1) { text5 = current.get_Value(); } } else if (ApolloConfig.platform == 2) { if (current.get_Type() == 3) { text6 = current.get_Value(); } if (current.get_Type() == 1) { text5 = current.get_Value(); } } } } if (ApolloConfig.platform == 2) { text2 = "qq"; if (Application.platform == RuntimePlatform.Android) { text3 = "1"; } else if (Application.platform == RuntimePlatform.IPhonePlayer) { text3 = "2"; } } else if (ApolloConfig.platform == 1) { text2 = "wx"; if (Application.platform == RuntimePlatform.Android) { text3 = "3"; } else if (Application.platform == RuntimePlatform.IPhonePlayer) { text3 = "4"; } } string text7 = MonoSingleton <TdirMgr> .GetInstance().SelectedTdir.logicWorldID.ToString(); string text8 = ApolloConfig.appID; if (ApolloConfig.platform == 1) { text8 = ApolloConfig.WXAppID; } string appVersion = CVersion.GetAppVersion(); string text9 = "1"; GameObject gameObject = base.gameObject; Pandora.Instance.SetPandoraParent(gameObject); Pandora.Instance.SetPanelBaseDepth(1000); Pandora.Instance.SetCallback(new Action <Dictionary <string, string> >(this.OnPandoraEvent)); Pandora.Instance.SetGetDjImageCallback(new Func <GameObject, int, int, int>(this.OnGetDjImageCallback)); Dictionary <string, string> dictionary = new Dictionary <string, string>(); dictionary.Add("sOpenId", openId); dictionary.Add("sServiceType", text); dictionary.Add("sAcountType", text2); dictionary.Add("sArea", text3); dictionary.Add("sPartition", text7); dictionary.Add("sAppId", text8); dictionary.Add("sRoleId", text4); dictionary.Add("sAccessToken", text5); dictionary.Add("sPayToken", text6); dictionary.Add("sGameVer", appVersion); dictionary.Add("sPlatID", text9); Pandora.Instance.SetUserData(dictionary); }