示例#1
0
        protected override async void Run(ETModel.Session session, Actor_GamerReady message)
        {
            try
            {
                Log.Info($"收到准备");
                UI uiRoom = Game.Scene.GetComponent <UIComponent>().Get(UIType.UIRoom);
                UIReadyComponent uiReadyComponent = Game.Scene.GetComponent <UIComponent>().Get(UIType.UIReady)?.GetComponent <UIReadyComponent>();

                if (uiRoom == null)
                {
                    return;
                }

                GamerComponent gamerComponent = uiRoom.GetComponent <GamerComponent>();

                Gamer gamer = gamerComponent.Get(message.Uid);
                if (gamer == null)
                {
                    Log.Warning($"{message.Uid}玩家为空");
                    return;
                }
                GamerUIComponent gamerUiComponent = gamer.GetComponent <GamerUIComponent>();
                gamerUiComponent.SetReady();
                uiReadyComponent?.SetReady(message.Uid);

                SoundsHelp.Instance.playSound_ZhunBei();
            }
            catch (Exception e)
            {
                Log.Error(e);
            }
        }
示例#2
0
        protected override async void Run(ETModel.Session session, Actor_GamerTrusteeship message)
        {
            try
            {
                Log.Info($"玩家托管:" + message.Uid);

                UI              uiRoom          = Game.Scene.GetComponent <UIComponent>().Get(UIType.UIRoom);
                GamerComponent  gamerComponent  = uiRoom.GetComponent <GamerComponent>();
                UIRoomComponent uiRoomComponent = uiRoom.GetComponent <UIRoomComponent>();
                Gamer           gamer           = gamerComponent.Get(message.Uid);
                if (message.Uid == PlayerInfoComponent.Instance.uid)
                {
                    uiRoomComponent.ShowTrustship();
                }
                else
                {
                    GamerUIComponent gamerUIComponent = gamer.GetComponent <GamerUIComponent>();
                    gamerUIComponent.ShowTrust();
                }
            }
            catch (Exception e)
            {
                Log.Error(e);
            }
        }
示例#3
0
        protected override void Run(ETModel.Session session, Actor_GameStart_Ntt message)
        {
            UI             uiRoom         = Game.Scene.GetComponent <UIComponent>().Get(UIType.LandlordsRoom);
            GamerComponent gamerComponent = uiRoom.GetComponent <GamerComponent>();

            //初始化玩家UI
            foreach (GamerCardNum gamerCardNum in message.GamersCardNum)
            {
                Gamer            gamer   = uiRoom.GetComponent <GamerComponent>().Get(gamerCardNum.UserID);
                GamerUIComponent gamerUI = gamer.GetComponent <GamerUIComponent>();
                gamerUI.GameStart();

                HandCardsComponent handCards = gamer.GetComponent <HandCardsComponent>();
                if (handCards != null)
                {
                    handCards.Reset();
                }
                else
                {
                    handCards = gamer.AddComponent <HandCardsComponent, GameObject>(gamerUI.Panel);
                }

                handCards.Appear();

                if (gamer.UserID == gamerComponent.LocalGamer.UserID)
                {
                    //本地玩家添加手牌
                    handCards.AddCards(message.HandCards);
                }
                else
                {
                    //设置其他玩家手牌数
                    handCards.SetHandCardsNum(gamerCardNum.Num);
                }
            }

            //显示牌桌UI
            GameObject desk = uiRoom.GameObject.Get <GameObject>("Desk");

            desk.SetActive(true);
            GameObject lordPokers = desk.Get <GameObject>("LordPokers");

            //重置地主牌
            Sprite lordSprite = CardHelper.GetCardSprite("None");

            for (int i = 0; i < lordPokers.transform.childCount; i++)
            {
                lordPokers.transform.GetChild(i).GetComponent <Image>().sprite = lordSprite;
            }

            LandlordsRoomComponent uiRoomComponent = uiRoom.GetComponent <LandlordsRoomComponent>();

            //清空选中牌
            uiRoomComponent.Interaction.Clear();
            //设置初始倍率
            uiRoomComponent.SetMultiples(1);
        }
