Ejemplo n.º 1
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());
             }
         }
     }
 }
Ejemplo n.º 2
0
    private void OnLoginEvent(ApolloResult loginResult, ApolloAccountInfo loginfo)
    {
        Debug.Log("OnLoginEvent called");
        this.m_IsSwitchToLoginPlatform = false;
        if (loginResult == ApolloResult.Success)
        {
            if (loginfo != null)
            {
                if ((this.m_LastOpenID != null) && (loginfo.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;
                }
                Singleton <EventRouter> .GetInstance().BroadCastEvent <ApolloAccountInfo>(EventID.ApolloHelper_Login_Success, loginfo);
            }
        }
        else if (loginResult == ApolloResult.UserCancel)
        {
            Debug.Log("Login Fail. User cancel");
            BugLocateLogSys.Log(string.Format("Login Fail. User cancel", new object[0]));
            Singleton <EventRouter> .GetInstance().BroadCastEvent(EventID.ApolloHelper_Login_Canceled);
        }
        else
        {
            Debug.Log(string.Format("Login Fail. Error code is {0}", loginResult));
            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>("WorldID", MonoSingleton <TdirMgr> .GetInstance().SelectedTdir.logicWorldID.ToString()),
                new KeyValuePair <string, string>("status", "1"),
                new KeyValuePair <string, string>("errorcode", loginResult.ToString())
            };
            Singleton <ApolloHelper> .GetInstance().ApolloRepoertEvent("Service_PlatformLogin", events, true);

            Singleton <EventRouter> .GetInstance().BroadCastEvent(EventID.ApolloHelper_Login_Failed);
        }
        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);
    }
Ejemplo n.º 3
0
    public string GetRecordStr()
    {
        ApolloAccountInfo accountInfo = new ApolloAccountInfo();

        if (this.accountService == null)
        {
            BugLocateLogSys.Log("accountService == null");
            return("accountService == null");
        }
        ApolloResult record = this.accountService.GetRecord(ref accountInfo);

        if (record == ApolloResult.Success)
        {
            BugLocateLogSys.Log("GetRecord Success");
            return(this.GetAccountInfoStr(ref accountInfo));
        }
        BugLocateLogSys.Log(string.Format("GetRecord result is {0}", record));
        return(string.Empty);
    }
Ejemplo n.º 4
0
 private void ParseFramesData()
 {
     try
     {
         while (this.nRecvByteSize > 0)
         {
             int   usedSize = 0;
             CSPkg msg      = CSPkg.New();
             if ((msg.unpack(ref this.szRecvBuffer, this.nRecvByteSize, ref usedSize, 0) != TdrError.ErrorType.TDR_NO_ERROR) || (usedSize <= 0))
             {
                 return;
             }
             Buffer.BlockCopy(this.szRecvBuffer, usedSize, this.szRecvBuffer, 0, this.nRecvByteSize - usedSize);
             this.nRecvByteSize -= usedSize;
             this.AddCachePkg(msg);
         }
     }
     catch (Exception exception)
     {
         BugLocateLogSys.Log("ParseFramesCacheData " + exception.Message);
     }
 }
Ejemplo n.º 5
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);
    }
