예제 #1
0
    private void OnLogin(ApolloPlatform platform)
    {
        if (!this.m_IsSwitchToLoginPlatform)
        {
            Singleton <CUIManager> .GetInstance().OpenSendMsgAlert(5, enUIEventID.None);

            this.m_IsSwitchToLoginPlatform = true;
            if (!this.accountService.IsPlatformInstalled(platform))
            {
                if (this.CurPlatform == ApolloPlatform.Wechat)
                {
                    Singleton <EventRouter> .GetInstance().BroadCastEvent <ApolloPlatform>(EventID.ApolloHelper_Platform_Not_Installed, ApolloPlatform.Wechat);

                    return;
                }
                if ((this.CurPlatform != ApolloPlatform.QQ) && (this.CurPlatform != ApolloPlatform.QRWechat))
                {
                    Singleton <EventRouter> .GetInstance().BroadCastEvent <ApolloPlatform>(EventID.ApolloHelper_Platform_Not_Installed, platform);

                    return;
                }
            }
            if (!this.m_IsLoginEventHandlerRegistered)
            {
                this.m_IsLoginEventHandlerRegistered = true;
                this.accountService.LoginEvent      += new AccountLoginHandle(this.OnLoginEvent);
            }
            ApolloAccountInfo accountInfo = this.GetAccountInfo(false);
            if (accountInfo != null)
            {
                this.m_LastOpenID = accountInfo.OpenId;
            }
            this.accountService.Login(platform);
        }
    }
예제 #2
0
        public override ApolloWakeupInfo FromString(string src)
        {
            Debug.Log("WakeUpInfo:" + src);
            ApolloStringParser apolloStringParser = new ApolloStringParser(src);

            this.state        = (ApolloWakeState)apolloStringParser.GetInt("State");
            this.Platform     = (ApolloPlatform)apolloStringParser.GetInt("Platform");
            this.MediaTagName = apolloStringParser.GetString("MediaTagName");
            this.OpenId       = apolloStringParser.GetString("OpenId");
            this.Lang         = apolloStringParser.GetString("Lang");
            this.Country      = apolloStringParser.GetString("Country");
            this.MessageExt   = apolloStringParser.GetString("MessageExt");
            string @string = apolloStringParser.GetString("ExtInfo");

            if (@string != null && string.Empty != @string)
            {
                string[] array = @string.Split(new char[]
                {
                    ','
                });
                this.ExtensionInfo.Clear();
                string[] array2 = array;
                for (int i = 0; i < array2.Length; i++)
                {
                    string src2 = array2[i];
                    string src3 = ApolloStringParser.ReplaceApolloString(src2);
                    src3 = ApolloStringParser.ReplaceApolloString(src3);
                    ApolloKVPair apolloKVPair = new ApolloKVPair();
                    apolloKVPair.FromString(src3);
                    this.ExtensionInfo.Add(apolloKVPair);
                }
            }
            return(this);
        }
    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);
    }
예제 #4
0
 public override ApolloShareResult FromString(string src)
 {
     char[] separator = new char[] { '&' };
     foreach (string str in src.Split(separator))
     {
         char[]   chArray2  = new char[] { '=' };
         string[] strArray3 = str.Split(chArray2);
         if (strArray3.Length > 1)
         {
             if (strArray3[0].CompareTo("Platform") == 0)
             {
                 this.platform = (ApolloPlatform)int.Parse(strArray3[1]);
             }
             else if (strArray3[0].CompareTo("nResult") == 0)
             {
                 this.result = (ApolloResult)int.Parse(strArray3[1]);
             }
             else if (strArray3[0].CompareTo("szDescription") == 0)
             {
                 this.drescription = strArray3[1];
             }
             else if (strArray3[0].CompareTo("szExt") == 0)
             {
                 this.extInfo = strArray3[1];
             }
         }
     }
     return(this);
 }
