[ADD] added buttons reenabled when leaving

This commit is contained in:
Sem van der Hoeven
2020-10-21 21:55:28 +02:00
parent 442cdccc49
commit cc5c71a30f
3 changed files with 16 additions and 15 deletions

View File

@@ -8,7 +8,7 @@ using static SharedClientServer.JSONConvert;
namespace Client
{
public delegate void OnLobbyCreated(int id);
public delegate void LobbyCallback(int id);
class Client : ObservableObject
{
private TcpClient tcpClient;
@@ -23,7 +23,8 @@ namespace Client
public Callback OnLobbiesListReceived;
public Callback OnLobbyJoinSuccess;
public Callback OnLobbiesReceivedAndWaitingForHost;
public OnLobbyCreated OnLobbyCreated;
public LobbyCallback OnLobbyCreated;
public LobbyCallback OnLobbyLeave;
public Lobby[] Lobbies { get; set; }
public Client(string username)
@@ -118,6 +119,10 @@ namespace Client
case LobbyIdentifier.JOIN_SUCCESS:
OnLobbyJoinSuccess?.Invoke();
break;
case LobbyIdentifier.LEAVE:
int lobbyLeaveID = JSONConvert.GetLobbyID(payload);
OnLobbyLeave?.Invoke(lobbyLeaveID);
break;
}
//TODO fill lobby with the data received
break;