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 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()); } }