Example #1
0
    void IAPExternalCall(string msg)
    {
        Debug.Log("IAPExternalCall(" + msg + ")");
        Dictionary <string, string> dic = AnySDKUtil.stringToDictionary(msg);
        int    code   = Convert.ToInt32(dic["code"]);
        string result = dic["msg"];

        switch (code)
        {
        case (int)PayResultCode.kPaySuccess:        //支付成功回调
            LoadingDialog.CloseDialog();
            break;

        case (int)PayResultCode.kPayFail:        //支付失败回调
            LoadingDialog.CloseDialog();
            break;

        case (int)PayResultCode.kPayCancel:        //支付取消回调
            LoadingDialog.CloseDialog();
            break;

        case (int)PayResultCode.kPayNetworkError:        //支付超时回调
            LoadingDialog.CloseDialog();
            break;

        case (int)PayResultCode.kPayProductionInforIncomplete:        //支付信息不完整
            LoadingDialog.CloseDialog();
            break;

        /**
         * 新增加:正在进行中回调
         * 支付过程中若SDK没有回调结果,就认为支付正在进行中
         * 游戏开发商可让玩家去判断是否需要等待,若不等待则进行下一次的支付
         */
        case (int)PayResultCode.kPayNowPaying:
            break;

        default:
            break;
        }
    }
Example #2
0
    private void IAPExternalCall(string msg)
    {
        Debug.Log("IAPExternalCall(" + msg + ")");
        Dictionary <string, string> dictionary = AnySDKUtil.stringToDictionary(msg);
        int    num  = Convert.ToInt32(dictionary["code"]);
        string text = dictionary["msg"];

        switch (num)
        {
        case 0:
            Debug.Log("IAPExternalCall(" + this.anySDKIAP.getOrderId(this.anySDKIAP.getPluginId()[0]) + ")");
            InitSDK.instance.orderBack("0");
            break;

        case 1:
            Singleton <TipView> .Instance.ShowViewSetText("支付失败,请重试!", 2f);

            break;

        case 2:
            Singleton <TipView> .Instance.ShowViewSetText("支付取消,请重试!", 2f);

            break;

        case 3:
            Singleton <TipView> .Instance.ShowViewSetText("支付超时,请重试!", 2f);

            break;

        case 4:
            Singleton <TipView> .Instance.ShowViewSetText("支付信息不完整,请重试!", 2f);

            break;

        case 7:
            Singleton <TipView> .Instance.ShowViewSetText("支付正在进行中,未收到支付结果。是否需要等待,若不等待则进行下一次的支付!", 2f);

            break;
        }
    }
        public void IAPExternalCall(string msg)
        {
            MyLog.InfoWithFrame(name, "IAPExternalCall(" + msg + ")");
            var dic    = AnySDKUtil.stringToDictionary(msg);
            var code   = Convert.ToInt32(dic["code"]);
            var result = dic["msg"];

            switch (code)
            {
            case (int)PayResultCode.kPaySuccess:      //支付成功回调
                break;

            case (int)PayResultCode.kPayFail:      //支付失败回调
                break;

            case (int)PayResultCode.kPayCancel:      //支付取消回调
                break;

            case (int)PayResultCode.kPayNetworkError:      //支付超时回调
                break;

            case (int)PayResultCode.kPayProductionInforIncomplete:      //支付信息不完整
                break;

            /**
             * 新增加:正在进行中回调
             * 支付过程中若 SDK 没有回调结果,就认为支付正在进行中
             * 游戏开发商可让玩家去判断是否需要等待,若不等待则进行下一次的支付
             */
            case (int)PayResultCode.kPayNowPaying:
                break;

            default:
                break;
            }
        }
        public void UserExternalCall(string msg)
        {
            MyLog.InfoWithFrame(name, "UserExternalCall(" + msg + ")");
            var dic    = AnySDKUtil.stringToDictionary(msg);
            var code   = Convert.ToInt32(dic["code"]);
            var result = dic["msg"];

            MyLog.InfoWithFrame(name, "UserExternalCall result is  (" + result + ")");
            switch (code)
            {
            case (int)UserActionResultCode.kInitSuccess:      //初始化SDK成功回调
                //login方法需要在初始化成功之后调用
                break;

            case (int)UserActionResultCode.kInitFail:      //初始化SDK失或者退出游戏败回调
                //尝试重新初始化,
                break;

            case (int)UserActionResultCode.kLoginSuccess:      //登陆成功回调
                //可使用getUserID()获取用户ID
                break;

            case (int)UserActionResultCode.kLoginNetworkError: //登陆网络出错回调
            case (int)UserActionResultCode.kLoginCancel:       //登陆取消回调
            case (int)UserActionResultCode.kLoginFail:         //登陆失败回调
                break;

            case (int)UserActionResultCode.kLogoutSuccess:      //登出成功回调
                //一般可以做初始化游戏,并且重新调用登录接口操作
                break;

            case (int)UserActionResultCode.kLogoutFail:      //登出失败回调
                break;

            case (int)UserActionResultCode.kPlatformEnter:      //平台中心进入回调
                break;

            case (int)UserActionResultCode.kPlatformBack:      //平台中心退出回调
                break;

            case (int)UserActionResultCode.kPausePage:      //暂停界面回调
                break;

            case (int)UserActionResultCode.kExitPage:      //退出游戏回调
                //参考下方退出界面文档
                break;

            case (int)UserActionResultCode.kAntiAddictionQuery:      //防沉迷查询回调
                break;

            case (int)UserActionResultCode.kRealNameRegister:      //实名注册回调
                break;

            case (int)UserActionResultCode.kAccountSwitchSuccess:      //切换账号成功回调
                //一般可以做重新获取用户ID,和初始化游戏操作
                break;

            case (int)UserActionResultCode.kAccountSwitchFail:      //切换账号失败回调
                break;

            default:
                break;
            }
        }