예제 #5
0
        public override ApolloWakeupInfo FromString(string src)
        {
            ApolloStringParser parser = new ApolloStringParser(src);

            this.state        = (ApolloWakeState)parser.GetInt("State");
            this.Platform     = (ApolloPlatform)parser.GetInt("Platform");
            this.MediaTagName = parser.GetString("MediaTagName");
            this.OpenId       = parser.GetString("OpenId");
            this.Lang         = parser.GetString("Lang");
            this.Country      = parser.GetString("Country");
            this.MessageExt   = parser.GetString("MessageExt");
            string str = parser.GetString("ExtInfo");

            if ((str != null) && (string.Empty != str))
            {
                char[]   separator = new char[] { ',' };
                string[] strArray  = str.Split(separator);
                this.ExtensionInfo.Clear();
                foreach (string str2 in strArray)
                {
                    string       str3 = ApolloStringParser.ReplaceApolloString(ApolloStringParser.ReplaceApolloString(str2));
                    ApolloKVPair item = new ApolloKVPair();
                    item.FromString(str3);
                    this.ExtensionInfo.Add(item);
                }
            }
            return(this);
        }
예제 #6
0
    public ApolloAccountInfo GetAccountInfo(bool refreshToken = false)
    {
        ApolloAccountInfo accountInfo = new ApolloAccountInfo();

        if (ApolloConfig.platform == ApolloPlatform.None)
        {
            accountInfo.OpenId   = ApolloConfig.CustomOpenId;
            accountInfo.Platform = ApolloPlatform.None;
            return(accountInfo);
        }
        ApolloResult record = this.accountService.GetRecord(ref accountInfo);

        if (record == ApolloResult.Success)
        {
            if ((this.CurPlatform == ApolloPlatform.None) && (this.CurPlatform != accountInfo.Platform))
            {
                ApolloConfig.platform = this.CurPlatform = accountInfo.Platform;
            }
            return(accountInfo);
        }
        if (((record == ApolloResult.TokenInvalid) && (accountInfo != null)) && ((accountInfo.Platform == ApolloPlatform.Wechat) && refreshToken))
        {
            this.accountService.RefreshAtkEvent -= new RefreshAccessTokenHandler(this.OnRefreshAccessTokenEvent);
            this.accountService.RefreshAtkEvent += new RefreshAccessTokenHandler(this.OnRefreshAccessTokenEvent);
            this.accountService.RefreshAccessToken();
            return(null);
        }
        return(null);
    }
 public ApolloHelper()
 {
     this.info = new ApolloInfo(ApolloConfig.QQAppID, ApolloConfig.WXAppID, ApolloConfig.maxMessageBufferSize, string.Empty);
     IApollo.Instance.Initialize(this.info);
     IApollo.Instance.SetApolloLogger(ApolloLogPriority.None, null);
     this.accountService                  = IApollo.Instance.GetAccountService();
     this.payService                      = null;
     this.registerInfo                    = new RegisterInfo();
     this.snsService                      = (IApollo.Instance.GetService(1) as IApolloSnsService);
     this.reportService                   = (IApollo.Instance.GetService(3) as IApolloReportService);
     this.quickLoginService               = (IApollo.Instance.GetService(7) as IApolloQuickLoginService);
     this.m_IsSwitchToLoginPlatform       = false;
     this.m_IsLoginEventHandlerRegistered = false;
     this.m_IsLoginReturn                 = false;
     this.CurPlatform                     = ApolloPlatform.None;
     this.m_LastOpenID                    = null;
     this.m_LastTriedPlatform             = ApolloPlatform.None;
     this.m_IsLastTriedPlatformSet        = false;
     this.IsLastLaunchFrom3rdAPP          = false;
     if (File.Exists(Application.persistentDataPath + "/customOpenId.txt"))
     {
         this.IsNoneModeSupport = true;
     }
     else
     {
         this.IsNoneModeSupport = false;
     }
     HttpDnsPolicy.Init();
 }
