Beispiel #1
0
 public void JoinGame(LobbyDto lobby)
 {
     networkAddress = lobby.ip;
     networkAddress = "localhost";
     Debug.Log("Attempting to connect to " + networkAddress);
     StartClient();
 }
Beispiel #2
0
 public CreateLobbyResponse(Guid id, Guid requestId, LobbyDto lobbyDto, bool isSuccess)
 {
     Id        = id;
     RequestId = requestId;
     IsSuccess = isSuccess;
     LobbyDto  = lobbyDto;
 }
Beispiel #3
0
 public void SwitchToLobby(LobbyDto lobby)
 {
     DisableAllPanels();
     _lobbyPanel.SetActive(true);
     _lobbyPanel.GetComponent <LobbyUi>().PopulateDetails(lobby);
     _activePanel = _lobbyPanel;
 }
Beispiel #4
0
 public void SetData(LobbyDto lobby)
 {
     _lobby             = lobby;
     _lobbyName.text    = lobby.name;
     _lobbyPlayers.text = $"{lobby.players}/{lobby.maxPlayers}";
     _lobbyMap.text     = lobby.map;
 }
Beispiel #5
0
    public void Populate(LobbyDto lobby)
    {
        gameObject.SetActive(true);
        EmptyContent.SetActive(false);

        _lobbyName.text    = lobby.name;
        _lobbyPlayers.text = $"{lobby.players}/{lobby.maxPlayers}";
        _lobbyMap.text     = lobby.map;
    }
        public async Task <ActionResult <Lobby> > CreateLobby(LobbyDto lobbyDto)
        {
            var lobby = new Lobby
            {
                NumberOfLives = lobbyDto.NumberOfLives,
                LobbySize     = lobbyDto.LobbySize,
                Status        = LobbyStatus.New
            };

            _context.Lobbies.Add(lobby);
            await _context.SaveChangesAsync();

            return(CreatedAtAction("GetLobby", new { id = lobby.Id }, lobby));
        }
Beispiel #7
0
    // UI Hooks
    // ReSharper disable UnusedMember.Global
    public void HostGameClicked()
    {
        var lobby = new LobbyDto
        {
            name       = "Test lobby",
            maxPlayers = 8,
            players    = 1,
            ip         = "localhost",
            map        = "test_map"
        };

        LobbyManager.Instance.HostGame();
        SwitchToLobby(lobby);
    }
Beispiel #8
0
        public async Task CreateLobby()
        {
            // Arrange
            var lobby = new LobbyDto {
                LobbySize = 5, NumberOfLives = 15
            };
            var content = new StringContent(JsonSerializer.Serialize(lobby), Encoding.UTF8, "application/json");

            // Act
            var response = await _client.PostAsync(_baseUrl, content);

            // Assert
            response.EnsureSuccessStatusCode();
        }
Beispiel #9
0
 public void SetJoinedLobby(LobbyDto lobbyDto)
 {
     joinedLobby = lobbyDto;
 }
Beispiel #10
0
 public void LobbySelected(LobbyDto lobby)
 {
     _selectedLobby = lobby;
     JoinLobbyDetails.Populate(lobby);
 }
Beispiel #11
0
 public void PopulateDetails(LobbyDto lobby)
 {
     Debug.Log("Populating details");
     _lobbyDetails.Populate(lobby);
 }