/// <summary> /// 准备 /// </summary> /// <param name="client"></param> private void ready(ClientPeer client) { SingleExecute.Instance.Execute( () => { if (userCache.IsOnline(client) == false) { return; } int userId = userCache.GetId(client); if (fightCache.IsInRoom(userId) == false) { return; } //一定要注意安全的验证 _21MutiFightRoom room = fightCache.GetRoom(userId); room.Ready(userId); //之前忘记了 &&&……%……&¥&¥&%#%#&¥&……%& room.Brocast(OpCode._21Multi, _21MultiCode.READY_BRO, userId); //检测:是否所有玩家都准备了 //if (room.IsAllReady()) //{ // //通知房间内的玩家 要进行战斗了 给客户端群发消息 // room.Brocast(OpCode._21Multi, _21MultiCode.START_BRO, null); // Console.WriteLine("要开始战斗了"); // Thread.Sleep(1000); // //开始战斗 // StartFight(userId, client, room); //} } ); }