示例#4
0
        protected override void Run(Session session, M2C_SetLandlord message)
        {
            UI             uiRoom         = Game.Scene.GetComponent <UIComponent>().Get(UIType.UIRoom);
            GamerComponent gamerComponent = uiRoom.GetComponent <GamerComponent>();
            Gamer          gamer          = gamerComponent.Get(message.UserID);

            if (gamer != null)
            {
                HandCardsComponent handCards = gamer.GetComponent <HandCardsComponent>();
                if (gamer.UserID == gamerComponent.LocalGamer.UserID)
                {
                    //本地玩家添加手牌
                    handCards.AddCards(message.LordCards);
                }
                else
                {
                    //其他玩家设置手牌数
                    handCards.SetHandCardsNum(20);
                }
            }

            foreach (var _gamer in gamerComponent.GetAll())
            {
                HandCardsComponent handCardsComponent = _gamer.GetComponent <HandCardsComponent>();
                GamerUIComponent   gamerUIComponent   = _gamer.GetComponent <GamerUIComponent>();
                if (_gamer.UserID == message.UserID)
                {
                    handCardsComponent.AccessIdentity = Identity.Landlord;
                    gamerUIComponent.SetIdentity(Identity.Landlord);
                }
                else
                {
                    handCardsComponent.AccessIdentity = Identity.Farmer;
                    gamerUIComponent.SetIdentity(Identity.Farmer);
                }
            }

            //重置玩家UI提示
            foreach (var _gamer in gamerComponent.GetAll())
            {
                _gamer.GetComponent <GamerUIComponent>().ResetPrompt();
            }

            //切换地主牌精灵
            GameObject lordPokers = uiRoom.GameObject.Get <GameObject>("Desk").Get <GameObject>("LordPokers");

            for (int i = 0; i < lordPokers.transform.childCount; i++)
            {
                Sprite lordCardSprite = CardHelper.GetCardSprite(message.LordCards[i].GetName());
                lordPokers.transform.GetChild(i).GetComponent <Image>().sprite = lordCardSprite;
            }

            //显示切换游戏模式按钮
            uiRoom.GetComponent <UIRoomComponent>().Interaction.GameStart();
        }
示例#5
0
        protected override void Run(ETModel.Session session, Actor_GamerReconnect_Ntt message)
        {
            UI             uiRoom         = Game.Scene.GetComponent <UIComponent>().Get(UIType.LandlordsRoom);
            GamerComponent gamerComponent = uiRoom.GetComponent <GamerComponent>();

            foreach (GamerState gamerState in message.GamersState)
            {
                Gamer gamer = gamerComponent.Get(gamerState.UserID);
                HandCardsComponent gamerHandCards = gamer.GetComponent <HandCardsComponent>();
                GamerUIComponent   gamerUI        = gamer.GetComponent <GamerUIComponent>();
                Identity           gamerIdentity  = gamerState.UserIdentity;
                gamerHandCards.AccessIdentity = gamerIdentity;
                gamerUI.SetIdentity(gamerIdentity);
                //初始化出牌
                if (message.UserId == gamer.UserID && gamerIdentity != Identity.None)
                {
                    if (message.Cards != null)
                    {
                        gamerHandCards.PopCards(message.Cards);
                    }
                }
                else if (message.LordCards.count == 0)
                {
                    gamer.GetComponent <GamerUIComponent>().SetGrab(gamerState.State);
                }
            }

            //初始化界面
            LandlordsRoomComponent uiRoomComponent = uiRoom.GetComponent <LandlordsRoomComponent>();

            //隐藏准备按钮,避免重连时还显示准备按钮
            uiRoom.GameObject.Get <GameObject>("ReadyButton").SetActive(false);
            //设置倍率
            uiRoomComponent.SetMultiples(message.Multiples);
            //当抢完地主时才能显示托管按钮
            if (message.LordCards.count > 0)
            {
                uiRoomComponent.Interaction.GameStart();
            }

            //初始化地主牌
            if (message.LordCards.count > 0)
            {
                GameObject lordPokers = uiRoom.GameObject.Get <GameObject>("Desk").Get <GameObject>("LordPokers");
                for (int i = 0; i < lordPokers.transform.childCount; i++)
                {
                    Sprite lordCardSprite = CardHelper.GetCardSprite(message.LordCards[i].GetName());
                    lordPokers.transform.GetChild(i).GetComponent <Image>().sprite = lordCardSprite;
                }
            }
        }
