Ejemplo n.º 1
0
    private void LoginResponse(byte[] bytes)
    {
        Debug.Log("收到登陆响应");
        LoginS2C package     = NetMgr.Instance.DeSerializes <LoginS2C>(bytes);
        int      loginStatus = package.status;

        if (loginStatus == 1)
        {
            Debug.Log("验证成功");
            int userID = package.userId;
            hallServerIP   = package.serverIp;
            hallServerPort = package.port;
            ((GameMgrProxy)Facade.RetrieveProxy(Proxys.GAMEMGR_PROXY)).systemTime = package.time;
            this.GetUserID(userID);
            NetMgr.Instance.StopTcpConnection(SocketType.LOGIN);
            NetMgr.Instance.CreateConnect(SocketType.HALL, hallServerIP, hallServerPort, HallConnectHandler);
        }
        else
        {
            DialogMsgVO dialogVO = new DialogMsgVO();
            dialogVO.dialogType = DialogType.ALERT;
            dialogVO.title      = "登录失败";
            dialogVO.content    = "登录失败,请重新连接";
            DialogView dialogView = UIManager.Instance.ShowUI(UIViewID.DIALOG_VIEW) as DialogView;
            dialogView.data = dialogVO;
        }
    }
Ejemplo n.º 2
0
    /// <summary>
    /// 领取房卡
    /// </summary>
    /// <param name="bytes"></param>
    private void GetCheckInreward(byte[] bytes)
    {
        GetCardInfoS2C package = NetMgr.Instance.DeSerializes <GetCardInfoS2C>(bytes);

        if (package.status == 1)
        {
            Debug.Log("领取奖励成功");
            UIManager.Instance.HideUI(UIViewID.SIGNIN_VIEW);
            PlayerInfoProxy playerProxy = Facade.RetrieveProxy(Proxys.PLAYERINFO) as PlayerInfoProxy;
            foreach (UserItem item in package.userItems)
            {
                if (playerProxy.UserInfo.UserItems.ContainsKey(item.type))
                {
                    playerProxy.UserInfo.UserItems[item.type] = item;
                }
                else
                {
                    playerProxy.UserInfo.UserItems.Add(item.type, item);
                }
            }
            SendNotification(NotificationConstant.MEDI_HALL_REFRESHITEM);
        }
        else
        {
            DialogMsgVO dialogVO = new DialogMsgVO();
            dialogVO.dialogType = DialogType.ALERT;
            dialogVO.title      = "领取奖励失败";
            dialogVO.content    = "领取奖励失败,请检查网络连接";
            DialogView dialogView = UIManager.Instance.ShowUI(UIViewID.DIALOG_VIEW) as DialogView;
            dialogView.data = dialogVO;
        }
    }
Ejemplo n.º 3
0
 /// <summary>
 /// 解散房间
 /// </summary>
 private void OnDissloutionClick()
 {
     if (playerInfoProxy.UserInfo.UserID != battleProxy.creatorId && battleProxy.isFirstMatch)
     {
         DialogMsgVO dialogMsgVO = new DialogMsgVO();
         dialogMsgVO.title           = "退出确认";
         dialogMsgVO.content         = "是否退出房间";
         dialogMsgVO.dialogType      = DialogType.CONFIRM;
         dialogMsgVO.confirmCallBack = delegate
         {
             ConfirmExit();
         };
         DialogView dialogView = UIManager.Instance.ShowUI(UIViewID.DIALOG_VIEW) as DialogView;
         dialogView.data = dialogMsgVO;
     }
     else
     {
         DialogMsgVO dialogMsgVO = new DialogMsgVO();
         dialogMsgVO.dialogType      = DialogType.CONFIRM;
         dialogMsgVO.title           = "解散确认";
         dialogMsgVO.content         = "是否解散房间";
         dialogMsgVO.confirmCallBack = delegate
         {
             ConfirmDissloution();
         };
         DialogView dialogView = UIManager.Instance.ShowUI(UIViewID.DIALOG_VIEW) as DialogView;
         dialogView.data = dialogMsgVO;
     }
 }
Ejemplo n.º 4
0
    /// <summary>
    /// 创建房间响应
    /// </summary>
    /// <param name="bytes"></param>
    private void CreateRoomResponse(byte[] bytes)
    {
        CheckCreateRoomS2C package = NetMgr.Instance.DeSerializes <CheckCreateRoomS2C>(bytes);

        if (package.clientCode == (int)ErrorCode.SUCCESS)
        {
            this.HallInfo.battleSeverIP   = package.roomServerIp;
            this.HallInfo.battleSeverPort = package.roomServerPort;
            this.HallInfo.roomCode        = package.roomCode;
            this.HallInfo.seat            = package.seat;
            NSocket.UpdateRoomID(HallInfo.roomCode == "" ? 0 : int.Parse(HallInfo.roomCode));
            this.BattleServerConnect(NotificationConstant.MEDI_HALL_CUTCREATESCENE);
        }
        else
        {
            DialogMsgVO dialogVO = new DialogMsgVO();
            dialogVO.dialogType = DialogType.ALERT;
            dialogVO.title      = "创建房间失败";
            if (package.clientCode == 3)
            {
                dialogVO.content = "最多可创建5个房间!";
            }
            else
            {
                dialogVO.content = "创建房间失败,请检查网络连接";
            }
            DialogView dialogView = UIManager.Instance.ShowUI(UIViewID.DIALOG_VIEW) as DialogView;
            dialogView.data = dialogVO;
        }
    }
