예제 #1
0
        public int GetPlayerRoomId(int playerkey)
        {
            int id = -1;

            id = RoomPlayersKeys.FindIndex(k => k == playerkey);
            return(id);
        }
예제 #2
0
        public int AddPlayer(string name, string databaseId)
        {
            if (IsRoomFull())
            {
                throw new InvalidOperationException("Room is full");
            }

            PlayersNames.Add(name);
            PlayerDatabaseId.Add(databaseId);

            Random random          = new System.Random();
            int    playerSecretKey = random.GetHashCode();

            RoomPlayersKeys.Add(playerSecretKey);

            return(playerSecretKey);
        }