示例#6
0
        protected override void Run(Session session, M2C_GamerReconnect_ANtt message)
        {
            UI             uiRoom         = Game.Scene.GetComponent <UIComponent>().Get(UIType.UIRoom);
            GamerComponent gamerComponent = uiRoom.GetComponent <GamerComponent>();

            uiRoom.GameObject.Get <GameObject>("ReadyButton").SetActive(false);
            foreach (var gamer in gamerComponent.GetAll())
            {
                //初始化玩家身份
                Identity           gamerIdentity  = message.GamersIdentity[gamer.UserID];
                HandCardsComponent gamerHandCards = gamer.GetComponent <HandCardsComponent>();
                GamerUIComponent   gamerUI        = gamer.GetComponent <GamerUIComponent>();
                gamerHandCards.AccessIdentity = gamerIdentity;
                gamerUI.SetIdentity(gamerIdentity);
                //初始化出牌
                if (message.DeskCards.Key == gamer.UserID && gamerIdentity != Identity.None)
                {
                    Card[] deskCards = message.DeskCards.Value;
                    if (deskCards != null)
                    {
                        gamerHandCards.PopCards(deskCards);
                    }
                }
                else if (message.LordCards == null && message.GamerGrabLandlordState.ContainsKey(gamer.UserID))
                {
                    gamer.GetComponent <GamerUIComponent>().SetGrab(message.GamerGrabLandlordState[gamer.UserID]);
                }
            }

            //初始化界面
            UIRoomComponent uiRoomComponent = uiRoom.GetComponent <UIRoomComponent>();

            uiRoomComponent.SetMultiples(message.Multiples);
            //当抢完地主时才能显示托管按钮
            if (message.LordCards != null)
            {
                uiRoomComponent.Interaction.GameStart();
            }

            //初始化地主牌
            if (message.LordCards != null)
            {
                GameObject lordPokers = uiRoom.GameObject.Get <GameObject>("Desk").Get <GameObject>("LordPokers");
                for (int i = 0; i < lordPokers.transform.childCount; i++)
                {
                    Sprite lordCardSprite = CardHelper.GetCardSprite(message.LordCards[i].GetName());
                    lordPokers.transform.GetChild(i).GetComponent <Image>().sprite = lordCardSprite;
                }
            }
        }
        /// <summary>
        /// 出牌
        /// </summary>
        private async void OnPlay()
        {
            CardHelper.Sort(currentSelectCards);
            Actor_GamerPlayCard_Req request = new Actor_GamerPlayCard_Req();

            request.Cards.AddRange(currentSelectCards);
            Actor_GamerPlayCard_Ack response = await SessionComponent.Instance.Session.Call(request) as Actor_GamerPlayCard_Ack;

            //出牌错误提示
            GamerUIComponent gamerUI = Game.Scene.GetComponent <UIComponent>().Get(UIType.LandlordsRoom).GetComponent <GamerComponent>().LocalGamer.GetComponent <GamerUIComponent>();

            if (response.Error == ErrorCode.ERR_PlayCardError)
            {
                gamerUI.SetPlayCardsError();
            }
        }
示例#8
0
        /// <summary>
        /// 出牌
        /// </summary>
        private async void OnPlay()
        {
            CardHelper.Sort(currentSelectCards);
            C2M_GamerPlayCard request = new C2M_GamerPlayCard()
            {
                Cards = currentSelectCards.ToArray()
            };
            M2C_GamerPlayCard response = await SessionWrapComponent.Instance.Session.Call(request) as M2C_GamerPlayCard;

            //出牌错误提示
            GamerUIComponent gamerUI = Game.Scene.GetComponent <UIComponent>().Get(UIType.UIRoom).GetComponent <GamerComponent>().LocalGamer.GetComponent <GamerUIComponent>();

            if (response.Error == ErrorCode.ERR_PlayCardError)
            {
                gamerUI.SetPlayCardsError();
            }
        }
示例#9
0
        protected override async void Run(ETModel.Session session, Actor_GamerJionRoom message)
        {
            try
            {
                Log.Debug("有人加入:");
                UI uiRoom  = Game.Scene.GetComponent <UIComponent>().Get(UIType.UIRoom);
                UI uiReady = Game.Scene.GetComponent <UIComponent>().Get(UIType.UIReady);
                if (uiReady == null)
                {
                    return;
                }
                GamerComponent  gamerComponent = uiRoom.GetComponent <GamerComponent>();
                UIRoomComponent roomComponent  = uiRoom.GetComponent <UIRoomComponent>();

                UIReadyComponent uiReadyComponent = uiReady.GetComponent <UIReadyComponent>();
                Gamer            gamer            = GamerFactory.Create(message.Gamer.UserID, message.Gamer.IsReady, message.Gamer.playerInfo);

                GamerUIComponent gamerUiComponent = gamer.GetComponent <GamerUIComponent>();

                //排序
                int index = message.Gamer.SeatIndex - roomComponent.localGamer.SeatIndex;
                if (index < 0)
                {
                    index += 4;
                }

                //设置准备
                if (uiReadyComponent != null)
                {
                    //                        await gamerUiComponent.GetPlayerInfo();
                    if (gamer?.PlayerInfo != null)
                    {
                        gamerUiComponent?.SetHeadPanel(uiReadyComponent.HeadPanel[index], index);
                        gamerUiComponent?.SetFace(roomComponent.FacePanel[index]);
                        uiReady?.GetComponent <UIReadyComponent>()?.SetPanel(gamer, index);
                        //根据座位的indax添加玩家
                        roomComponent?.AddGamer(gamer, index);
                    }
                }
            }
            catch (Exception e)
            {
                Log.Error(e);
            }
        }