Ejemplo n.º 5
0
 public override void OnRegister()
 {
     base.OnRegister();
     this.View.ButtonAddListening(this.View.ConfirmButton,
                                  () =>
     {
         CheckInvitationCodeC2S package = new CheckInvitationCodeC2S();
         try
         {
             package.invitationId = int.Parse(this.View.InputField.text);
         }
         catch (FormatException)
         {
             DialogMsgVO dialogVO  = new DialogMsgVO();
             dialogVO.dialogType   = DialogType.ALERT;
             dialogVO.title        = "输入验证码错误";
             dialogVO.content      = "输入验证码错误,请重新输入";
             DialogView dialogView = UIManager.Instance.ShowUI(UIViewID.DIALOG_VIEW) as DialogView;
             dialogView.data       = dialogVO;
             this.ClearInputText();
             return;
         }
         NetMgr.Instance.SendBuff <CheckInvitationCodeC2S>(SocketType.HALL, MsgNoC2S.REQUEST_CHECKINVITATIONCODE_C2S.GetHashCode(), 0, package);
     });
     this.View.ButtonAddListening(this.View.CloseButton,
                                  () =>
     {
         UIManager.Instance.HideUI(UIViewID.INVITE_VIEW);
     });
 }
Ejemplo n.º 6
0
        /// <summary>
        /// 当连接断开
        /// </summary>
        void OnDisconnect(NSocket socket)
        {
            if (!ConnentionDic.ContainsValue(socket))
            {
                return;
            }
            if (isShowTimeOut)
            {
                return;
            }
            isShowTimeOut = true;
            DialogMsgVO dialogMsgVO = new DialogMsgVO();

            dialogMsgVO.title           = "连接提示";
            dialogMsgVO.content         = "您已断开连接是否重新连接";
            dialogMsgVO.dialogType      = DialogType.CONFIRM;
            dialogMsgVO.confirmCallBack = delegate { ConfirmReConnect(); };
            dialogMsgVO.cancelCallBack  = delegate { isShowTimeOut = false; };
            DialogView dialogView = UIManager.Instance.ShowUI(UIViewID.DIALOG_VIEW) as DialogView;

            dialogView.data = dialogMsgVO;

            waitMsgList.Clear();
            UIManager.Instance.SetWaitIconActive(false);
        }
Ejemplo n.º 7
0
    /// <summary>
    /// 验证码检验成功
    /// </summary>
    /// <param name="bytes"></param>
    private void InviteCodeSucceed(byte[] bytes)
    {
        CheckInvitationCodeS2C package = NetMgr.Instance.DeSerializes <CheckInvitationCodeS2C>(bytes);

        if (package.status == ErrorCode.SUCCESS)
        {
            UIManager.Instance.HideUI(UIViewID.INVITE_VIEW,
                                      () =>
            {
                UIManager.Instance.ShowUI(UIViewID.SHOPPING_VIEW);
            });
            PlayerInfoProxy pip = Facade.RetrieveProxy(Proxys.PLAYERINFO) as PlayerInfoProxy;
            if (pip.UserInfo.BoundAgency == ErrorCode.FAILT)
            {
                pip.UserInfo.BoundAgency = ErrorCode.SUCCESS;
            }
        }
        else
        {
            DialogMsgVO dialogVO = new DialogMsgVO();
            dialogVO.dialogType = DialogType.ALERT;
            dialogVO.title      = "输入验证码错误";
            dialogVO.content    = "输入验证码错误,请重新输入";
            DialogView dialogView = UIManager.Instance.ShowUI(UIViewID.DIALOG_VIEW) as DialogView;
            dialogView.data = dialogVO;
        }
        ApplicationFacade.Instance.SendNotification(NotificationConstant.MEDI_HALL_CLEARINPUTTEXT);
    }
