Example #1
0
        /// <summary>
        /// 匹配斗地主
        /// </summary>
        public async void OnStartMatchLandlords()
        {
            try
            {
                //发送开始匹配消息
                C2G_StartMatch_Req  c2G_StartMatch_Req = new C2G_StartMatch_Req();
                G2C_StartMatch_Back g2C_StartMatch_Ack = (G2C_StartMatch_Back)await SessionComponent.Instance.Session.Call(c2G_StartMatch_Req);

                if (g2C_StartMatch_Ack.Error == ErrorCode.ERR_UserMoneyLessError)
                {
                    Log.Error("余额不足");
                    return;
                }

                //切换到房间界面
                UI landRoom = Game.Scene.GetComponent <UIComponent>().Create(LandUIType.LandRoom);
                Game.Scene.GetComponent <UIComponent>().Remove(LandUIType.LandLobby);
            }
            catch (Exception e)
            {
                Log.Error(e);
            }
        }
        /// <summary>
        /// 匹配房间(boat)
        /// </summary>
        public async void MatchBtnOnClick()
        {
            try
            {
                ////发送开始匹配消息
                C2G_StartMatch_Req  c2G_StartMatch_Req = new C2G_StartMatch_Req();
                G2C_StartMatch_Back g2C_StartMatch_Ack = (G2C_StartMatch_Back)await SessionComponent.Instance.Session.Call(c2G_StartMatch_Req);

                //if (g2C_StartMatch_Ack.Error == ErrorCode.ERR_UserMoneyLessError)
                //{
                //    Log.Error("余额不足");
                //    return;
                //}

                //切换到房间界面
                Game.EventSystem.Run(UIEventType.LandRoomStart);
                Game.EventSystem.Run(UIEventType.MainLobbyFinish);
            }
            catch (Exception e)
            {
                Log.Error(e);
            }
        }