Ejemplo n.º 6
0
    private void ProcessShowNoticeWindown(ApolloNoticeData noticeData)
    {
        this.m_bGoto      = false;
        this.m_bLoadImage = false;
        string msgID  = noticeData.MsgID;
        string openID = noticeData.OpenID;
        string text   = noticeData.MsgUrl;
        ListView <UrlAction> listView = UrlAction.ParseFromText(noticeData.ContentUrl, null);

        if (listView.Count > 0)
        {
            this.m_urlAction = listView[0];
        }
        else
        {
            this.m_urlAction = null;
        }
        if (text == null)
        {
            text = string.Empty;
        }
        APOLLO_NOTICETYPE         msgType     = noticeData.MsgType;
        string                    startTime   = noticeData.StartTime;
        APOLLO_NOTICE_CONTENTTYPE contentType = noticeData.ContentType;
        string                    msgTitle    = noticeData.MsgTitle;
        string                    msgContent  = noticeData.MsgContent;

        NoticeSys.PrintLog(string.Concat(new object[]
        {
            " msgID ",
            noticeData.MsgID,
            " MsgUrl",
            text,
            "msgtitle = ",
            msgTitle,
            " content ",
            msgContent,
            " openid= ",
            openID,
            " MsgType  = ",
            msgType,
            " contenturl =",
            noticeData.ContentUrl
        }));
        uint num = 0u;

        if (this.m_CurState == NoticeSys.NOTICE_STATE.LOGIN_After)
        {
            CRoleInfo masterRoleInfo = Singleton <CRoleInfoManager> .GetInstance().GetMasterRoleInfo();

            if (masterRoleInfo != null)
            {
                num = masterRoleInfo.PvpLevel;
            }
        }
        else
        {
            num = 0u;
        }
        this.m_btnUrl   = string.Empty;
        this.m_btnDoSth = NoticeSys.BTN_DOSOMTHING.BTN_DOSOMTHING_NONE;
        if (msgType == APOLLO_NOTICETYPE.APO_NOTICETYPE_ALERT)
        {
            bool flag  = false;
            bool flag2 = this.CheckIsBtnUrl(text, ref flag, ref this.m_ImageModleTitle, ref this.m_btnDoSth, ref this.m_btnUrl);
            if (flag2)
            {
                if (flag)
                {
                    bool flag3 = false;
                    flag2 = this.CheckIsBtnUrl("#" + this.m_btnUrl + "&end", ref flag3, ref this.m_ImageModleTitle, ref this.m_btnDoSth, ref this.m_btnUrl);
                }
                if (this.m_btnDoSth == NoticeSys.BTN_DOSOMTHING.BTN_DOSOMTHING_NOTSHOW && this.m_btnUrl != MonoSingleton <TdirMgr> .GetInstance().SelectedTdir.logicWorldID.ToString())
                {
                    NoticeSys.PrintLog("noticesys not show " + this.m_btnUrl);
                    return;
                }
                NoticeSys.PrintLog("find url " + this.m_btnUrl + " ori = " + text);
            }
            else
            {
                NoticeSys.PrintLog("find url   ori = " + text);
            }
            if (this.m_CurState == NoticeSys.NOTICE_STATE.LOGIN_After && num <= 5u)
            {
                this.m_btnDoSth = NoticeSys.BTN_DOSOMTHING.BTN_DOSOMTHING_NONE;
                this.m_btnUrl   = string.Empty;
            }
            if (this.m_Form == null)
            {
                this.m_Form = Singleton <CUIManager> .GetInstance().OpenForm(NoticeSys.s_formNoticeLoginPath, false, true);
            }
            Transform transform = this.m_Form.gameObject.transform.Find("Panel/BtnGroup/Button_Complte");
            if (this.m_btnUrl != string.Empty && this.m_btnDoSth != NoticeSys.BTN_DOSOMTHING.BTN_DOSOMTHING_NONE)
            {
                this.m_bGoto = true;
            }
            else
            {
                this.m_bGoto = false;
            }
            this.m_bShow        = true;
            this.m_TextContent  = Utility.GetComponetInChild <Text>(this.m_Form.gameObject, "Panel/ScrollRect/Content/Text");
            this.m_ImageContent = Utility.GetComponetInChild <Image>(this.m_Form.gameObject, "Panel/Image");
            this.m_ImageDefault = Utility.GetComponetInChild <Image>(this.m_Form.gameObject, "Panel/ImageDefalut");
            this.m_Title        = Utility.GetComponetInChild <Text>(this.m_Form.gameObject, "Panel/GameObject/Title/ContentTitle");
            this.m_TitleBoard   = this.m_Form.gameObject.transform.Find("Panel/GameObject/Title").gameObject;
            this.m_TextContent.gameObject.CustomSetActive(false);
            this.m_ImageContent.gameObject.CustomSetActive(false);
            if (this.m_ImageDefault)
            {
                this.m_ImageDefault.gameObject.CustomSetActive(false);
            }
            this.m_Title.set_text(msgTitle);
            if (contentType != APOLLO_NOTICE_CONTENTTYPE.APO_CONTENTTYPE_IMAGE)
            {
                if (contentType == APOLLO_NOTICE_CONTENTTYPE.APO_SCONTENTTYPE_TEXT)
                {
                    this.m_TextContent.gameObject.CustomSetActive(true);
                    this.m_TextContent.set_text(msgContent);
                    this.m_TitleBoard.CustomSetActive(true);
                    RectTransform component = this.m_TextContent.transform.parent.gameObject.GetComponent <RectTransform>();
                    if (component)
                    {
                        component.sizeDelta = new Vector2(0f, this.m_TextContent.get_preferredHeight() + 50f);
                    }
                }
                else if (contentType == APOLLO_NOTICE_CONTENTTYPE.APO_CONTENTTYPE_WEB && this.m_urlAction != null)
                {
                    this.m_bShow = true;
                    this.m_TitleBoard.CustomSetActive(true);
                    this.m_Title.set_text(this.m_ImageModleTitle);
                    if (this.m_ImageDefault)
                    {
                        this.m_ImageDefault.gameObject.CustomSetActive(true);
                    }
                    this.m_ImageContent.gameObject.CustomSetActive(false);
                    base.StartCoroutine(MonoSingleton <IDIPSys> .GetInstance().DownloadImage(this.m_urlAction.target, delegate(Texture2D text2)
                    {
                        if (this.m_bShow && this.m_ImageContent != null)
                        {
                            this.m_ImageContent.gameObject.CustomSetActive(true);
                            if (this.m_ImageDefault)
                            {
                                this.m_ImageDefault.gameObject.CustomSetActive(false);
                            }
                            this.m_bLoadImage = true;
                            this.m_ImageContent.SetSprite(Sprite.Create(text2, new Rect(0f, 0f, (float)text2.width, (float)text2.height), new Vector2(0.5f, 0.5f)), ImageAlphaTexLayout.None);
                            BugLocateLogSys.Log("noticesysy contenturl " + this.m_urlAction.target);
                        }
                    }, 0));
                }
            }
        }
    }
    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());
    }