예제 #8
0
    public ApolloAccountInfo GetAccountInfo(bool refreshToken = false)
    {
        ApolloAccountInfo apolloAccountInfo = new ApolloAccountInfo();

        if (ApolloConfig.platform == null)
        {
            apolloAccountInfo.set_OpenId(ApolloConfig.CustomOpenId);
            apolloAccountInfo.set_Platform(0);
            return(apolloAccountInfo);
        }
        ApolloResult record = this.accountService.GetRecord(ref apolloAccountInfo);

        if (record == null)
        {
            if (this.CurPlatform == null && this.CurPlatform != apolloAccountInfo.get_Platform())
            {
                ApolloConfig.platform = (this.CurPlatform = apolloAccountInfo.get_Platform());
            }
            return(apolloAccountInfo);
        }
        if (record == 16 && apolloAccountInfo != null && apolloAccountInfo.get_Platform() == 1 && refreshToken)
        {
            this.accountService.remove_RefreshAtkEvent(new RefreshAccessTokenHandler(this.OnRefreshAccessTokenEvent));
            this.accountService.add_RefreshAtkEvent(new RefreshAccessTokenHandler(this.OnRefreshAccessTokenEvent));
            this.accountService.RefreshAccessToken();
            return(null);
        }
        return(null);
    }
예제 #9
0
 public ApolloHelper()
 {
     IApollo.Instance.Initialize(this.info);
     IApollo.Instance.SetApolloLogger(ApolloLogPriority.None, null);
     this.accountService                  = IApollo.Instance.GetAccountService();
     this.payService                      = null;
     this.registerInfo                    = new RegisterInfo();
     this.snsService                      = IApollo.Instance.GetService(1) as IApolloSnsService;
     this.reportService                   = IApollo.Instance.GetService(3) as IApolloReportService;
     this.quickLoginService               = IApollo.Instance.GetService(7) as IApolloQuickLoginService;
     this.m_IsSwitchToLoginPlatform       = false;
     this.m_IsLoginEventHandlerRegistered = false;
     this.m_IsLoginReturn                 = false;
     this.CurPlatform                     = ApolloPlatform.None;
     this.m_LastOpenID                    = null;
     this.m_LastTriedPlatform             = ApolloPlatform.None;
     this.m_IsLastTriedPlatformSet        = false;
     if (File.Exists(Application.persistentDataPath + "/customOpenId.txt"))
     {
         this.IsNoneModeSupport = true;
     }
     else
     {
         this.IsNoneModeSupport = false;
     }
 }
예제 #10
0
 public ApolloRealNameAuthResult()
 {
     this.Platform  = ApolloPlatform.None;
     this.Ret       = ApolloResult.Unknown;
     this.ErrorCode = -1;
     this.Desc      = string.Empty;
 }
예제 #11
0
    public ApolloAccountInfo GetAccountInfo(bool refreshToken = false)
    {
        ApolloAccountInfo accountInfo = new ApolloAccountInfo();

        if (ApolloConfig.platform == ApolloPlatform.None)
        {
            accountInfo.OpenId   = ApolloConfig.CustomOpenId;
            accountInfo.Platform = ApolloPlatform.None;
            return(accountInfo);
        }
        ApolloResult record = this.accountService.GetRecord(ref accountInfo);

        if (record == ApolloResult.Success)
        {
            Debug.Log("GetAccountInfo Success");
            if (this.m_CurPlatform != accountInfo.Platform)
            {
                ApolloConfig.platform = this.m_CurPlatform = accountInfo.Platform;
            }
            return(accountInfo);
        }
        if (((record == ApolloResult.TokenInvalid) && (accountInfo != null)) && ((accountInfo.Platform == ApolloPlatform.Wechat) && refreshToken))
        {
            Debug.Log("try to refresh token");
            this.accountService.RefreshAtkEvent += new RefreshAccessTokenHandler(this.OnRefreshAccessTokenEvent);
            this.accountService.RefreshAccessToken();
            return(null);
        }
        Debug.Log(string.Format("GetRecord Fail result is {0}", record));
        Debug.Log(string.Format("current platform is {0}", (accountInfo != null) ? ((object)accountInfo.Platform) : ((object)0)));
        return(null);
    }