Ejemplo n.º 8
0
    private void SendCreateRoom()
    {
        if (this.CheckRoomCard ())
        {
            this.hallProxy.HallInfo.CapScore = (this.View.CapScore.Toggle.isOn) ? 21 : 22;
            this.hallProxy.HallInfo.PayType = (this.View.NotWord.Toggle.isOn) ? 20 : 19;

            CheckCreateRoomC2S package = new CheckCreateRoomC2S();
            package.roomRounds = this.hallProxy.HallInfo.Innings;
            package.playType.Add((this.View.NotWord.Toggle.isOn) ? 20 : 19);
            package.playType.Add(this.hallProxy.HallInfo.CapScore);
            package.roomRule = roomTypeInt();
            NetMgr.Instance.SendBuff<CheckCreateRoomC2S>(SocketType.HALL, MsgNoC2S.REQUEST_CREATEROOM_C2S.GetHashCode(), 0, package);

            Debug.Log(package.roomRule);
        }
        else
        {
            DialogMsgVO dialogVO = new DialogMsgVO();
            dialogVO.dialogType = DialogType.ALERT;
            dialogVO.title = "创建房间失败";
            dialogVO.content = "您的房卡不足,请充值";
            DialogView dialogView = UIManager.Instance.ShowUI(UIViewID.DIALOG_VIEW) as DialogView;
            dialogView.data = dialogVO;
        }
    }
Ejemplo n.º 9
0
    //POST请求
    IEnumerator POST()
    {
        string curVersion = "";
        int    customType = 2;

        if (Application.platform == RuntimePlatform.Android)
        {
            curVersion = AndroidSdkInterface.GetVersion();
            customType = 2;
        }
        else if (Application.platform == RuntimePlatform.IPhonePlayer)
        {
            curVersion = IOSSdkInterface.GetVersion();
            customType = 1;
        }
        else
        {
            curVersion = GlobalData.VERSIONS;
        }
        string          url = string.Format("{0}?version={1}&type={2}", GlobalData.CheckVersionUrl, curVersion, customType);
        UnityWebRequest www = UnityWebRequest.Get(url);

        yield return(www.Send());

        if (www.isError)
        {
            PopMsg.Instance.ShowMsg("获取版本失败:" + www.error);
        }
        else
        {
            JSONNode jsonData = JSON.Parse(www.downloadHandler.text);
            if (int.Parse(jsonData["success"].ToString()) == 0)
            {
                PopMsg.Instance.ShowMsg("获取版本失败:" + jsonData["message"].ToString());
            }
            else
            {
                if (int.Parse(jsonData["is_update"].ToString()) == 1)
                {
                    DialogMsgVO dialogMsgVO = new DialogMsgVO();
                    dialogMsgVO.dialogType      = DialogType.CONFIRM;
                    dialogMsgVO.content         = string.Format("有新版本:{0}\n您是否要更新?", jsonData["version"].ToString());
                    dialogMsgVO.confirmCallBack = () =>
                    {
                        if (GlobalData.sdkPlatform == SDKPlatform.ANDROID)
                        {
                            AndroidSdkInterface.DownloadFile(jsonData["filepath"].ToString());
                        }
                        else if (GlobalData.sdkPlatform == SDKPlatform.IOS)
                        {
                            IOSSdkInterface.UpdateApp(GlobalData.ShareUrl);
                        }
                    };
                    DialogView dialogView = UIManager.Instance.ShowUI(UIViewID.DIALOG_VIEW) as DialogView;
                    dialogView.data = dialogMsgVO;
                }
            }
        }
    }
Ejemplo n.º 10
0
    private void LoginFailDialog()
    {
        DialogMsgVO dialogVO = new DialogMsgVO();

        dialogVO.dialogType = DialogType.ALERT;
        dialogVO.title      = "登录失败";
        dialogVO.content    = "请先阅读用户协议";
        DialogView dialogView = UIManager.Instance.ShowUI(UIViewID.DIALOG_VIEW) as DialogView;

        dialogView.data = dialogVO;
    }
