Ejemplo n.º 1
0
        protected override async void Run(ETModel.Session session, Actor_GamerGrabCard message)
        {
            try
            {
                Log.Info($"收到抓拍");
                MahjongInfo mahjongInfo = new MahjongInfo()
                {
                    weight = (byte)message.weight, m_weight = (Consts.MahjongWeight)message.weight
                };
                UI uiRoom = Game.Scene.GetComponent <UIComponent>().Get(UIType.UIRoom);
                if (uiRoom == null)
                {
                    return;
                }
                GamerComponent  gamerComponent  = uiRoom.GetComponent <GamerComponent>();
                UIRoomComponent uiRoomComponent = uiRoom.GetComponent <UIRoomComponent>();

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

                if (PlayerInfoComponent.Instance.uid == message.Uid)
                {
                    handCardsComponent.GrabCard(mahjongInfo);
                }
                else
                {
                    handCardsComponent.GrabOtherCard();
                }

                //当前出牌玩家
                gamerComponent.CurrentPlayUid = message.Uid;
                gamerComponent.IsPlayed       = false;

                //剩下的牌
                uiRoomComponent.SetRestCount();

                //显示黄色bg
                uiRoomComponent.ShowTurn(message.Uid);
                uiRoomComponent.ClosePropmtBtn();

                SoundsHelp.Instance.playSound_MoPai();

                uiRoomComponent.CurrentMahjong = mahjongInfo;

                Gamer currentGamer = gamerComponent.Get(PlayerInfoComponent.Instance.uid);
                HandCardsComponent currentGamerCard = currentGamer.GetComponent <HandCardsComponent>();
                currentGamerCard.CloseHandCardCanPeng();
            }
            catch (Exception e)
            {
                Log.Error(e);
            }
        }
Ejemplo n.º 2
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);
            }
        }