Пример #1
0
        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);
        }
Пример #2
0
        private static bool s_GetWakeupInfo(out ApolloWakeupInfo wakeupInfo)
        {
            wakeupInfo = null;
            StringBuilder stringBuilder = new StringBuilder(20480);
            bool          flag          = ApolloQuickLoginService.apollo_account_GetWakeupInfo(stringBuilder, 20480);

            ADebug.Log("s_GetWakeupInfo : " + flag);
            if (flag)
            {
                string text = stringBuilder.ToString();
                ADebug.Log("s_GetWakeupInfo: " + text);
                if (text != null && text.get_Length() > 0)
                {
                    ApolloStringParser apolloStringParser = new ApolloStringParser(text);
                    if (apolloStringParser != null)
                    {
                        wakeupInfo = apolloStringParser.GetObject <ApolloWakeupInfo>("WakeupInfo");
                        if (wakeupInfo != null)
                        {
                            ADebug.Log("s_GetWakeupInfo parser.GetObject success");
                            return(true);
                        }
                        ADebug.Log("s_GetWakeupInfo parser.GetObject error");
                    }
                    else
                    {
                        ADebug.Log("GetWakeupInfo parser.GetObjec error");
                    }
                }
            }
            return(false);
        }
Пример #3
0
        private static bool s_GetWakeupInfo(out ApolloWakeupInfo wakeupInfo)
        {
            wakeupInfo = null;
            StringBuilder pAccountInfo = new StringBuilder(0x5000);
            bool          flag         = apollo_account_GetWakeupInfo(pAccountInfo, 0x5000);

            ADebug.Log("s_GetWakeupInfo : " + flag);
            if (flag)
            {
                string src = pAccountInfo.ToString();
                ADebug.Log("s_GetWakeupInfo: " + src);
                if ((src != null) && (src.Length > 0))
                {
                    ApolloStringParser parser = new ApolloStringParser(src);
                    if (parser != null)
                    {
                        wakeupInfo = parser.GetObject <ApolloWakeupInfo>("WakeupInfo");
                        if (wakeupInfo != null)
                        {
                            ADebug.Log("s_GetWakeupInfo parser.GetObject success");
                            return(true);
                        }
                        ADebug.Log("s_GetWakeupInfo parser.GetObject error");
                    }
                    else
                    {
                        ADebug.Log("GetWakeupInfo parser.GetObjec error");
                    }
                }
            }
            return(false);
        }
Пример #4
0
        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);
        }
Пример #5
0
        private void OnConnectProc(string msg)
        {
            ADebug.Log("c#:OnConnectProc: " + msg);
            if (string.IsNullOrEmpty(msg))
            {
                ADebug.LogError("OnConnectProc msg is null");
                return;
            }
            ApolloStringParser apolloStringParser = new ApolloStringParser(msg);
            ApolloResult       @int = (ApolloResult)apolloStringParser.GetInt("Result", 6);

            this.LoginInfo = apolloStringParser.GetObject <ApolloLoginInfo>("LoginInfo");
            if (@int == ApolloResult.Success)
            {
                this.Connected = true;
            }
            else
            {
                this.Connected = false;
            }
            ADebug.Log(string.Concat(new object[]
            {
                "c#:OnConnectProc: ",
                @int,
                " loginfo:",
                this.LoginInfo
            }));
            if (this.LoginInfo != null && this.LoginInfo.AccountInfo != null && this.LoginInfo.AccountInfo.TokenList != null)
            {
                ADebug.Log(string.Concat(new object[]
                {
                    "C# logininfo| platform:",
                    this.LoginInfo.AccountInfo.Platform,
                    " openid:",
                    this.LoginInfo.AccountInfo.OpenId,
                    " tokensize:",
                    this.LoginInfo.AccountInfo.TokenList.Count,
                    " pf:",
                    this.LoginInfo.AccountInfo.Pf,
                    " pfkey:",
                    this.LoginInfo.AccountInfo.PfKey
                }));
            }
            if (this.ConnectEvent != null)
            {
                try
                {
                    this.ConnectEvent(@int, this.LoginInfo);
                }
                catch (Exception exception)
                {
                    ADebug.LogException(exception);
                }
            }
            else
            {
                ADebug.Log("OnConnectProc ConnectEvent is null");
            }
        }
