Esempio n. 1
0
 /// <summary>
 /// 准备
 /// </summary>
 /// <param name="client"></param>
 private void Ready(ClientPeer client)
 {
     SingleExecute.Instance.Execute(() =>
     {
         //安全校验
         if (!userCache.IsOnLine(client))
         {
             return;
         }
         int userId = userCache.GetIdByClient(client);
         if (matchCache.IsMatching(userId) == false)
         {
             return;
         }
         //玩家准备list添加
         MatchRoom room = matchCache.GetRoom(userId);
         room.Ready(userId);
         room.Brocast(OpCode.MATCH, MatchCode.READY_BRO, userId);
         //每准备一个 判断一下是否全部准备
         if (room.IsReady())
         {
             //开始进入战斗
             //客户端群发进入战斗
             startFight(room.GetIdList());
             room.Brocast(OpCode.MATCH, MatchCode.START_BRO, null);
             //销毁准备房间
             matchCache.Destroy(room);
         }
     });
 }