Ejemplo n.º 11
0
    private void LoginResponse(byte[] bytes)
    {
        Debug.Log("收到登陆响应");
        LoginS2C package     = NetMgr.Instance.DeSerializes <LoginS2C>(bytes);
        int      loginStatus = package.status;

        if (loginStatus == 1)
        {
            Debug.Log("验证成功");
            int userID = package.userId;
            hallServerIP   = package.serverIp;
            hallServerPort = package.port;
            ((GameMgrProxy)Facade.RetrieveProxy(Proxys.GAMEMGR_PROXY)).systemTime = package.time;
            PlayerInfoProxy pip = Facade.RetrieveProxy(Proxys.PLAYER_PROXY) as PlayerInfoProxy;
            pip.userID = userID;
            NSocket.UpdateUserID(userID);
            NetMgr.Instance.StopTcpConnection(SocketType.LOGIN);
            NetMgr.Instance.CreateConnect(SocketType.HALL, hallServerIP, hallServerPort, HallConnectHandler);
        }
        else if (loginStatus == 2)
        {
            DialogMsgVO dialogVO = new DialogMsgVO();
            dialogVO.dialogType      = DialogType.ALERT;
            dialogVO.title           = "登录失败";
            dialogVO.content         = "版本过低,请点击确认下载最新版本";
            dialogVO.confirmCallBack = () =>
            {
                if (Application.platform == RuntimePlatform.Android)
                {
                    Application.OpenURL(package.androidUrl);
                }
                else if (Application.platform == RuntimePlatform.IPhonePlayer)
                {
                    Application.OpenURL(package.iosUrl);
                }
                else
                {
                    Application.OpenURL(package.androidUrl);
                }
            };
            DialogView dialogView = UIManager.Instance.ShowUI(UIViewID.DIALOG_VIEW) as DialogView;
            dialogView.data = dialogVO;
        }
        else
        {
            DialogMsgVO dialogVO = new DialogMsgVO();
            dialogVO.dialogType = DialogType.ALERT;
            dialogVO.title      = "登录失败";
            dialogVO.content    = "登录失败,请重新连接";
            DialogView dialogView = UIManager.Instance.ShowUI(UIViewID.DIALOG_VIEW) as DialogView;
            dialogView.data = dialogVO;
        }
    }
Ejemplo n.º 12
0
        public void OnDisconnect()
        {
            DialogMsgVO dialogMsgVO = new DialogMsgVO();

            dialogMsgVO.title           = "连接提示";
            dialogMsgVO.content         = "您已离线,是否重新进入游戏";
            dialogMsgVO.dialogType      = DialogType.CONFIRM;
            dialogMsgVO.confirmCallBack = delegate { ConfirmReConnect(); };
            dialogMsgVO.cancelCallBack  = delegate { CancelReConnect(); };
            DialogView dialogView = UIManager.Instance.ShowUI(UIViewID.DIALOG_VIEW) as DialogView;

            dialogView.data = dialogMsgVO;
        }
Ejemplo n.º 13
0
    /// <summary>
    /// 显示报名成功
    /// </summary>
    private void ShowApplySucceed()
    {
        var         startDate   = TimeHandle.Instance.GetDateTimeByTimestamp(hallProxy.HallInfo.startTime);
        DialogMsgVO dialogMsgVO = new DialogMsgVO();

        dialogMsgVO.title      = "报名成功";
        dialogMsgVO.content    = string.Format("报名成功, 请于{0}准时\n参加比赛。", startDate.ToString("yyyy-MM-dd HH:mm"));
        dialogMsgVO.dialogType = DialogType.ALERT;
        DialogView dialogView = UIManager.Instance.ShowUI(UIViewID.DIALOG_VIEW) as DialogView;

        dialogView.data = dialogMsgVO;
        UpdateBtns();
    }
Ejemplo n.º 14
0
 private void SettingPrompt()
 {
     if (SceneManager.GetActiveScene().name == SceneName.BATTLE)
     {
         this.View.Frame.overrideSprite             = Resources.Load <Sprite>("Textures/UI/Prompt/弹窗背景");
         this.View.CloseButton.image.overrideSprite = Resources.Load <Sprite>("Textures/UI/Prompt/关闭按钮");
         this.View.CloseButton.GetComponent <RectTransform>().anchoredPosition = new Vector2(283.3f, 277.5f);
         this.View.CloseButton.image.SetNativeSize();
         this.View.ButtonAddListening(this.View.SwitchAccountButton,
                                      () =>
         {
             if (playerInfoProxy.UserInfo.UserID != battleProxy.creatorId && battleProxy.isFirstMatch)
             {
                 DialogMsgVO dialogMsgVO     = new DialogMsgVO();
                 dialogMsgVO.title           = "退出确认";
                 dialogMsgVO.content         = "是否退出房间";
                 dialogMsgVO.dialogType      = DialogType.CONFIRM;
                 dialogMsgVO.confirmCallBack = delegate { ConfirmExit(); };
                 DialogView dialogView       = UIManager.Instance.ShowUI(UIViewID.DIALOG_VIEW) as DialogView;
                 dialogView.data             = dialogMsgVO;
             }
             else
             {
                 DialogMsgVO dialogMsgVO     = new DialogMsgVO();
                 dialogMsgVO.dialogType      = DialogType.CONFIRM;
                 dialogMsgVO.title           = "解散确认";
                 dialogMsgVO.content         = "是否解散房间";
                 dialogMsgVO.confirmCallBack = delegate { ConfirmDissloution(); };
                 DialogView dialogView       = UIManager.Instance.ShowUI(UIViewID.DIALOG_VIEW) as DialogView;
                 dialogView.data             = dialogMsgVO;
             }
         }
                                      );
     }
     else
     {
         this.View.ButtonAddListening(this.View.SwitchAccountButton,
                                      () =>
         {
             DialogMsgVO dialogVO     = new DialogMsgVO();
             dialogVO.dialogType      = DialogType.CONFIRM;
             dialogVO.title           = "退出";
             dialogVO.content         = "你确定要离开游戏吗?";
             dialogVO.confirmCallBack = delegate { ExitHall(); };
             DialogView dialogView    = UIManager.Instance.ShowUI(UIViewID.DIALOG_VIEW) as DialogView;
             dialogView.data          = dialogVO;
         }
                                      );
     }
 }
