Exemplo n.º 1
0
    /// <summary>
    /// 客户端接收化学系的协议
    /// 进行相关的同步,并重新计时,继续让同一个玩家出牌
    /// </summary>
    public void OnMsgChemistry(MsgBase msgBase)
    {
        MsgChemistry msg = (MsgChemistry)msgBase;

        if (msg.id == client_id)
        {
            skillCount--;
            gamePanel.RestSkillCount = skillCount;
            gamePanel.ChuPaiButton   = true;
        }
        if (msg.canSkill && msg.id == client_id)//如果可以发动技能,就显示发动技能的按钮
        {
            gamePanel.SkillButton = true;
        }

        players[msg.id].DiscardPai(msg.paiIndex);

        CreatePai(msg.paiId, msg.id);
        players[msg.id].SynHandPai(); //同步牌的顺序
        players[msg.id].PlacePai();   //调整牌的位置
        gamePanel.HandPaiCount = new int[] { (int)gamePanel.numToDir[msg.id], players[msg.id].handPai.Count };
        Debug.Log("客户端接收msgchemistry信息");
        isChuPai = true;

        StartTimeCount();
    }
Exemplo n.º 2
0
    /// <summary>
    /// 代表发动化学系的技能,发送MsgChemistry协议
    /// </summary>
    public void LaunchChemistry()
    {
        MsgChemistry msg = new MsgChemistry();

        msg.id           = id;
        msg.paiIndex     = selectedPaiIndex;
        selectedPaiIndex = -1;
        NetManager.Send(msg);
    }
Exemplo n.º 3
0
    /// <summary>
    /// 服务端处理化学系的协议
    /// 删除指定的牌,添加一个额外的牌,并广播,使得每一个客户端重新开始计时
    /// </summary>
    /// <param name="msgBase"></param>
    public void ProcessChemistry(MsgChemistry msg)
    {
        int paiId = paiManager.ChuPai(msg.paiIndex, msg.id);//删除指定的牌

        Console.WriteLine("删除牌的id为 " + paiId);
        paiId = paiManager.FaPai(msg.id);
        Console.WriteLine("重新得到的牌id为 " + paiId);
        msg.paiId = paiId;
        doSkillTime[msg.id]++;
        msg.canSkill = doSkillTime[msg.id] < maxSkillTime[msg.id] ? true : false;
        Broadcast(msg);
    }
Exemplo n.º 4
0
    public static void MsgChemistry(ClientState c, MsgBase msgBase)
    {
        MsgChemistry msg    = (MsgChemistry)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.ProcessChemistry(msg);
    }