예제 #12
0
 public ApolloResult Initialize(ApolloPlatform platform, uint permission, string url)
 {
     ADebug.Log(string.Concat(new object[] { "Connector Initialize:", platform, " url:", url }));
     if (platform == ApolloPlatform.WTLogin)
     {
     }
     return((ApolloResult)apollo_connector_Initialize(base.ObjectId, platform, permission, url));
 }
예제 #13
0
        public override void ReadFrom(ApolloBufferReader reader)
        {
            int platform = 0;
            int ret      = 0;

            reader.Read(ref platform);
            reader.Read(ref ret);
            reader.Read(ref this.ErrorCode);
            reader.Read(ref this.Desc);
            this.Platform = (ApolloPlatform)platform;
            this.Ret      = (ApolloResult)ret;
        }
예제 #14
0
    public void Login(ApolloPlatform platform, ulong uin = 0, string pwd = null)
    {
        switch (platform)
        {
        case ApolloPlatform.None:
        {
            if (ApolloConfig.CustomOpenId == null)
            {
            }
            ApolloResult result = NoneAccountService.Initialize(new NoneAccountInitInfo(ApolloConfig.CustomOpenId));
            if (result == ApolloResult.Success)
            {
                break;
            }
            List <KeyValuePair <string, string> > events = new List <KeyValuePair <string, string> > {
                new KeyValuePair <string, string>("g_version", CVersion.GetAppVersion()),
                new KeyValuePair <string, string>("WorldID", MonoSingleton <TdirMgr> .GetInstance().SelectedTdir.logicWorldID.ToString()),
                new KeyValuePair <string, string>("platform", Singleton <ApolloHelper> .GetInstance().CurPlatform.ToString()),
                new KeyValuePair <string, string>("openid", "NULL")
            };
            float num = Time.time - Singleton <CLoginSystem> .GetInstance().m_fLoginClickTime;

            events.Add(new KeyValuePair <string, string>("totaltime", num.ToString()));
            events.Add(new KeyValuePair <string, string>("errorcode", result.ToString()));
            events.Add(new KeyValuePair <string, string>("error_msg", "null"));
            Singleton <ApolloHelper> .GetInstance().ApolloRepoertEvent("Service_Login_MSDKClientAuth", events, true);

            Singleton <EventRouter> .GetInstance().BroadCastEvent <ApolloResult>(EventID.ApolloHelper_Login_Failed, result);

            return;
        }

        case ApolloPlatform.WTLogin:
            Singleton <EventRouter> .GetInstance().BroadCastEvent <ApolloResult>(EventID.ApolloHelper_Login_Failed, ApolloResult.Empty);

            return;
        }
        ApolloConfig.Uin      = uin;
        ApolloConfig.Password = pwd;
        ApolloConfig.platform = this.CurPlatform = platform;
        if ((ApolloConfig.platform == ApolloPlatform.None) && this.IsNoneModeSupport)
        {
            Singleton <EventRouter> .GetInstance().BroadCastEvent <ApolloAccountInfo>(EventID.ApolloHelper_Login_Success, this.GetAccountInfo(false));
        }
        else
        {
            this.OnLogin(platform);
        }
    }
