Merge pull request #11 from SemvdH/setupBranch

merge Setup branch into master
This commit is contained in:
SemvdH
2020-10-23 14:06:36 +02:00
committed by GitHub
2 changed files with 4 additions and 0 deletions

View File

@@ -61,6 +61,7 @@ namespace Client
Debug.WriteLine("attempting to host game for " + ClientData.Instance.User.Username); Debug.WriteLine("attempting to host game for " + ClientData.Instance.User.Username);
client.SendMessage(JSONConvert.ConstructLobbyHostMessage()); client.SendMessage(JSONConvert.ConstructLobbyHostMessage());
client.OnLobbyCreated = becomeHostForLobby; client.OnLobbyCreated = becomeHostForLobby;
} }
private void becomeHostForLobby(int id) private void becomeHostForLobby(int id)
@@ -68,6 +69,7 @@ namespace Client
Debug.WriteLine($"got host succes with data {id} "); Debug.WriteLine($"got host succes with data {id} ");
wantToBeHost = true; wantToBeHost = true;
wantToBeHostId = id; wantToBeHostId = id;
ClientData.Instance.User.Host = true;
client.OnLobbiesReceivedAndWaitingForHost = hostLobbiesReceived; client.OnLobbiesReceivedAndWaitingForHost = hostLobbiesReceived;
} }

View File

@@ -29,6 +29,7 @@ namespace Client.Views
{ {
User user = new User(usernameTextbox.Text); User user = new User(usernameTextbox.Text);
Client client = new Client(user.Username); Client client = new Client(user.Username);
loginButton.IsEnabled = false;
client.OnSuccessfullConnect = () => client.OnSuccessfullConnect = () =>
{ {
// because we need to start the main window on a UI thread, we need to let the dispatcher handle it, which will execute the code on the ui thread // because we need to start the main window on a UI thread, we need to let the dispatcher handle it, which will execute the code on the ui thread
@@ -42,6 +43,7 @@ namespace Client.Views
}); });
}; };
} }
} }
} }