/// <summary> /// 服务端处理数学系技能的协议 /// 给客户端发送这些牌id的数组 /// </summary> /// <param name="msgBase"></param> public void ProcessMath(MsgMath msg) { msg.paiId = paiManager.GetPaiIdRandom(msg.observedPlayerId, turnNum); doSkillTime[msg.observerPlayerId]++; msg.canSkill = doSkillTime[msg.observerPlayerId] < maxSkillTime[msg.observerPlayerId] ? true : false; Broadcast(msg); }
/// <summary> /// 发动数学系的技能,发送MsgMath协议 /// </summary> public void LaunchMath(int selectedPlayerIndex) { MsgMath msg = new MsgMath(); msg.observerPlayerId = id; msg.observedPlayerId = selectedPlayerIndex; msg.paiId = null; Debug.Log("发动技能的玩家id为 " + id); Debug.Log("被观察的id为 " + selectedPlayerIndex); NetManager.Send(msg); }
public static void MsgMath(ClientState c, MsgBase msgBase) { MsgMath msg = (MsgMath)msgBase; Player player = c.player; if (player == null) { return; } Room room = RoomManager.GetRoom(player.roomId); if (room == null) { return; } GameManager gameManager = room.gameManager; if (gameManager == null) { return; } gameManager.ProcessMath(msg); }
/// <summary> /// 客户端处理数学系技能的协议 /// 根据服务端的消息生成对应的牌,并重新开始计时 /// </summary> /// <param name="msgBase"></param> public void OnMsgMath(MsgBase msgBase) { Debug.Log("客户端接收msgMath信息"); MsgMath msg = (MsgMath)msgBase; if (msg.observerPlayerId == client_id) { skillCount--; gamePanel.RestSkillCount = skillCount; gamePanel.ChuPaiButton = true; } if (msg.observerPlayerId == client_id) { GamePanel.DisplayOtherPai(msg.paiId); } if (msg.canSkill && msg.observerPlayerId == client_id)//如果可以发动技能,就显示发动技能的按钮 { gamePanel.SkillButton = true; } isChuPai = true; StartTimeCount(); }