예제 #15
0
    public void Login(ApolloPlatform platform, ulong uin = 0uL, string pwd = null)
    {
        switch (platform)
        {
        case 0:
        {
            if (ApolloConfig.CustomOpenId == null)
            {
            }
            ApolloResult apolloResult = NoneAccountService.Initialize(new NoneAccountInitInfo(ApolloConfig.CustomOpenId));
            if (apolloResult != null)
            {
                List <KeyValuePair <string, string> > list = new List <KeyValuePair <string, string> >();
                list.Add(new KeyValuePair <string, string>("g_version", CVersion.GetAppVersion()));
                list.Add(new KeyValuePair <string, string>("WorldID", MonoSingleton <TdirMgr> .GetInstance().SelectedTdir.logicWorldID.ToString()));
                list.Add(new KeyValuePair <string, string>("platform", Singleton <ApolloHelper> .GetInstance().CurPlatform.ToString()));
                list.Add(new KeyValuePair <string, string>("openid", "NULL"));
                list.Add(new KeyValuePair <string, string>("totaltime", (Time.time - Singleton <CLoginSystem> .GetInstance().m_fLoginClickTime).ToString()));
                list.Add(new KeyValuePair <string, string>("errorCode", apolloResult.ToString()));
                list.Add(new KeyValuePair <string, string>("error_msg", "null"));
                Singleton <ApolloHelper> .GetInstance().ApolloRepoertEvent("Service_Login_MSDKClientAuth", list, true);

                Singleton <EventRouter> .GetInstance().BroadCastEvent <ApolloResult>(EventID.ApolloHelper_Login_Failed, apolloResult);

                return;
            }
            break;
        }

        case 3:
            Singleton <EventRouter> .GetInstance().BroadCastEvent <ApolloResult>(EventID.ApolloHelper_Login_Failed, 7);

            return;
        }
        ApolloConfig.Uin      = uin;
        ApolloConfig.Password = pwd;
        this.CurPlatform      = platform;
        ApolloConfig.platform = platform;
        if (ApolloConfig.platform == null && this.IsNoneModeSupport)
        {
            Singleton <EventRouter> .GetInstance().BroadCastEvent <ApolloAccountInfo>(EventID.ApolloHelper_Login_Success, this.GetAccountInfo(false));
        }
        else
        {
            this.OnLogin(platform);
        }
    }
예제 #16
0
    public void Login(ApolloPlatform platform, ulong uin = 0, string pwd = null)
    {
        switch (platform)
        {
        case ApolloPlatform.None:
        {
            if (ApolloConfig.CustomOpenId == null)
            {
                Debug.Log(string.Format("Custom OpenId is Empty! current platform{0}", platform));
            }
            ApolloResult result = NoneAccountService.Initialize(new NoneAccountInitInfo(ApolloConfig.CustomOpenId));
            if (result != ApolloResult.Success)
            {
                Debug.Log(string.Format("login apollo result is {0}! current platform{1}", result, platform));
                List <KeyValuePair <string, string> > events = new List <KeyValuePair <string, string> > {
                    new KeyValuePair <string, string>("WorldID", MonoSingleton <TdirMgr> .GetInstance().SelectedTdir.logicWorldID.ToString()),
                    new KeyValuePair <string, string>("status", "1"),
                    new KeyValuePair <string, string>("errorcode", result.ToString())
                };
                Singleton <ApolloHelper> .GetInstance().ApolloRepoertEvent("Service_PlatformLogin", events, true);

                Singleton <EventRouter> .GetInstance().BroadCastEvent(EventID.ApolloHelper_Login_Failed);

                return;
            }
            Debug.Log(string.Format("Set login by none platform success", result, platform));
            break;
        }

        case ApolloPlatform.WTLogin:
            Singleton <EventRouter> .GetInstance().BroadCastEvent(EventID.ApolloHelper_Login_Failed);

            return;
        }
        ApolloConfig.Uin      = uin;
        ApolloConfig.Password = pwd;
        ApolloConfig.platform = this.m_CurPlatform = platform;
        if (ApolloConfig.platform == ApolloPlatform.None)
        {
            Singleton <EventRouter> .GetInstance().BroadCastEvent <ApolloAccountInfo>(EventID.ApolloHelper_Login_Success, this.GetAccountInfo(false));
        }
        else
        {
            this.OnLogin(platform);
        }
    }
