]> git.cworth.org Git - empires-html/commit
Implement support for the "game-state" and "character-reveal" events
authorCarl Worth <cworth@cworth.org>
Sun, 10 May 2020 22:51:59 +0000 (15:51 -0700)
committerCarl Worth <cworth@cworth.org>
Sun, 10 May 2020 22:51:59 +0000 (15:51 -0700)
commitb783f37012c917117b4ece1a523f1681e16f3c56
tree2cb2584d0f2b188fdcfca10beb59ae7553e61988
parent50249f0614d350197f7629f0f0a2d2071ad98204
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.
empires-client.js
index.html
style.css