Exemple #1
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 #2
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;
            }
        }