Ejemplo n.º 15
0
        /// <summary>
        /// 显示连接断开提示
        /// </summary>
        public void ShowDisconnectAlert()
        {
            DialogMsgVO dialogMsgVO = new DialogMsgVO();

            dialogMsgVO.title           = "连接提示";
            dialogMsgVO.content         = "您已离线,请重新进入游戏";
            dialogMsgVO.dialogType      = DialogType.ALERT;
            dialogMsgVO.confirmCallBack = delegate { ConfirmReConnect(); };
            DialogView dialogView = UIManager.Instance.ShowUI(UIViewID.DIALOG_VIEW) as DialogView;

            dialogView.data = dialogMsgVO;

            waitMsgList.Clear();
            UIManager.Instance.SetWaitIconActive(false);
        }
Ejemplo n.º 16
0
    /// <summary>
    /// 支付成功返回
    /// </summary>
    /// <param name="bytes"></param>
    //private void PaySuccessHandler(byte[] bytes)
    //{
    //    var paySucessS2C = NetMgr.Instance.DeSerializes<PaySuccessS2C>(bytes);
    //    if (paySucessS2C.status == 2)
    //    {
    //        DialogMsgVO dialogMsgVO = new DialogMsgVO();
    //        dialogMsgVO.title = "充值提示";
    //        dialogMsgVO.content = "服务器充值失败";
    //        dialogMsgVO.dialogType = DialogType.ALERT;
    //        DialogView dialogView = UIManager.Instance.ShowUI(UIViewID.DIALOG_VIEW) as DialogView;
    //        dialogView.data = dialogMsgVO;
    //        return;
    //    }
    //    PlayerInfoProxy playerInfoProxy = ApplicationFacade.Instance.RetrieveProxy(Proxys.PLAYERINFO) as PlayerInfoProxy;
    //    if (playerInfoProxy.UserItems.ContainsKey(paySucessS2C.type))
    //    {
    //        playerInfoProxy.UserItems[paySucessS2C.type].amount = paySucessS2C.amount;
    //    }
    //    else
    //    {
    //        var userItem = new UserItem();
    //        userItem.type = paySucessS2C.type;
    //        userItem.amount = paySucessS2C.amount;
    //        playerInfoProxy.UserItems.Add(paySucessS2C.type, userItem);
    //    }
    //    SendNotification(NotificationConstant.MEDI_HALL_REFRESHUSERINFO);
    //}

    /// <summary>
    /// 获取排行榜返回
    /// </summary>
    /// <param name="bytes"></param>
    private void GetRankHandler(byte[] bytes)
    {
        var getRankS2C = NetMgr.Instance.DeSerializes <GetRankS2C>(bytes);

        ranks = getRankS2C.ranks;
        if (ranks.Count == 0)
        {
            DialogMsgVO dialogMsgVO = new DialogMsgVO();
            dialogMsgVO.content    = "第一局比赛场尚未结束,比赛场获取不到历史排行数据";
            dialogMsgVO.dialogType = DialogType.ALERT;
            DialogView dialogView = UIManager.Instance.ShowUI(UIViewID.DIALOG_VIEW) as DialogView;
            dialogView.data = dialogMsgVO;
            return;
        }
        UIManager.Instance.ShowUI(UIViewID.RANK_VIEW);
    }
Ejemplo n.º 17
0
    /// <summary>
    /// 显示播放结束提示
    /// </summary>
    private void ShowCompleteAlert()
    {
        DialogMsgVO dialogMsgVO = new DialogMsgVO();

        dialogMsgVO.dialogType      = DialogType.ALERT;
        dialogMsgVO.title           = "播放提示";
        dialogMsgVO.content         = "播放结束";
        dialogMsgVO.confirmCallBack = (() =>
        {
            var loadInfo = new LoadSceneInfo(ESceneID.SCENE_HALL, LoadSceneType.ASYNC, LoadSceneMode.Additive);
            ApplicationFacade.Instance.SendNotification(NotificationConstant.MEDI_GAMEMGR_LOADSCENE, loadInfo);
        });
        DialogView dialogView = UIManager.Instance.ShowUI(UIViewID.DIALOG_VIEW) as DialogView;

        dialogView.data = dialogMsgVO;
    }