예제 #17
0
 public ApolloHelper()
 {
     IApollo.Instance.Initialize(this.info);
     IApollo.Instance.SetApolloLogger(ApolloLogPriority.None, null);
     this.accountService                  = IApollo.Instance.GetAccountService();
     this.payService                      = null;
     this.registerInfo                    = new RegisterInfo();
     this.snsService                      = IApollo.Instance.GetService(1) as IApolloSnsService;
     this.reportService                   = IApollo.Instance.GetService(3) as IApolloReportService;
     this.quickLoginService               = IApollo.Instance.GetService(7) as IApolloQuickLoginService;
     this.m_IsSwitchToLoginPlatform       = false;
     this.m_IsLoginEventHandlerRegistered = false;
     this.m_IsLoginReturn                 = false;
     this.m_CurPlatform                   = ApolloPlatform.None;
     this.m_LastOpenID                    = null;
     this.m_LastTriedPlatform             = ApolloPlatform.None;
     this.m_IsLastTriedPlatformSet        = false;
 }
    public void Login(ApolloPlatform platform, bool wait = true, ulong uin = 0uL, string pwd = null)
    {
        Singleton <CUIManager> .GetInstance().OpenSendMsgAlert(5, enUIEventID.None);

        if (wait)
        {
            if (this.loginTimerSeq > 0)
            {
                Singleton <CTimerManager> .GetInstance().RemoveTimerSafely(ref this.loginTimerSeq);
            }
            this.loginTimerSeq = Singleton <CTimerManager> .GetInstance().AddTimer(3000, 1, delegate(int sequence)
            {
                this.LoginHandler(platform, uin, pwd);
            });
        }
        else
        {
            this.LoginHandler(platform, uin, pwd);
        }
    }
예제 #19
0
        public override IApolloConnector CreateApolloConnection(ApolloPlatform platform, uint permission, string url)
        {
            ADebug.Log("CreateApolloConnection");
            if (string.IsNullOrEmpty(url))
            {
                throw new Exception("Argument Error: url can not be null or empty");
            }
            if (ApolloCommon.ApolloInfo == null)
            {
                throw new Exception("IApollo.Instance.Initialize must be called first!");
            }
            if (platform == ApolloPlatform.None)
            {
            }
            ApolloConnector apolloConnector = new ApolloConnector();
            ApolloResult    apolloResult    = apolloConnector.Initialize(platform, permission, url);

            if (apolloResult != ApolloResult.Success)
            {
                throw new Exception("connector Initialize Error:" + apolloResult);
            }
            return(apolloConnector);
        }
예제 #20
0
 public override ApolloShareResult FromString(string src)
 {
     string[] array = src.Split(new char[]
     {
         '&'
     });
     string[] array2 = array;
     for (int i = 0; i < array2.Length; i++)
     {
         string   text   = array2[i];
         string[] array3 = text.Split(new char[]
         {
             '='
         });
         if (array3.Length > 1)
         {
             if (array3[0].CompareTo("Platform") == 0)
             {
                 this.platform = (ApolloPlatform)int.Parse(array3[1]);
             }
             else if (array3[0].CompareTo("nResult") == 0)
             {
                 this.result = (ApolloResult)int.Parse(array3[1]);
             }
             else if (array3[0].CompareTo("szDescription") == 0)
             {
                 this.drescription = array3[1];
             }
             else if (array3[0].CompareTo("szExt") == 0)
             {
                 this.extInfo = array3[1];
             }
         }
     }
     return(this);
 }
예제 #21
0
 public override IApolloConnector CreateApolloConnection(ApolloPlatform platform, ApolloPermission permission, string url)
 {
     return(this.CreateApolloConnection(platform, (uint)permission, url));
 }