示例#10
0
        protected override async void Run(ETModel.Session session, Actor_GamerBuHua message)
        {
            try
            {
                Log.Info($"收到补花:{message.weight}");
                MahjongInfo mahjongInfo = new MahjongInfo()
                {
                    weight = (byte)message.weight, m_weight = (Consts.MahjongWeight)message.weight
                };
                UI              uiRoom          = Game.Scene.GetComponent <UIComponent>().Get(UIType.UIRoom);
                GamerComponent  gamerComponent  = uiRoom.GetComponent <GamerComponent>();
                UIRoomComponent uiRoomComponent = uiRoom.GetComponent <UIRoomComponent>();

                Gamer              gamer              = gamerComponent.Get(message.Uid);
                GamerUIComponent   gamerUiComponent   = gamer.GetComponent <GamerUIComponent>();
                HandCardsComponent handCardsComponent = gamer.GetComponent <HandCardsComponent>();

                if (PlayerInfoComponent.Instance.uid == message.Uid)
                {
                    handCardsComponent.BuHua(mahjongInfo, true);
                    SoundsHelp.Instance.PlayBuHua(PlayerInfoComponent.Instance.GetPlayerInfo().PlayerSound);
                }
                else
                {
                    handCardsComponent.BuHua(mahjongInfo, false);
                    SoundsHelp.Instance.PlayBuHua(gamer.PlayerInfo.PlayerSound);
                }

                //补花显示
                gamerUiComponent.SetBuHua(message.weight);
                gamerUiComponent.ShowBuHua();

                //剩下的牌
                uiRoomComponent.SetRestCount();
            }
            catch (Exception e)
            {
                Log.Error(e);
            }
        }
        protected override void Run(ETModel.Session session, Actor_GamerGrabLandlordSelect_Ntt message)
        {
            UI             uiRoom         = Game.Scene.GetComponent <UIComponent>().Get(UIType.LandlordsRoom);
            GamerComponent gamerComponent = uiRoom.GetComponent <GamerComponent>();
            Gamer          gamer          = gamerComponent.Get(message.UserID);

            if (gamer != null)
            {
                GamerUIComponent gamerUIComponent = gamer.GetComponent <GamerUIComponent>();
                if (gamer.UserID == gamerComponent.LocalGamer.UserID)
                {
                    uiRoom.GetComponent <LandlordsRoomComponent>().Interaction.EndGrab();
                }
                if (message.IsGrab)
                {
                    gamerUIComponent.SetGrab(GrabLandlordState.Grab);
                }
                else
                {
                    gamerUIComponent.SetGrab(GrabLandlordState.UnGrab);
                }
            }
        }