Ejemplo n.º 18
0
    void Update()
    {
        SendMsgHandler();
        ReciveMsgHandler();
        Utils.Timer.Instance.DoUpdate();
        UIManager.Instance.Update();
        if (Input.GetMouseButtonDown(0))
        {
            moveStart = Input.mousePosition;
            moveIndex = 0;
        }
        else
        {
            if (Input.GetMouseButton(0))
            {
                var curPos = Input.mousePosition;
                if (moveIndex == 0 && moveStart.y - curPos.y > 100)
                {
                    moveIndex++;
                    moveStart = curPos;
                }
                if (moveIndex == 1 && curPos.x - moveStart.x > 100)
                {
                    moveIndex++;
                    moveStart = curPos;
                }
                if (moveIndex == 2 && curPos.y - moveStart.y > 100)
                {
                    moveIndex++;
                    var logView = GameObject.Find("UIRoot").transform.Find("LogView").gameObject;
                    logView.SetActive(!logView.activeSelf);
                }
            }
        }

        if (Input.GetKey(KeyCode.Escape))
        {
            DialogMsgVO dialogMsgVO = new DialogMsgVO();
            dialogMsgVO.title           = "退出提示";
            dialogMsgVO.content         = "是否退出游戏";
            dialogMsgVO.dialogType      = DialogType.CONFIRM;
            dialogMsgVO.confirmCallBack = delegate { Application.Quit(); };
            DialogView dialogView = UIManager.Instance.ShowUI(UIViewID.DIALOG_VIEW) as DialogView;
            dialogView.data = dialogMsgVO;
        }
    }
Ejemplo n.º 19
0
    /// <summary>
    /// 报名成功消息
    /// </summary>
    /// <param name="bytes"></param>
    private void ApplySucceed(byte[] bytes)
    {
        ApplyCompetitionS2C package = NetMgr.Instance.DeSerializes <ApplyCompetitionS2C>(bytes);

        if (package.status == 1)
        {
            Facade.SendNotification(NotificationConstant.MEDI_HALL_APPLYSUCCEED);
        }
        else
        {
            DialogMsgVO dialogVO = new DialogMsgVO();
            dialogVO.dialogType = DialogType.ALERT;
            dialogVO.title      = "报名失败";
            dialogVO.content    = "报名失败,请检查网络连接";
            DialogView dialogView = UIManager.Instance.ShowUI(UIViewID.DIALOG_VIEW) as DialogView;
            dialogView.data = dialogVO;
        }
    }
Ejemplo n.º 20
0
    private void CancelMatching(byte[] bytes)
    {
        CancelMatchingS2C package = NetMgr.Instance.DeSerializes <CancelMatchingS2C>(bytes);

        if (package.status == (int)ErrorCode.SUCCESS)
        {
            UIManager.Instance.HideUI(UIViewID.MATCHING_VIEW);
        }
        else
        {
            DialogMsgVO dialogVO = new DialogMsgVO();
            dialogVO.dialogType = DialogType.ALERT;
            dialogVO.title      = "取消匹配失败";
            dialogVO.content    = "取消匹配失败,请检查网络连接";
            DialogView dialogView = UIManager.Instance.ShowUI(UIViewID.DIALOG_VIEW) as DialogView;
            dialogView.data = dialogVO;
        }
    }
Ejemplo n.º 21
0
    /// <summary>
    /// 刷新签到界面
    /// </summary>
    private void RefreshSignInInfo()
    {
        HallProxy hallProxy = ApplicationFacade.Instance.RetrieveProxy(Proxys.HALL_PROXY) as HallProxy;

        if (hallProxy.HallInfo.SignInState == (int)ErrorCode.SUCCESS)
        {
            for (int i = 0; i < hallProxy.HallInfo.SignInDay; i++)
            {
                Transform dayState = this.View.DataList[i];
                if (i == hallProxy.HallInfo.SignInDay - 1)
                {
                    SignInInfoAnimation(dayState);
                }
                else
                {
                    dayState.FindChild("Unused").gameObject.SetActive(false);
                    dayState.FindChild("Used").gameObject.SetActive(true);
                }
            }
            if (hallProxy.HallInfo.SignInDay >= 7)
            {
                this.View.SignInButton.transform.DOScale(Vector3.zero, 0.2f).SetEase(Ease.Linear).OnComplete(
                    () =>
                {
                    this.View.SignInButton.transform.gameObject.SetActive(false);
                    this.View.SignInButton.transform.localScale = Vector3.one;
                    this.View.GetButton.transform.localScale    = Vector3.zero;
                    this.View.GetButton.gameObject.SetActive(true);
                    this.View.GetButton.transform.DOScale(Vector3.one, 0.2f).SetEase(Ease.Linear);
                });
            }
        }
        else
        {
            DialogMsgVO dialogVO = new DialogMsgVO();
            dialogVO.dialogType = DialogType.ALERT;
            dialogVO.title      = "签到失败";
            dialogVO.content    = "今日已签到,请勿重复签到";
            DialogView dialogView = UIManager.Instance.ShowUI(UIViewID.DIALOG_VIEW) as DialogView;
            dialogView.data = dialogVO;
        }
    }
