Exemplo n.º 1
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);
    }
Exemplo n.º 2
0
    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);
    }
Exemplo n.º 3
0
    private void OnLoginEvent(ApolloResult loginResult, ApolloAccountInfo accountInfo)
    {
        Debug.Log(string.Concat(new object[]
        {
            "*Login*OnLoginEvent called ",
            loginResult,
            " ",
            Time.realtimeSinceStartup
        }));
        this.m_IsSwitchToLoginPlatform = false;
        if (loginResult == null)
        {
            ApolloConfig.platform = (this.CurPlatform = accountInfo.get_Platform());
            if (this.m_LastOpenID != null && accountInfo.get_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, 7);
            }
        }
        else if (loginResult == 12)
        {
            BugLocateLogSys.Log(string.Format("Login Fail. User cancel", new object[0]));
            Singleton <EventRouter> .GetInstance().BroadCastEvent(EventID.ApolloHelper_Login_Canceled);
        }
        else if (loginResult == 22)
        {
            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());
    }
Exemplo n.º 4
0
 public bool JudgeLoginAccountInfo(ref ApolloAccountInfo accountInfo)
 {
     return((accountInfo.get_Platform() != null || this.IsNoneModeSupport) && !string.IsNullOrEmpty(accountInfo.get_OpenId()));
 }