示例#12
0
        public static async void StartGame(Actor_StartGame message, bool isReconnect)
        {
            Log.Debug($"收到开始");

            try
            {
                UI uiRoom = Game.Scene.GetComponent <UIComponent>().Get(UIType.UIRoom);

                if (uiRoom == null)
                {
                    uiRoom = Game.Scene.GetComponent <UIComponent>().Create(UIType.UIRoom);
                }

                Game.Scene.GetComponent <UIComponent>().Remove(UIType.UIReady);
                Game.Scene.GetComponent <UIComponent>().Remove(UIType.UIGameResult);
                GamerComponent  gamerComponent  = uiRoom.GetComponent <GamerComponent>();
                UIRoomComponent uiRoomComponent = uiRoom.GetComponent <UIRoomComponent>();
                UIRoomComponent.ISGaming = true;
                uiRoomComponent.ContinueGamer();
                //好友房设置将退出变成解散
                if (UIRoomComponent.IsFriendRoom)
                {
                    uiRoomComponent.SetFriendSetting(PlayerInfoComponent.Instance.uid);
                    uiRoomComponent.SetCurrentJuCount(message.CurrentJuCount);
                }
                //先掷骰子
                if (!isReconnect)
                {
                    uiRoomComponent.exitBtn.interactable = false;
                    uiRoomComponent.players.SetActive(true);
                    GameObject DiceAnim   = uiRoomComponent.dice.Get <GameObject>("DiceAnim");
                    GameObject DiceBottom = uiRoomComponent.dice.Get <GameObject>("DiceBottom");
                    Image      Dice1      = DiceBottom.transform.Find("Dice1").GetComponent <Image>();
                    Image      Dice2      = DiceBottom.transform.Find("Dice2").GetComponent <Image>();
                    DiceAnim.SetActive(true);
                    SoundsHelp.Instance.playSound_ShaiZi();
                    await ETModel.Game.Scene.GetComponent <TimerComponent>().WaitAsync(2000);

                    DiceAnim.SetActive(false);
                    DiceBottom.SetActive(true);
                    int number1 = RandomHelper.RandomNumber(1, 7);
                    Dice1.sprite = CommonUtil.getSpriteByBundle("Image_Dice", "num_" + number1);
                    int number2 = RandomHelper.RandomNumber(1, 7);
                    Dice2.sprite = CommonUtil.getSpriteByBundle("Image_Dice", "num_" + number2);
                    await ETModel.Game.Scene.GetComponent <TimerComponent>().WaitAsync(1000);


                    //发牌动画

                    List <MahjongInfo> myCard = null;
                    foreach (var gameData in message.GamerDatas)
                    {
                        foreach (var mahjong in gameData.handCards)
                        {
                            mahjong.m_weight = (Consts.MahjongWeight)mahjong.weight;
                        }

                        foreach (var mahjong in gameData.faceCards)
                        {
                            mahjong.m_weight = (Consts.MahjongWeight)mahjong.weight;
                        }

                        foreach (var gamer in gamerComponent.GetAll())
                        {
                            if (gamer.UserID != gameData.UserID)
                            {
                                continue;
                            }
//                            if (gamer.UserID == PlayerInfoComponent.Instance.uid)
//                            {
//                                myCard = new List<MahjongInfo>(gameData.handCards);
//                            }
                            gamer.gameData = gameData;
                            GamerUIComponent gamerUi = gamer.GetComponent <GamerUIComponent>();
                            gamerUi.GameStart();

                            gamer.IsBanker = gameData.IsBanker;
                            HandCardsComponent handCards = gamer.GetComponent <HandCardsComponent>();
                            if (handCards != null)
                            {
                                handCards.Reset();
                            }
                            else
                            {
                                handCards = gamer.AddComponent <HandCardsComponent, GameObject, int, int>(gamerUi.Panel, gamerUi.Index, gameData.SeatIndex);
                            }

                            handCards.myCard = new List <MahjongInfo>(gameData.handCards);
                        }
                    }

                    for (int i = 0; i < 4; i++)
                    {
                        foreach (var gamer in gamerComponent.GetAll())
                        {
                            HandCardsComponent handCards = gamer.GetComponent <HandCardsComponent>();

                            if (PlayerInfoComponent.Instance.uid == gamer.UserID)
                            {
                                handCards.StartDealCardAnim(true);
                            }
                            else
                            {
                                handCards.StartDealCardAnim(false);
                            }
                            await ETModel.Game.Scene.GetComponent <TimerComponent>().WaitAsync(400);
                        }
                    }

                    //自己的牌翻一下
                    foreach (var gamer in gamerComponent.GetAll())
                    {
                        if (gamer.UserID == PlayerInfoComponent.Instance.uid)
                        {
                            HandCardsComponent handCards = gamer.GetComponent <HandCardsComponent>();
                            handCards.FanPai();
                        }
                    }
                    await ETModel.Game.Scene.GetComponent <TimerComponent>().WaitAsync(500);

                    DiceBottom.SetActive(false);
                }

                uiRoomComponent.StartGame(message.restCount);
                uiRoomComponent.exitBtn.interactable = true;
                // uiRoomComponent.SetRoomType(message.RoomType);

                foreach (var gameData in message.GamerDatas)
                {
                    foreach (var mahjong in gameData.handCards)
                    {
                        mahjong.m_weight = (Consts.MahjongWeight)mahjong.weight;
                    }

                    foreach (var mahjong in gameData.faceCards)
                    {
                        mahjong.m_weight = (Consts.MahjongWeight)mahjong.weight;
                    }

                    foreach (var gamer in gamerComponent.GetAll())
                    {
                        if (gamer.UserID != gameData.UserID)
                        {
                            continue;
                        }

                        GamerUIComponent gamerUi = gamer.GetComponent <GamerUIComponent>();
                        gamerUi.GameStart();
                        HandCardsComponent handCards = gamer.GetComponent <HandCardsComponent>();
                        if (handCards != null)
                        {
                            handCards.Reset();
                        }
                        else
                        {
                            handCards = gamer.AddComponent <HandCardsComponent, GameObject, int, int>(gamerUi.Panel, gamerUi.Index, gameData.SeatIndex);
                        }

                        //设置庄家
                        gamer.IsBanker = gameData.IsBanker;
                        gamerUi.SetZhuang();

                        //当前出牌玩家
                        if (gamer.IsBanker)
                        {
                            gamerComponent.CurrentPlayUid = gamer.UserID;
                        }

                        if (gamer.UserID == gamerComponent.LocalGamer.UserID)
                        {
                            //本地玩家添加手牌
                            uiRoomComponent.SetTreasureTime(gameData.OnlineSeconds);
                            handCards.AddCards(gameData.handCards);
                            handCards.ShowBg();
                        }
                        else
                        {
                            handCards.AddOtherCards(gamer.IsBanker);
                        }

                        handCards.SetFaceCards(gameData.faceCards);
                        foreach (var card in gameData.faceCards)
                        {
                            gamerUi.SetBuHua(card.weight);
                        }
                    }
                }

                //时间倒计时
                foreach (var gamer in gamerComponent.GetAll())
                {
                    if (gamer.IsBanker)
                    {
                        uiRoomComponent.ShowTurn(gamer.UserID);
                    }
                }

                uiRoom.GameObject.SetActive(true);
                UIRoomComponent.ISGaming = true;

                uiRoomComponent?.tip?.SetActive(true);
                uiRoomComponent.tip.GetComponentInChildren <Image>().sprite = CommonUtil.getSpriteByBundle("Image_Desk_Card", "shangji_tip");
                await ETModel.Game.Scene.GetComponent <TimerComponent>().WaitAsync(3000);

                if (uiRoomComponent != null)
                {
                    if (uiRoomComponent.tip != null)
                    {
                        uiRoomComponent?.tip?.SetActive(false);
                    }
                }
            }
            catch (Exception e)
            {
                Log.Error(e);
            }
        }
        protected override async void Run(ETModel.Session session, Actor_GamerReconnet message)
        {
            try
            {
                Log.Info($"断线重连:");
                SoundsHelp.Instance.IsOpenSound(false);

                GameObject mask = GameObject.Instantiate(CommonUtil.getGameObjByBundle("Image_Desk_Card", "RoomMask"), GameObject.Find("Global/UI/CommonCanvas").transform);

                //进入
                List <GamerInfo> Gamers = new List <GamerInfo>();
                foreach (var item in message.Gamers)
                {
                    GamerInfo gamerInfo = new GamerInfo();
                    gamerInfo.UserID     = item.UserID;
                    gamerInfo.SeatIndex  = item.SeatIndex;
                    gamerInfo.IsReady    = true;
                    gamerInfo.playerInfo = item.playerInfo;
                    Gamers.Add(gamerInfo);

                    //将出的牌加入到手牌中
                    item.handCards.AddRange(item.playCards);

                    foreach (var card in item.pengCards)
                    {
                        item.handCards.Add(card);
                        item.handCards.Add(card);
                    }

                    foreach (var card in item.gangCards)
                    {
                        item.handCards.Add(card);
                        item.handCards.Add(card);
                        item.handCards.Add(card);
                    }

                    Logic_NJMJ.getInstance().SortMahjong(item.handCards);

                    Log.Info($"{item.UserID} 手牌:{item.handCards.Count}");
                }

                Actor_GamerEnterRoom actorGamerEnterRoom = new Actor_GamerEnterRoom()
                {
                    Gamers   = Gamers,
                    RoomType = message.RoomType,
                };
                if (message.RoomType == 3)
                {
                    actorGamerEnterRoom.RoomId       = message.RoomId;
                    actorGamerEnterRoom.MasterUserId = message.MasterUserId;
                    actorGamerEnterRoom.JuCount      = message.JuCount;
                    actorGamerEnterRoom.Multiples    = message.Multiples;
                }
                await Actor_GamerEnterRoomHandler.GamerEnterRoom(actorGamerEnterRoom);

                //开始游戏
                var actorStartGame = new Actor_StartGame();
                actorStartGame.GamerDatas = message.Gamers;
                actorStartGame.restCount  = message.RestCount;
                actorStartGame.RoomType   = message.RoomType;
                if (actorStartGame.RoomType == 3)
                {
                    actorStartGame.CurrentJuCount = message.CurrentJuCount;
                }

                Actor_StartGameHandler.StartGame(actorStartGame, true);

                //碰刚
                foreach (var item in message.Gamers)
                {
                    for (int i = 0; i < item.pengCards.Count; i++)
                    {
                        MahjongInfo          card           = item.pengCards[i];
                        Actor_GamerOperation gamerOperation = new Actor_GamerOperation();
                        gamerOperation.Uid           = item.UserID;
                        gamerOperation.weight        = card.weight;
                        gamerOperation.OperationType = 0;
                        gamerOperation.OperatedUid   = item.OperatedPengUserIds[i];
                        Actor_GamerOperateHandler.GamerOperation(gamerOperation, true);
                    }

                    for (int i = 0; i < item.gangCards.Count; i++)
                    {
                        MahjongInfo          card = item.gangCards[i];
                        long                 operatedGangUserIds = item.OperatedGangUserIds[i];
                        Actor_GamerOperation gamerOperation      = new Actor_GamerOperation();
                        gamerOperation.Uid           = item.UserID;
                        gamerOperation.weight        = card.weight;
                        gamerOperation.OperationType = 1;
                        gamerOperation.OperatedUid   = operatedGangUserIds;

                        if (operatedGangUserIds == 0)
                        {
                            gamerOperation.OperationType = 4;
                        }
                        Actor_GamerOperateHandler.GamerOperation(gamerOperation, true);
                    }
                }

                //打牌
                foreach (var item in message.Gamers)
                {
                    Log.Debug($"{item.UserID} 重连出牌");
                    for (int i = 0; i < item.playCards.Count; i++)
                    {
                        MahjongInfo         card     = item.playCards[i];
                        int                 index    = Logic_NJMJ.getInstance().GetIndex(item.handCards, card);
                        Actor_GamerPlayCard playCard = new Actor_GamerPlayCard();
                        playCard.Uid    = item.UserID;
                        playCard.weight = card.weight;
                        playCard.index  = index;
//                        await ETModel.Game.Scene.GetComponent<TimerComponent>().WaitAsync(100);
                        Actor_GamerPlayCardHandler.PlayCard(playCard);
//                        item.handCards.RemoveAt(index);
                    }
                }

                //托管恢复
                UI              uiRoom          = Game.Scene.GetComponent <UIComponent>().Get(UIType.UIRoom);
                GamerComponent  gamerComponent  = uiRoom.GetComponent <GamerComponent>();
                UIRoomComponent uiRoomComponent = uiRoom.GetComponent <UIRoomComponent>();
                foreach (var item in message.Gamers)
                {
                    if (item.IsTrusteeship)
                    {
                        if (item.UserID == PlayerInfoComponent.Instance.uid)
                        {
                            uiRoomComponent.ShowTrustship();
                        }
                        else
                        {
                            GamerUIComponent gamerUIComponent = gamerComponent.Get(item.UserID).GetComponent <GamerUIComponent>();
                            gamerUIComponent.ShowTrust();
                        }
                    }
                }

                await ETModel.Game.Scene.GetComponent <TimerComponent>().WaitAsync(3000);

                int openSound = PlayerPrefs.GetInt("isOpenSound", 1);
                SoundsHelp.Instance.IsOpenSound(openSound == 1);
                GameObject.Destroy(mask);
            }
            catch (Exception e)
            {
                Log.Error(e);
            }
        }
        public static async Task GamerEnterRoom(Actor_GamerEnterRoom message)
        {
            try
            {
                //玩家还在结算画面
                if (Game.Scene.GetComponent <UIComponent>().Get(UIType.UIGameResult) != null || UIRoomComponent.ISGaming)
                {
                    return;
                }

                Log.Info($"收到玩家进入");
                //第一次进入创建UIRoom
                if (Game.Scene.GetComponent <UIComponent>().Get(UIType.UIRoom) == null)
                {
                    CommonUtil.ShowUI(UIType.UIRoom);
                    Game.Scene.GetComponent <UIComponent>().Remove(UIType.UIMain);
                    Game.Scene.GetComponent <UIComponent>().Remove(UIType.UICreateFriendRoom);
                    Game.Scene.GetComponent <UIComponent>().Remove(UIType.UIJoinRoom);
                }

                if (Game.Scene.GetComponent <UIComponent>().Get(UIType.UIReady) == null)
                {
                    CommonUtil.ShowUI(UIType.UIReady);
                }
                UINetLoadingComponent.closeNetLoading();
                UI              uiRoom         = Game.Scene.GetComponent <UIComponent>().Get(UIType.UIRoom);
                UI              uiReady        = Game.Scene.GetComponent <UIComponent>().Get(UIType.UIReady);
                GamerComponent  gamerComponent = uiRoom.GetComponent <GamerComponent>();
                UIRoomComponent roomComponent  = uiRoom.GetComponent <UIRoomComponent>();
                roomComponent.ContinueGamer();
                roomComponent.enterRoomMsg = message;
                roomComponent.SetRoomType(message.RoomType, message.Multiples);
                Gamer[] gamers = gamerComponent.GetAll();

                //清空座位
                for (int i = 0; i < gamers.Length; i++)
                {
                    if (gamers[i] == null)
                    {
                        continue;
                    }

                    if (gamers[i].UserID != 0)
                    {
                        Log.Debug("删除gamer");
                        roomComponent.RemoveGamer(gamers[i].UserID);
                    }
                }

                GamerInfo localGamer = null;
                for (int i = 0; i < message.Gamers.Count; i++)
                {
                    if (message.Gamers[i].UserID == PlayerInfoComponent.Instance.uid)
                    {
                        localGamer = message.Gamers[i];
                        gamerComponent.LocalGamer = GamerFactory.Create(localGamer.UserID, localGamer.IsReady, localGamer.playerInfo);
                        break;
                    }
                }

                if (localGamer == null)
                {
                    return;
                }

                roomComponent.localGamer = localGamer;

                //好友房处理
                if (message.RoomType == 3)
                {
                    UIRoomComponent.IsFriendRoom = true;
                    roomComponent.JuCount        = message.JuCount;
                    uiReady?.GetComponent <UIReadyComponent>()?.ClosePropt();
                    uiReady?.GetComponent <UIReadyComponent>()?.SetFriendRoom(true);
                    uiReady?.GetComponent <UIReadyComponent>()?.ShowWeChat(message.RoomId.ToString());
                    roomComponent.RoomConfig.Multiples = message.Multiples;
                    roomComponent.SetFriendSetting(message.MasterUserId);

                    if (message.CurrentJuCount > 0)
                    {
                        uiReady?.GetComponent <UIReadyComponent>()?.CloseBtn();
                        roomComponent.exitBtn.interactable = false;
                    }
                }
                else
                {
                    uiReady?.GetComponent <UIReadyComponent>()?.SetFriendRoom(false);
                    UIRoomComponent.IsFriendRoom = false;
                }

                for (int i = 0; i < message.Gamers.Count; i++)
                {
                    GamerInfo gamerInfo = message.Gamers[i];
                    Gamer     gamer;
                    if (gamerInfo.UserID == localGamer.UserID)
                    {
                        gamer = gamerComponent.LocalGamer;
                    }
                    else
                    {
                        gamer = GamerFactory.Create(gamerInfo.UserID, gamerInfo.IsReady, gamerInfo.playerInfo);
                    }

                    UIReadyComponent uiReadyComponent = uiReady.GetComponent <UIReadyComponent>();
                    GamerUIComponent gamerUiComponent = gamer.GetComponent <GamerUIComponent>();

                    //排序
                    int index = gamerInfo.SeatIndex - localGamer.SeatIndex;
                    if (index < 0)
                    {
                        index += 4;
                    }

                    //设置准备
                    if (uiReadyComponent != null)
                    {
                        if (gamer?.PlayerInfo != null)
                        {
                            gamerUiComponent?.SetHeadPanel(uiReadyComponent.HeadPanel[index], index);
                            gamerUiComponent?.SetFace(roomComponent.FacePanel[index]);
                            uiReady?.GetComponent <UIReadyComponent>()?.SetPanel(gamer, index);
                            //根据座位的indax添加玩家
                            roomComponent?.AddGamer(gamer, index);
                        }
                    }
                }

                SoundsHelp.Instance.playSound_JinRu();
            }
            catch (Exception e)
            {
                Log.Error(e);
            }
        }