private void setUserInfo(ApolloAccountInfo accountInfo, uint worldId, string roleId) { if (accountInfo == null) { ADebug.Log("TssService account info is null"); } else { TssSdk.EENTRYID entryId = TssSdk.EENTRYID.ENTRY_ID_OTHERS; string openId = accountInfo.OpenId; string appId = null; if (accountInfo != null) { if (accountInfo.Platform == ApolloPlatform.Wechat) { entryId = TssSdk.EENTRYID.ENTRY_ID_MM; appId = ApolloCommon.ApolloInfo.WXAppId; } else { entryId = TssSdk.EENTRYID.ENTRY_ID_QZONE; appId = ApolloCommon.ApolloInfo.QQAppId; } } TssSdk.TssSdkSetUserInfoEx(entryId, openId, appId, worldId, roleId); } }
private void onLoginProc(string msg) { BugLocateLogSys.Log("ApolloAccountService onLoginProc:" + msg); if (!string.IsNullOrEmpty(msg)) { ApolloStringParser apolloStringParser = new ApolloStringParser(msg); ApolloAccountInfo apolloAccountInfo = null; ApolloResult @int = (ApolloResult)apolloStringParser.GetInt("Result"); BugLocateLogSys.Log("ApolloAccountService onLoginProc: result" + @int); if (@int == ApolloResult.Success) { apolloAccountInfo = apolloStringParser.GetObject <ApolloAccountInfo>("AccountInfo"); if (apolloAccountInfo != null && apolloAccountInfo.TokenList != null) { BugLocateLogSys.Log(string.Concat(new object[] { "C# onLoginProc|", @int, " platform:", apolloAccountInfo.Platform, " openid:", apolloAccountInfo.OpenId, " tokensize:", apolloAccountInfo.TokenList.Count, " pf:", apolloAccountInfo.Pf, " pfkey:", apolloAccountInfo.PfKey })); } else { BugLocateLogSys.Log("parser.GetObject<ApolloAccountInfo>() return null"); Debug.LogError("parser.GetObject<ApolloAccountInfo>() return null"); } } else { BugLocateLogSys.Log("C# onLoginProc error:" + @int); DebugHelper.Assert(false, "C# onLoginProc error:" + @int); } Debug.LogWarning(string.Format("LoginEvent:{0}", this.LoginEvent)); if (this.LoginEvent != null) { try { this.LoginEvent(@int, apolloAccountInfo); } catch (Exception ex) { DebugHelper.Assert(false, "onLoginProc:" + ex); BugLocateLogSys.Log("onLoginProc catch exception :" + ex.get_Message() + "|" + ex.ToString()); } } } }
public void ReportUserInfo(uint wordId, string roleId) { IApolloAccountService accountService = IApollo.Instance.GetAccountService(); ApolloAccountInfo accountInfo = new ApolloAccountInfo(); if (accountService.GetRecord(ref accountInfo) == ApolloResult.Success) { this.setUserInfo(accountInfo, wordId, roleId); } }
public ApolloResult GetRecord(ref ApolloAccountInfo pAccountInfo) { StringBuilder builder = new StringBuilder(0x1000); ApolloResult result = apollo_account_getRecord(base.ObjectId, builder, 0x1000); string src = builder.ToString(); ADebug.Log(string.Concat(new object[] { "GetRecord:", result, ", ", src })); if (src.Length > 0) { pAccountInfo.FromString(src); } return(result); }
public override ApolloLoginInfo FromString(string src) { ApolloStringParser parser = new ApolloStringParser(src); this.AccountInfo = parser.GetObject <ApolloAccountInfo>("AccountInfo"); this.WaitingInfo = parser.GetObject <ApolloWaitingInfo>("WaitingInfo"); string data = parser.GetString("ServerInfo"); if (data != null) { this.ServerInfo = new ApolloServerRouteInfo(); this.ServerInfo.FromString(data); } return(this); }
public override ApolloLoginInfo FromString(string src) { ApolloStringParser apolloStringParser = new ApolloStringParser(src); this.AccountInfo = apolloStringParser.GetObject <ApolloAccountInfo>("AccountInfo"); this.WaitingInfo = apolloStringParser.GetObject <ApolloWaitingInfo>("WaitingInfo"); string text = apolloStringParser.GetString("ServerInfo"); if (text != null) { text = ApolloStringParser.ReplaceApolloStringQuto(text); this.ServerInfo = new ApolloServerRouteInfo(); this.ServerInfo.FromString(text); } return(this); }
public ApolloResult GetRecord(ref ApolloAccountInfo pAccountInfo) { StringBuilder stringBuilder = new StringBuilder(4096); ApolloResult apolloResult = ApolloAccountService.apollo_account_getRecord(base.ObjectId, stringBuilder, 4096); string text = stringBuilder.ToString(); ADebug.Log(string.Concat(new object[] { "GetRecord:", apolloResult, ", ", text })); if (text.get_Length() > 0) { pAccountInfo.FromString(text); } return(apolloResult); }