Ejemplo n.º 22
0
    /// <summary>
    /// 加入房间响应
    /// </summary>
    /// <param name="bytes"></param>
    private void JoinRoomResponse(byte[] bytes)
    {
        JoinInRoomS2C package = NetMgr.Instance.DeSerializes <JoinInRoomS2C>(bytes);

        if (package.clientCode == (int)ErrorCode.SUCCESS)
        {
            this.HallInfo.Innings         = package.roomRounds;
            this.HallInfo.GameRule        = (GameRule)package.roomRule;
            this.HallInfo.BattleSeverIP   = package.roomServerIp;
            this.HallInfo.BattleSeverPort = package.roomServerPort;
            this.HallInfo.Seat            = package.seat;
            NSocket.RoomId = HallInfo.RoomCode == "" ? 0 : int.Parse(HallInfo.RoomCode);
            this.BattleServerConnect(NotificationConstant.MEDI_HALL_CUTJOINSCENE);
        }
        else if (package.clientCode == (int)ErrorCode.NO_ROOM)
        {
            DialogMsgVO dialogVO = new DialogMsgVO();
            dialogVO.dialogType = DialogType.ALERT;
            dialogVO.title      = "加入提示";
            dialogVO.content    = "房间不存在";
            DialogView dialogView = UIManager.Instance.ShowUI(UIViewID.DIALOG_VIEW) as DialogView;
            dialogView.data = dialogVO;
        }
        else if (package.clientCode == (int)ErrorCode.OVERFLOW_ROOM_PLAYERS)
        {
            DialogMsgVO dialogVO = new DialogMsgVO();
            dialogVO.dialogType = DialogType.ALERT;
            dialogVO.title      = "加入提示";
            dialogVO.content    = "房间人数已满!";
            DialogView dialogView = UIManager.Instance.ShowUI(UIViewID.DIALOG_VIEW) as DialogView;
            dialogView.data = dialogVO;
        }
        else
        {
            DialogMsgVO dialogVO = new DialogMsgVO();
            dialogVO.dialogType = DialogType.ALERT;
            dialogVO.title      = "加入房间失败";
            dialogVO.content    = "加入房间失败,请检查网络连接";
            DialogView dialogView = UIManager.Instance.ShowUI(UIViewID.DIALOG_VIEW) as DialogView;
            dialogView.data = dialogVO;
        }
    }
Ejemplo n.º 23
0
        /// <summary>
        /// 连接超时
        /// </summary>
        /// <param name="socket"></param>
        void OnRquestTimeOut()
        {
            if (isShowTimeOut)
            {
                return;
            }
            isShowTimeOut = true;
            DialogMsgVO dialogMsgVO = new DialogMsgVO();

            dialogMsgVO.title           = "超时提示";
            dialogMsgVO.content         = "消息超时是否重新连接";
            dialogMsgVO.dialogType      = DialogType.CONFIRM;
            dialogMsgVO.confirmCallBack = delegate { ConfirmReConnect(); };
            dialogMsgVO.cancelCallBack  = delegate { isShowTimeOut = false; };
            DialogView dialogView = UIManager.Instance.ShowUI(UIViewID.DIALOG_VIEW) as DialogView;

            dialogView.data = dialogMsgVO;

            waitMsgList.Clear();
            UIManager.Instance.SetWaitIconActive(false);
        }
Ejemplo n.º 24
0
    /// <summary>
    /// 更新用户数据
    /// </summary>
    /// <param name="bytes"></param>
    private void GetUserInfoResponse(byte[] bytes)
    {
        GetUserInfoS2C package = NetMgr.Instance.DeSerializes <GetUserInfoS2C>(bytes);

        this.userName = package.userName;
        foreach (UserItem item in package.userItems)
        {
            if (!this.userItems.ContainsKey(item.type))
            {
                this.userItems.Add(item.type, item);
            }
            else
            {
                var hallProxy = ApplicationFacade.Instance.RetrieveProxy(Proxys.HALL_PROXY) as HallProxy;
                if (item.amount > this.userItems[item.type].amount && hallProxy.orderTimeId > 0)
                {
                    DialogMsgVO dialogMsgVO = new DialogMsgVO();
                    dialogMsgVO.title      = "充值提示";
                    dialogMsgVO.content    = "充值成功";
                    dialogMsgVO.dialogType = DialogType.ALERT;
                    DialogView dialogView = UIManager.Instance.ShowUI(UIViewID.DIALOG_VIEW) as DialogView;
                    dialogView.data = dialogMsgVO;
                    Timer.Instance.CancelTimer(hallProxy.orderTimeId);
                    hallProxy.orderTimeId = 0;
                }
                this.userItems[item.type] = item;
            }
        }
        this.showID = package.showId;
        //string ip = package.ip;
        //ip = ip.Substring(0, ip.Length - 5);
        //ip = ip.Replace("/", "");
        this.localIP     = package.ip;
        this.headIconUrl = package.imageUrl;
        this.sex         = package.sex;
        this.boundAgency = package.boundAgency;
        SendNotification(NotificationConstant.MEDI_HALL_REFRESHUSERINFO);
    }
