コード例 #1
0
        /// <summary>
        /// 不出的处理
        /// </summary>
        /// <param name="client"></param>
        private void Pass(ClientPeer client)
        {
            SingleExecute.Instance.Execute(
                delegate()
            {
                //玩家在线
                if (user.IsOnLine(client) == false)
                {
                    return;
                }

                int userId     = user.GetIdByClient(client);
                FightRoom room = fight.GetRoom(userId);

                //2中情况

                if (room.roundModel.BiggestUid == userId)
                {
                    //我是最大的  我必须得出
                    client.Send(OpCode.FIGHT, FightCode.PASS_SRES, -1);
                    return;
                }
                else
                {   //可以不出
                    client.Send(OpCode.FIGHT, FightCode.PASS_SRES, 0);
                    Turn(room);
                }
            }
                );
        }
コード例 #2
0
 public void Chat(ClientPeer client, int type)
 {
     SingleExecute.Instance.Execute(() => {
         if (!user.IsOnLine(client))
         {
             return;
         }
         int userId = user.GetId(client);
         //匹配场景
         if (match.IsMatching(userId))
         {
             MatchRoom mr = match.GetRoom(userId);
             ChatDto dto  = new ChatDto(userId, type);
             mr.Brocast(OpCode.CHAT, ChatCode.CHAT_SRES, dto);
         }
         else if (fight.IsFighting(userId))
         {
             //战斗场景
             FightRoom mr = fight.GetRoom(userId);
             ChatDto dto  = new ChatDto(userId, type);
             //fight.(OpCode.CHAT, ChatCode.CHAT_SRES, dto);
             Brocast(mr, OpCode.CHAT, ChatCode.CHAT_SRES, dto);
         }
     });
 }
コード例 #3
0
        /// <summary>
        /// 不出牌
        /// </summary>
        /// <param name="client"></param>
        private void BuChu(ClientPeer client)
        {
            SingleExecute.Instance.Execute(() => {
                if (!user.IsOnLine(client))
                {
                    return;
                }

                int userId = user.GetId(client);
                var room   = fight.GetRoom(userId);
                if (room.round.currentBiggsetId == userId)
                {
                    //不能不出
                    client.StartSend(OpCode.FIGHT, FightCode.BUCHU_SRES, null);
                    return;
                }
                //给客户端发送消息  我收到了你的不出请求
                //client.StartSend(OpCode.FIGHT,FightCode.BUCHU_BRO,null);
                Brocast(room, OpCode.FIGHT, FightCode.BUCHU_BRO, userId);

                //让下家出牌
                Turn(room, FightCode.CHUPAI_TURN_BRO);
            });
        }