Example #5
0
    void UserExternalCall(string msg)
    {
        Debug.Log("UserExternalCall(" + msg + ")");
        Dictionary <string, string> dic = AnySDKUtil.stringToDictionary(msg);
        int    code   = Convert.ToInt32(dic["code"]);
        string result = dic["msg"];

        switch (code)
        {
        case (int)UserActionResultCode.kInitSuccess:        //初始化SDK成功回调
            AnySDKUser.getInstance().login();
            break;

        case (int)UserActionResultCode.kInitFail:        //初始化SDK失败回调
            break;

        case (int)UserActionResultCode.kLoginSuccess:        //登陆成功回调
            AnySDKParam param = new AnySDKParam((int)ToolBarPlace.kToolBarBottomLeft);
            if (AnySDKUser.getInstance().isFunctionSupported("showToolBar"))
            {
                AnySDKUser.getInstance().callFuncWithParam("showToolBar", param);
            }

            if (AnySDKUser.getInstance().isFunctionSupported("enterPlatform"))
            {
                AnySDKUser.getInstance().callFuncWithParam("enterPlatform");
            }
            break;

        case (int)UserActionResultCode.kLoginNetworkError: //登陆失败回调
        case (int)UserActionResultCode.kLoginCancel:       //登陆取消回调
        case (int)UserActionResultCode.kLoginFail:         //登陆失败回调
            break;

        case (int)UserActionResultCode.kLogoutSuccess:        //登出成功回调
            break;

        case (int)UserActionResultCode.kLogoutFail:        //登出失败回调
            break;

        case (int)UserActionResultCode.kPlatformEnter:        //平台中心进入回调

            break;

        case (int)UserActionResultCode.kPlatformBack:        //平台中心退出回调
            break;

        case (int)UserActionResultCode.kPausePage:        //暂停界面回调
            break;

        case (int)UserActionResultCode.kExitPage:        //退出游戏回调
            break;

        case (int)UserActionResultCode.kAntiAddictionQuery:        //防沉迷查询回调
            break;

        case (int)UserActionResultCode.kRealNameRegister:        //实名注册回调
            break;

        case (int)UserActionResultCode.kAccountSwitchSuccess:        //切换账号成功回调
            break;

        case (int)UserActionResultCode.kAccountSwitchFail:        //切换账号成功回调
            break;

        case (int)UserActionResultCode.kOpenShop:        //应用汇  悬浮窗点击粮饷按钮回调
            break;

        default:
            break;
        }
    }
