Carl Worth [Sun, 10 May 2020 22:51:59 +0000 (15:51 -0700)]
Implement support for the "game-state" and "character-reveal" events
We had classes here named show-state-<STATE> and hide-state-<STATE>
for elements that should be shown only in a specific state
(show-state-<STATE>) or that should be hidden in a specific state
(hide-state-<STATE>).
For example, the new loading screen saying "contacting server" is only
shown in the "none" state (show-state-none), before getting any events
back from the server. Similarly the list of players is hidden during
the reveal state (hide-state-reveal) so that it is visible in all
other states.
In response to the game-state event, the code finds all relevant
elements with appropriate classed from both the old and new states of
the transition and hides or shows them as appropriate.
Also, we now support the "character-reveal" event by inserting the
revealed character name into an element where it can be seen.
Carl Worth [Sun, 10 May 2020 22:50:11 +0000 (15:50 -0700)]
Move the message area outside of the pre-game div
The message area information is intended to be available regardleess
of the game state, (while the pre-game content is only intended to be
displayed while players are joining the game).
Carl Worth [Sun, 10 May 2020 17:06:07 +0000 (10:06 -0700)]
Add messages to message area when a player joins or leaves the game
This replaces code we had previously for adding a message to the
message area when we completed sending a register request. The new
code is more reliable in the sense that a message is added _only_
after the server reports the event for a new player. (Previously, if
the server was offline, a message would still appear saying "Player is
now in the game!" which would be false and confusing if there was no
server responding to the register request at all.)
Carl Worth [Sun, 10 May 2020 15:43:59 +0000 (08:43 -0700)]
Disable autocomplete on the character field
This is intended to prevent multiple players (using a single browser)
from accidentally seeing a name that a previous player entered when
the browser offers it up for autocompletion.
Carl Worth [Mon, 4 May 2020 00:18:21 +0000 (17:18 -0700)]
Add event listening to the HTML client
Specifically, displaying a list of all players. This captures both the
existing players at the time the client connects, as well as adding
any additional players that register.
Carl Worth [Sun, 3 May 2020 17:54:57 +0000 (10:54 -0700)]
Use an actual "submit" input element instead of a "button"
This has the advantage of allowing the user to just press the Enter
key on any field of the form in order to submit it. For this we move
the invocation of our javascript handler for the form submission from
onclick() of the button to onsubmit() of the form itself. Finally, we
have to reutnr false from our new onsubmit() handler so that the
browser doesn't reload the page (which would clear the message that
results from a new player being added).