Ejemplo n.º 1
0
        public void ServerBroadcastCreateRoom(string roomName)
        {
            PlayerModel player = PlayerManagerModel.Instance.PlayerCollection.Find(p => p.ConnectionId.ToString() == Context.ConnectionId);

            if (player != null)
            {
                if (player.seatNumber != 0)
                {
                    Clients.Caller.clientReceivePlayerCreateRoomErrorPlayerIsAlreadyAdmin();
                    return;
                }
                RoomModel room = new RoomModel(player, roomName);
                player.roomPlayerIsIn = room;
                RoomManagerModel.Instance.RoomCollection.Add(room);
                Clients.All.clientReceiveRoomCreated(roomName);
                Clients.Caller.clientReceiveSetRoomToPlayerOnRoomCreated(roomName);
            }
        }
Ejemplo n.º 2
0
 public void AddRoom(RoomModel room)
 {
     RoomCollection.Add(room);
 }
Ejemplo n.º 3
0
        private bool AreAllPlayersReady(RoomModel room)
        {
            int counter = 0;
            foreach (var item in room.Players)
            {
                if (item.Ready)
                    counter++;
            }

            if (counter == RoomModel.MaxNumOfPlayersInRoom)
            {
                return true;
            }
            else
            {
                return false;
            }
        }
Ejemplo n.º 4
0
        private List<HomePage_PlayersInARoomViewModel> GetPlayerNamesInRoom(RoomModel room)
        {
            List<HomePage_PlayersInARoomViewModel> playerNames = new List<HomePage_PlayersInARoomViewModel>();
            foreach (var item in room.Players)
            {
                HomePage_PlayersInARoomViewModel player = new HomePage_PlayersInARoomViewModel(item.Name, item.seatNumber, item.Ready);
                playerNames.Add(player);
            }

            return playerNames;
        }
Ejemplo n.º 5
0
 public void AddRoom(RoomModel room)
 {
     RoomCollection.Add(room);
 }