Ejemplo n.º 25
0
    /// <summary>
    /// 匹配
    /// </summary>
    /// <param name="bytes"></param>
    private void StartMatching(byte[] bytes)
    {
        JoinCompetitionS2C package = NetMgr.Instance.DeSerializes <JoinCompetitionS2C>(bytes);

        if (package.status == 1)
        {
            Debug.Log("开始匹配");
            UIManager.Instance.HideUI(UIViewID.ATHLETICS_VIEW,
                                      () =>
            {
                UIManager.Instance.ShowUI(UIViewID.MATCHING_VIEW);
            });
        }
        else if (package.status == 0)
        {
            DialogMsgVO dialogVO = new DialogMsgVO();
            dialogVO.dialogType = DialogType.ALERT;
            dialogVO.title      = "匹配失败";
            dialogVO.content    = "匹配失败,请检查网络连接";
            DialogView dialogView = UIManager.Instance.ShowUI(UIViewID.DIALOG_VIEW) as DialogView;
            dialogView.data = dialogVO;
        }
    }
Ejemplo n.º 26
0
    /// <summary>规则
    /// 40——8局,41——一锅
    /// 42——房主扣,43——玩家均摊
    /// 44——三家炮,45——一家炮
    /// 46——蛋带翻,47——蛋不翻
    /// 48——长跑3,49——长跑5,50——长跑10
    /// </summary>
    private void SendCreateRoom()
    {
        if (this.CheckRoomCard())
        {
            //局数
            if (View.EightRound.GetComponent <Toggle>().isOn)
            {
                round = 40; PlayerPrefs.SetString(PrefsKey.ROUND, "8");
            }
            else
            {
                { round = 41; PlayerPrefs.SetString(PrefsKey.ROUND, "一锅"); }
            }
            //房费
            if (View.CreatorPay.GetComponent <Toggle>().isOn)
            {
                ruleList.Add(42); PlayerPrefs.SetString(PrefsKey.PAYWAY, "房主支付");
            }
            else
            {
                { ruleList.Add(43); PlayerPrefs.SetString(PrefsKey.PAYWAY, "玩家均摊"); }
            }

            //玩法
            if (View.OneShoot.GetComponent <Toggle>().isOn)
            {
                ruleList.Add(45); PlayerPrefs.SetString(PrefsKey.RULE1, "一家炮");
            }
            else
            {
                ruleList.Add(44); PlayerPrefs.SetString(PrefsKey.RULE1, "三家炮");
            }

            if (View.EggCanLieDown.GetComponent <Toggle>().isOn)
            {
                ruleList.Add(46); PlayerPrefs.SetString(PrefsKey.RULE2, "蛋带翻");
            }
            else
            {
                ruleList.Add(47); PlayerPrefs.SetString(PrefsKey.RULE2, "蛋不翻");
            }

            if (View.Run3.GetComponent <Toggle>().isOn)
            {
                ruleList.Add(48); PlayerPrefs.SetString(PrefsKey.RULE3, "长跑3");
            }
            else if (View.Run5.GetComponent <Toggle>().isOn)
            {
                ruleList.Add(49); PlayerPrefs.SetString(PrefsKey.RULE3, "长跑5");
            }
            else
            {
                ruleList.Add(50); PlayerPrefs.SetString(PrefsKey.RULE3, "长跑10");
            }

            CheckCreateRoomC2S package = new CheckCreateRoomC2S();
            package.roomRounds = round == 40 ? 8 : 1000000;//无用
            package.roomRule   = round;
            package.playType.AddRange(ruleList);

            NetMgr.Instance.SendBuff <CheckCreateRoomC2S>(SocketType.HALL, MsgNoC2S.C2S_Hall_CREATE_ROOM.GetHashCode(), 0, package);
        }
        else
        {
            DialogMsgVO dialogVO = new DialogMsgVO();
            dialogVO.dialogType = DialogType.ALERT;
            dialogVO.title      = "创建房间失败";
            dialogVO.content    = "您的房卡不足,请充值";
            DialogView dialogView = UIManager.Instance.ShowUI(UIViewID.DIALOG_VIEW) as DialogView;
            dialogView.data = dialogVO;
        }
    }