Exemple #1
0
        private void OnLoginBaseRetEvent(MSDKBaseRet baseRet)
        {
            // Debug.Log("OnBaseRetNotify in Login");

            if (baseRet.MethodNameId == (int)MSDKMethodNameID.MSDK_LOGIN_WAKEUP)
            {
                handleDiifAccount(baseRet);
            }
            else if (baseRet.MethodNameId == (int)MSDKMethodNameID.MSDK_LOGIN_LOGOUT)
            {
                string methodTag = "Logout";
                //  SampleInstance.showRetDialog(methodTag, baseRet);
                LoginFinish(ActionLogin.Logout, MSDKLogin.GetLoginRet(), baseRet);
            }
        }
Exemple #2
0
        // 处理异账号的逻辑
        private void handleDiifAccount(MSDKBaseRet baseRet)
        {
            string methodTag = "异账号";

            switch (baseRet.RetCode)
            {
            case MSDKError.SUCCESS:
            {         // 本地原有票据有效,使用原有票据登录
                      // SampleInstance.showRetDialog(methodTag, "使用原有票据登录,游戏无需处理");
                LoginCallback.OnLoginSuccess(MSDKLogin.GetLoginRet(), true);
                break;
            }

            case MSDKError.LOGIN_ACCOUNT_REFRESH:
            {         // 新旧 openid 相同,票据不同。刷新登录票据
                      // SampleInstance.showRetDialog(methodTag, "新旧 openid 相同,票据不同。刷新登录票据,游戏无需处理");
                LoginCallback.OnLoginSuccess(MSDKLogin.GetLoginRet(), true);
                break;
            }

            case MSDKError.LOGIN_URL_USER_LOGIN:
            {        // 本地无openid,拉起有票据,使用新票据登录
                //SampleInstance.showRetDialog(methodTag, "本地无openid,拉起有票据,使用新票据登录,将自动触发切换游戏账号逻辑(SwitchUser),游戏需监控登录的回调结果");
                break;
            }

            case MSDKError.LOGIN_NEED_SELECT_ACCOUNT:
            {
                // SampleInstance.ShowSwithUserDialog();
                LoginCallback.OnSwitchUser();
                break;
            }

            case MSDKError.LOGIN_NEED_LOGIN:
            {
                //  SampleInstance.showRetDialog(methodTag, "票据均无效,进入登录页面");
                MSDKLoginRet ret = MSDKLogin.GetLoginRet();
                LoginCallback.OnLoginFailure(ret.RetCode, ret.RetMsg);
            }
            break;

            default:
                break;
            }
        }
Exemple #3
0
        // private bool LoginWithConfirmCode = true;

        private void LoginFinish(ActionLogin action, MSDKLoginRet loginRet, MSDKBaseRet baseRet = null)
        {
            if (LoginCallback == null)
            {
                return;
            }
            switch (action)
            {
            case ActionLogin.OnlyRefreshLoginData:
                LoginCallback.OnLoginSuccess(loginRet, true);
                break;

            case ActionLogin.CHANNEL_LOGIN:
                if (loginRet.RetCode == MSDKError.SUCCESS)
                {
                    LoginCallback.OnLoginSuccess(loginRet);
                }
                else
                {
                    LoginCallback.OnLoginFailure(loginRet.RetCode, loginRet.RetMsg);
                }
                break;

            case ActionLogin.AUTO_LOGIN:
                if (loginRet.RetCode == MSDKError.SUCCESS)
                {
                    LoginCallback.OnLoginSuccess(loginRet);
                }
                else
                {
                    LoginCallback.OnAutoLoginFailed();
                }
                break;

            case ActionLogin.SWITCH_USER:
                LoginCallback.OnSwitchUser();
                break;

            case ActionLogin.Logout:
                LoginCallback.OnLogoutSuccess();
                break;
            }
        }
Exemple #4
0
 public string OnCrashBaseRetEvent(MSDKBaseRet baseRet)
 {
     if (baseRet.MethodNameId == (int)MSDKMethodNameID.MSDK_CRASH_CALLBACK_EXTRA_DATA)
     {
         // 这里是非unity进程,注意不要做unity相关的操作
         if (crashCallback != null)
         {
             return(crashCallback.GetExtraData());
         }
         return("this is extra data.");
     }
     else if (baseRet.MethodNameId == (int)MSDKMethodNameID.MSDK_CRASH_CALLBACK_EXTRA_MESSAGE)
     {
         // 这里是非unity进程,注意不要做unity相关的操作
         if (crashCallback != null)
         {
             return(crashCallback.GetExtraMessage());
         }
         return("this is extra message.");
     }
     return("");
 }
Exemple #5
0
        public void OnPushBaseRetEvent(MSDKBaseRet baseRet)
        {
            string methodTag = "";

            if (baseRet.MethodNameId == (int)MSDKMethodNameID.MSDK_PUSH_REGISTER_PUSH)
            {
                methodTag = "RegisterPush";
            }
            else if (baseRet.MethodNameId == (int)MSDKMethodNameID.MSDK_PUSH_UNREGISTER_PUSH)
            {
                methodTag = "UnregisterPush";
            }
            else if (baseRet.MethodNameId == (int)MSDKMethodNameID.MSDK_PUSH_SET_TAG)
            {
                methodTag = "SetTag";
            }
            else if (baseRet.MethodNameId == (int)MSDKMethodNameID.MSDK_PUSH_DELETE_TAG)
            {
                methodTag = "DeleteTag";
            }


            //  SampleInstance.showRetDialog(methodTag, baseRet);
        }