]> git.cworth.org Git - lmno.games/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)
commit05dc239c21e567bdd50d6fee2e8bffff72981b5f
tree48e221f825f35b865e12004f40147e73a9bcb320
parenta0d7917c34bd5fdb87969ff459ed3036210fc0c9
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/empires-client.js
empires/index.html
empires/style.css