예제 #22
0
    private void OnLoginEvent(ApolloResult loginResult, ApolloAccountInfo accountInfo)
    {
        this.m_IsSwitchToLoginPlatform = false;
        if (loginResult != ApolloResult.Success)
        {
            if (loginResult == ApolloResult.UserCancel)
            {
                BugLocateLogSys.Log(string.Format("Login Fail. User cancel", new object[0]));
                Singleton <EventRouter> .GetInstance().BroadCastEvent(EventID.ApolloHelper_Login_Canceled);
            }
            else
            {
                BugLocateLogSys.Log(string.Format("Login Fail. Error code is {0}", loginResult));
                List <KeyValuePair <string, string> > events = new List <KeyValuePair <string, string> > {
                    new KeyValuePair <string, string>("g_version", CVersion.GetAppVersion()),
                    new KeyValuePair <string, string>("WorldID", MonoSingleton <TdirMgr> .GetInstance().SelectedTdir.logicWorldID.ToString()),
                    new KeyValuePair <string, string>("platform", Singleton <ApolloHelper> .GetInstance().CurPlatform.ToString()),
                    new KeyValuePair <string, string>("openid", "NULL")
                };
                float num = Time.time - Singleton <CLoginSystem> .GetInstance().m_fLoginClickTime;

                events.Add(new KeyValuePair <string, string>("totaltime", num.ToString()));
                events.Add(new KeyValuePair <string, string>("errorcode", loginResult.ToString()));
                events.Add(new KeyValuePair <string, string>("error_msg", "null"));
                Singleton <ApolloHelper> .GetInstance().ApolloRepoertEvent("Service_Login_MSDKClientAuth", events, true);

                Singleton <EventRouter> .GetInstance().BroadCastEvent <ApolloResult>(EventID.ApolloHelper_Login_Failed, loginResult);
            }
        }
        else
        {
            if (this.m_LastOpenID == null)
            {
                switch (this.CurPlatform)
                {
                case ApolloPlatform.Wechat:
                case ApolloPlatform.QRWechat:
                    if (accountInfo.Platform != ApolloPlatform.Wechat)
                    {
                        this.Logout();
                        return;
                    }
                    break;

                case ApolloPlatform.QQ:
                case ApolloPlatform.WTLogin:
                case ApolloPlatform.QR:
                    if (accountInfo.Platform == ApolloPlatform.QQ)
                    {
                        break;
                    }
                    this.Logout();
                    return;
                }
            }
            ApolloConfig.platform = this.CurPlatform = accountInfo.Platform;
            if ((this.m_LastOpenID != null) && (accountInfo.OpenId != this.m_LastOpenID))
            {
                Singleton <CUIManager> .GetInstance().OpenMessageBox(Singleton <CTextManager> .GetInstance().GetText("Common_Login_Different_Account_Tip_Force"), enUIEventID.Login_Change_Account_Yes, false);

                return;
            }
            if (this.JudgeLoginAccountInfo(ref accountInfo))
            {
                Singleton <EventRouter> .GetInstance().BroadCastEvent <ApolloAccountInfo>(EventID.ApolloHelper_Login_Success, accountInfo);
            }
            else
            {
                Singleton <EventRouter> .GetInstance().BroadCastEvent <ApolloAccountInfo>(EventID.ApolloHelper_Login_Failed, accountInfo);
            }
        }
        if (this.accountService != null)
        {
            this.accountService.LoginEvent -= new AccountLoginHandle(this.OnLoginEvent);
        }
        else
        {
            BugLocateLogSys.Log("accountService == null");
        }
        this.m_IsLoginEventHandlerRegistered = false;
        this.m_IsLoginReturn = true;
        BugLocateLogSys.Log("LoginEvent Thread:" + Thread.CurrentThread.ManagedThreadId);
    }
예제 #23
0
 public bool IsPlatformInstalled(ApolloPlatform platform)
 {
     return(apollo_account_IsPlatformInstalled(platform));
 }
예제 #24
0
 public bool IsPlatformSupportApi(ApolloPlatform platform)
 {
     return(apollo_account_IsPlatformSupportApi(platform));
 }
예제 #25
0
 public bool IsPlatformInstalled(ApolloPlatform platform)
 {
     return(this.accountService.IsPlatformInstalled(platform));
 }
예제 #26
0
 public void Login(ApolloPlatform platform)
 {
     ADebug.Log("Login");
     apollo_account_login(base.ObjectId, platform);
 }
예제 #27
0
 private static extern int apollo_connector_Initialize(ulong objId, ApolloPlatform platform, uint permission, [MarshalAs(20)] string pszSvrUrl);
예제 #28
0
 public override IApolloConnector CreateApolloConnection(ApolloPlatform platform, string url)
 {
     return(this.CreateApolloConnection(platform, 16777215u, url));
 }
