public void DoGameOperPlayerActionSyn(int action, params int[] card) { Debug.LogFormat("=>DoActionSyn action:{0},card1:{1},card2:{2}", ActionStr(action), card.Length > 0 ? GetCardStr(card[0]) : GetCardStr(-1), card.Length > 1 ? GetCardStr(card[1]) : GetCardStr(-1)); RoomMgr.actionNotify.actions = 0; GameOperPlayerActionSyn content = new GameOperPlayerActionSyn(); content.action = action; content.cardValue.AddRange(card); GameOperation request = new GameOperation() { operType = GameOperType.GameOperPlayerActionSyn }; request.content = NetSerilizer.Serialize <GameOperPlayerActionSyn>(content); PacketBase msg = new PacketBase() { packetType = PacketType.GameOperation }; msg.data = NetSerilizer.Serialize <GameOperation>(request); SocketNetTools.SendMsg(msg); }
void OnGameOperPlayerActionSyn(GameOperPlayerActionSyn data) { Debug.LogFormat("===<color=green>同步</color>[seq({0})]:{1} <color=yellow>{2}</color> 牌:[{3}]", data.seq, strs[data.position], ActionStr(data.action), ToStr(data.cardValue)); int position = data.position; MJPlayer player = Game.MJMgr.GetPlayerByPosition(data.position); bool isMy = player.index == 0; if (MJUtils.DragCard(data.action)) { int card = data.cardValue[0]; player.DragCard(card, isMy); } else if (MJUtils.DropCard(data.action)) { HandAnima.IsBusy = true; int card = data.cardValue[0]; //Game.MJMgr.LastDropCardPlayer = player; player.MJHand.PlayDropCard(card, isMy); } else if (MJUtils.Peng(data.action)) { player.MJHand.PlayPeng(data.cardValue[0], isMy); } //胡牌的动画 else if (MJUtils.Hu(data.action)) { player.MJHand.PlayHU(data.cardValue[0], isMy); } else if (MJUtils.Chi(data.action)) { player.MJHand.PlayChi(data.cardValue[0], data.cardValue[1], isMy); } else if (MJUtils.AnGang(data.action)) { player.MJHand.PlayGang(data.cardValue[0], isMy, 1); } else if (MJUtils.BuGang(data.action)) { player.MJHand.PlayGang(data.cardValue[0], isMy, 2); } else if (MJUtils.ZhiGang(data.action)) { player.MJHand.PlayGang(data.cardValue[0], isMy, 3); } else if (MJUtils.Ting(data.action)) { player.MJHand.PlayTing(isMy); } else if (MJUtils.TingLiang(data.action)) { player.MJHand.PlayTingLiang(data.cardValue[0], isMy); } else if (MJUtils.TingPeng(data.action)) { player.MJHand.PlayPeng(data.cardValue[0], isMy); Game.Delay(0.5f, () => { player.MJHand.PlayTing(isMy); }); } else if (MJUtils.TingChi(data.action)) { player.MJHand.PlayChi(data.cardValue[0], data.cardValue[1], isMy); Game.Delay(0.5f, () => { player.MJHand.PlayTing(isMy); }); } else if (MJUtils.TingZhidui(data.action)) { Game.SoundManager.PlayZhidui(position); int card = data.cardValue[0]; Game.MJMgr.MjData[position].player.ting = true; EventDispatcher.DispatchEvent(MessageCommand.MJ_UpdatePlayPage); player.handCardLayout.PlayZhidui(card, isMy); } else if (MJUtils.ShuaiJiuYao(data.action)) { player.MJHand.PlayShuaiJiuYao(data.cardValue.ToArray(), isMy); } }