Example #6
0
    public void UserExternalCall(string msg)
    {
        Debug.Log("UserExternalCall(" + msg + ")");
        Dictionary <string, string> dictionary = AnySDKUtil.stringToDictionary(msg);
        int    num  = Convert.ToInt32(dictionary["code"]);
        string text = dictionary["msg"];

        switch (num)
        {
        case 0:
            InitSDK.instance.isInit = true;
            if (InitSDK.instance.needLogin)
            {
                NetWorkHelper.Instance.GateReconnection.LeaveGame("leave");
                this.login();
            }
            else
            {
                LoginStateManager.Instance.ChangeState(LoginStateCode.LoginState_Init);
            }
            InitSDK.instance.needLogin = false;
            break;

        case 1:
            InitSDK.instance.isInit = false;
            Debug.Log("InitAnySDK init fail");
            CtrlManager.ShowMsgBox("初始化失败", "是否进行重试?", new Action <bool>(this.AgainCall), PopViewType.PopOneButton, "确定", "取消", null);
            break;

        case 2:
            GlobalObject.Instance.SetCanPause(true);
            this.coroutineManager.StartCoroutine(InitSDK.instance.TryLoginByChannelId(AnySDK.getInstance().getChannelId(), this.anySDKUser.getUserID()), true);
            break;

        case 3:
        case 5:
        case 6:
            Singleton <LoginView_New> .Instance.SDKLoginFail();

            if (Singleton <NewWaitingView> .Instance.IsOpen)
            {
                Singleton <NewWaitingView> .Instance.Destroy();
            }
            break;

        case 7:
            if (Singleton <AreaView> .Instance.gameObject != null && Singleton <AreaView> .Instance.gameObject.active)
            {
                MobaMessageManagerTools.SendClientMsg(ClientV2C.AreaViewNew_goback, null, false);
            }
            else
            {
                CtrlManager.ShowMsgBox("账号登出", "重新登陆", new Action <bool>(this.ExitCall), PopViewType.PopOneButton, "确定", "取消", null);
            }
            break;

        case 8:
            if (Singleton <AreaView> .Instance.gameObject != null && Singleton <AreaView> .Instance.gameObject.active)
            {
                MobaMessageManagerTools.SendClientMsg(ClientV2C.AreaViewNew_goback, null, false);
            }
            else
            {
                CtrlManager.ShowMsgBox("账号登出失败", "重新登陆", new Action <bool>(this.ExitCall), PopViewType.PopOneButton, "确定", "取消", null);
            }
            break;

        case 9:
            NetWorkHelper.Instance.GateReconnection.LeaveGame("leave");
            break;

        case 10:
            if (Singleton <NewWaitingView> .Instance.IsOpen && Singleton <NewWaitingView> .Instance.gameObject != null)
            {
                Singleton <NewWaitingView> .Instance.Destroy();
            }
            break;

        case 12:
            if (msg == "onGameExit" || msg == "onNo3rdExiterProvide")
            {
                CtrlManager.ShowMsgBox("确认退出", "确定退出刺激好玩的《魔霸英雄》吗?", new Action <bool>(this.ExitCall), PopViewType.PopTwoButton, "确定", "取消", null);
            }
            else
            {
                this.ExitCall(true);
            }
            break;

        case 15:
            if (Singleton <AreaView> .Instance.gameObject != null && Singleton <AreaView> .Instance.gameObject.active)
            {
                MobaMessageManagerTools.SendClientMsg(ClientV2C.AreaViewNew_goback, null, false);
                this.coroutineManager.StartCoroutine(InitSDK.instance.TryLoginByChannelId(AnySDK.getInstance().getChannelId(), this.anySDKUser.getUserID()), true);
            }
            else
            {
                CtrlManager.ShowMsgBox("账号切换成功", "重新登陆", new Action <bool>(this.ExitCall), PopViewType.PopOneButton, "确定", "取消", null);
            }
            break;

        case 16:
            if (Singleton <AreaView> .Instance.gameObject != null && Singleton <AreaView> .Instance.gameObject.active)
            {
                MobaMessageManagerTools.SendClientMsg(ClientV2C.AreaViewNew_goback, null, false);
            }
            else
            {
                CtrlManager.ShowMsgBox("账号切换失败", "重新登陆", new Action <bool>(this.ExitCall), PopViewType.PopOneButton, "确定", "取消", null);
            }
            break;

        case 17:
            NetWorkHelper.Instance.GateReconnection.LeaveGame("leave");
            break;

        case 19:
            CtrlManager.ShowMsgBox("确认退出", "确定退出刺激好玩的《魔霸英雄》吗?", new Action <bool>(this.ExitCall), PopViewType.PopTwoButton, "确定", "取消", null);
            break;
        }
    }