예제 #29
0
 private void InitTdir(ApolloPlatform platform)
 {
     this.mPlatform = platform;
     this.InitSvrList();
 }
    private void OnLoginEvent(ApolloResult loginResult, ApolloAccountInfo accountInfo)
    {
        Singleton <CUIManager> .GetInstance().CloseSendMsgAlert();

        Singleton <ApolloHelper> .GetInstance().IsLastLaunchFrom3rdAPP = false;

        Debug.Log(string.Concat(new object[]
        {
            "*Login*OnLoginEvent called ",
            loginResult,
            " ",
            Time.realtimeSinceStartup
        }));
        this.m_IsSwitchToLoginPlatform = false;
        if (loginResult == ApolloResult.Success)
        {
            ApolloConfig.platform = (this.CurPlatform = accountInfo.Platform);
            if (!string.IsNullOrEmpty(this.m_LastOpenID) && accountInfo.OpenId != this.m_LastOpenID)
            {
                Singleton <CUIManager> .GetInstance().OpenMessageBox(Singleton <CTextManager> .GetInstance().GetText("Common_Login_Different_Account_Tip_Force"), enUIEventID.Login_Change_Account_Yes, false);

                return;
            }
            if (this.JudgeLoginAccountInfo(ref accountInfo))
            {
                Singleton <EventRouter> .GetInstance().BroadCastEvent <ApolloAccountInfo>(EventID.ApolloHelper_Login_Success, accountInfo);
            }
            else
            {
                Singleton <EventRouter> .GetInstance().BroadCastEvent <ApolloResult>(EventID.ApolloHelper_Login_Failed, ApolloResult.Empty);
            }
        }
        else if (loginResult == ApolloResult.UserCancel)
        {
            BugLocateLogSys.Log(string.Format("Login Fail. User cancel", new object[0]));
            Singleton <EventRouter> .GetInstance().BroadCastEvent(EventID.ApolloHelper_Login_Canceled);
        }
        else if (loginResult == ApolloResult.NeedRealNameAuth)
        {
            Debug.Log("Login NeedRealNameAuth.");
            BugLocateLogSys.Log(string.Format("Login NeedRealNameAuth.", new object[0]));
            Singleton <EventRouter> .GetInstance().BroadCastEvent(EventID.ApolloHelper_Login_Need_Real_Name_Auth);
        }
        else
        {
            BugLocateLogSys.Log(string.Format("Login Fail. Error code is {0}", loginResult));
            List <KeyValuePair <string, string> > list = new List <KeyValuePair <string, string> >();
            list.Add(new KeyValuePair <string, string>("g_version", CVersion.GetAppVersion()));
            list.Add(new KeyValuePair <string, string>("WorldID", MonoSingleton <TdirMgr> .GetInstance().SelectedTdir.logicWorldID.ToString()));
            list.Add(new KeyValuePair <string, string>("platform", Singleton <ApolloHelper> .GetInstance().CurPlatform.ToString()));
            list.Add(new KeyValuePair <string, string>("openid", "NULL"));
            list.Add(new KeyValuePair <string, string>("totaltime", (Time.time - Singleton <CLoginSystem> .GetInstance().m_fLoginClickTime).ToString()));
            list.Add(new KeyValuePair <string, string>("errorCode", loginResult.ToString()));
            list.Add(new KeyValuePair <string, string>("error_msg", "null"));
            Singleton <ApolloHelper> .GetInstance().ApolloRepoertEvent("Service_Login_MSDKClientAuth", list, true);

            Singleton <EventRouter> .GetInstance().BroadCastEvent <ApolloResult>(EventID.ApolloHelper_Login_Failed, loginResult);
        }
        if (this.accountService == null)
        {
            BugLocateLogSys.Log("accountService == null");
        }
        this.m_IsLoginReturn = true;
        BugLocateLogSys.Log("LoginEvent Thread:" + Thread.get_CurrentThread().get_ManagedThreadId());
    }