mabre / team61

Other
2 stars 4 forks source link

UI changes for Network Lobby II #71

Closed mabre closed 10 years ago

mabre commented 10 years ago

close #67?

Jessypet commented 10 years ago

"on clients only" -> How do I do the distinction between server and client?

mabre commented 10 years ago

You created different constructors for host and client, so that’s the place where you could change the text of the button or set a property boolean isHost.

Jessypet commented 10 years ago

..that was too easy

Jessypet commented 10 years ago

99bf091938b2713bce128cbe6f8dcddde547f03e There are only specific things to be done.. when a player klicks "Ready", it's hard-coded that team 2 will be shown to be ready, not actually the team of the client that clicked it. Also: the empty spectator-method + disconnection of the removed player

mabre commented 10 years ago

Have a look at f5b547308cac75a91be7cade9d5c37acd4061606: I made the “Ready” button send a CLIENT_READY message to the server. The message is handled in the method private void setTeamReady(int team) in NetLobby, which has a dummy implementation atm. When toJson/fromJson supports saving/loading the ready status of each team, the mechanism should work as expected.

Jessypet commented 10 years ago

When you uncheck the spectator-checkbox there is a new team added in the Host-Lobby, so should we start the lobby with only one team showing? Because then nobody seems to be team 2. But also the third team doesn't appear in the client-Lobby.

mabre commented 10 years ago

Yes, the Lobby should start with one team. The client does not see the updated lobby because the number-of-teams information is not part of the json object (because there hasn’t been such an information when I created the dummy implementation).

Jessypet commented 10 years ago

Lobby starts with one team now. But when a new player connects it is shown as Team 3, not Team 2. And I think in my branch numberOfTeams is in the json object.

mabre commented 10 years ago

That’s because the number of additional teams created so far is hard-coded to 1 in handleSpectatorBoxChanged. When I add the server-side code to assign a team number to a new client, I’ll remove the hard-coded 1 and then it should work.

mabre commented 10 years ago

So here’s how you can play with 3 players atm:

  1. start host, set team size to 2
  2. start first client, join, uncheck spectator
  3. set team size to 3
  4. start second client, join, uncheck spectator
  5. set both clients to ready
  6. start game on host

open problems:

mabre commented 10 years ago

@Jessypet Are you working on the issues mentioned above?

Jessypet commented 10 years ago

Didn't have any time yesterday and right now I'm trying to fix something about fxml that is not working, but I will do this stuff afterwards.

Jessypet commented 10 years ago

Quick question: When clicking 'Apply settings' should there actually be teams added? It doesn't make sense anymore, right? We could just save it then and always check if the maximum is reached when a new player joins. Then there wouldn't be more teams shown than there are clients.

mabre commented 10 years ago

Yes, the button should not add the teams, only send the current status to the clients. So fromJson must only add as many teams as there are in json.getJSONArray("teams") (make sure to remove all teams first, otherwise too many teams are shown when one has been removed).

Jessypet commented 10 years ago

Removing and adding are done. Didn't test if fromJson() works the way it is supposed to but I think it should. The only thing left to do is not adding teams when pressing 'Apply settings', but I'm actually not sure where it does that. (And I won't be able to do something for the next one and a half hours.)

Jessypet commented 10 years ago

Okay, I can't find where I have to change that part, where does it call addTeam() when you press the button? I tried 'Find Usages' but I don't think it showed me the right thing.

Jessypet commented 10 years ago

Okay, I see, it's already fixed

mabre commented 10 years ago

It was not called directly, but when clicking the button, the lobby state is sent to all clients, which then call addTeam().

Jessypet commented 10 years ago

Okay. Right now I only see one problem left, the new clients aren't showing ab in the host-lobby, in the player's lobby a new team is added, but not in the lobby of the host

mabre commented 10 years ago

Is it fixed with 6f84b2a153e2b45a8b989ad73d6bf1861e051622?

Jessypet commented 10 years ago

Yep, works now

mabre commented 10 years ago

So let’s close this.