Пример #6
0
 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());
             }
         }
     }
 }
Пример #7
0
 private void OnLocationGotNotify(string msg)
 {
     if (msg.get_Length() > 0)
     {
         ApolloStringParser apolloStringParser = new ApolloStringParser(msg);
         ApolloLocation     @object            = apolloStringParser.GetObject <ApolloLocation>("Location");
         if (this.onLocationGotEvent != null)
         {
             try
             {
                 this.onLocationGotEvent(@object);
             }
             catch (Exception ex)
             {
                 ADebug.Log("onLocationGotEvent:" + ex);
             }
         }
     }
 }
 private void OnShareNotify(string msg)
 {
     if (msg.get_Length() > 0)
     {
         ApolloStringParser apolloStringParser = new ApolloStringParser(msg);
         ApolloShareResult  @object            = apolloStringParser.GetObject <ApolloShareResult>("ShareResult");
         if (this.onShareEvent != null)
         {
             try
             {
                 this.onShareEvent(@object);
             }
             catch (Exception ex)
             {
                 ADebug.Log("onShareEvent:" + ex);
             }
         }
     }
 }
Пример #9
0
 private void OnLocationNotify(string msg)
 {
     if (msg.Length > 0)
     {
         ApolloStringParser parser    = new ApolloStringParser(msg);
         ApolloRelation     aRelation = null;
         aRelation = parser.GetObject <ApolloRelation>("Relation");
         if (this.onLocationEvent != null)
         {
             try
             {
                 this.onLocationEvent(aRelation);
             }
             catch (Exception exception)
             {
                 ADebug.Log("onLocationEvent:" + exception);
             }
         }
     }
 }
Пример #10
0
 private void OnShareNotify(string msg)
 {
     if (msg.Length > 0)
     {
         ApolloStringParser parser            = new ApolloStringParser(msg);
         ApolloShareResult  shareResponseInfo = null;
         shareResponseInfo = parser.GetObject <ApolloShareResult>("ShareResult");
         if (this.onShareEvent != null)
         {
             try
             {
                 this.onShareEvent(shareResponseInfo);
             }
             catch (Exception exception)
             {
                 ADebug.Log("onShareEvent:" + exception);
             }
         }
     }
 }
Пример #11
0
 private void OnQueryGroupKeyNotify(string msg)
 {
     ADebug.Log("OnQueryGroupKeyNotify");
     if (msg.get_Length() > 0)
     {
         ApolloStringParser apolloStringParser = new ApolloStringParser(msg);
         ApolloGroupResult  @object            = apolloStringParser.GetObject <ApolloGroupResult>("GroupResult");
         if (this.onQueryGroupKeyEvent != null)
         {
             try
             {
                 this.onQueryGroupKeyEvent(@object);
             }
             catch (Exception ex)
             {
                 ADebug.Log("OnQueryGroupKeyNotify:" + ex);
             }
         }
     }
 }
Пример #12
0
 private void OnBindGroupNotify(string msg)
 {
     ADebug.Log("OnBindGroupNotify");
     if (msg.Length > 0)
     {
         ApolloStringParser parser   = new ApolloStringParser(msg);
         ApolloGroupResult  groupRet = null;
         groupRet = parser.GetObject <ApolloGroupResult>("GroupResult");
         if (this.onBindGroupEvent != null)
         {
             try
             {
                 this.onBindGroupEvent(groupRet);
             }
             catch (Exception exception)
             {
                 ADebug.Log("OnBindGroupNotify:" + exception);
             }
         }
     }
 }