Closed mabre closed 10 years ago
"on clients only" -> How do I do the distinction between server and client?
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
.
..that was too easy
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
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.
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.
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).
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.
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.
So here’s how you can play with 3 players atm:
open problems:
int teamsCreated
.)removeTeam()
does not hide the gui elements for that team and reset ready state.addTeam()
should simply add one more team (if possible). fromJson()
than has to remove all teams first and re-create them from the JSONObject
.@Jessypet Are you working on the issues mentioned above?
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.
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.
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).
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.)
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.
Okay, I see, it's already fixed
It was not called directly, but when clicking the button, the lobby state is sent to all clients, which then call addTeam()
.
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
Is it fixed with 6f84b2a153e2b45a8b989ad73d6bf1861e051622?
Yep, works now
So let’s close this.
ready
property has to be added to each team intoJson
)colorPicker
s etc. in a list, remove thatteam3Shown
etc.)close #67?