Commit Graph

59 Commits

Author SHA1 Message Date
Andy Janata 2d5e9d18c0 - discard cards after they are used, so that they can be reshuffled if more cards are required (hasn't been tested)
- much better handling when users leave the game:
  - put their hand in the discard pile
  - if they played this round, put that card in the discard pile and remove them from the played players list
  - if they were supposed to play this round, remove them from the players list
  - if they were judge, return all played cards to players and move to the next judge
  - if they weren't judge and were lower in judging order, fix the judge pointer
- add a goal to the game (8 points for now, hard-coded)
- keep track of which players are supposed to play this round so players joining and leaving don't affect the game progressing
2012-01-30 16:35:06 -08:00
Andy Janata 3fd597b580 kill the next round timer when a game resets due to losing players 2012-01-30 00:36:52 -08:00
Andy Janata 259b323e1c "Judge" -> "Card Czar" 2012-01-30 00:35:11 -08:00
Andy Janata bc2e7501cc reset the judge index when the game resets 2012-01-29 17:14:28 -08:00
Andy Janata e3ac81705e false-start of doing admin via ajax, would require a lot more work on the admin client to actually do it this way 2012-01-29 17:14:17 -08:00
Andy Janata a26221c2bb - admin can toggle verbose logging of all requests on and off
- admin page shows user hostname
- servlets log request and response if logging is enabled
2012-01-29 17:13:31 -08:00
Andy Janata 8ad224edad basic admin page, shows memory usage, uptime, and connected users 2012-01-28 00:49:32 -08:00
Andy Janata 65c92d8440 reduce round intermission time to 8 seconds 2012-01-27 17:19:36 -08:00
Andy Janata 0e11e59207 - judge can select card
- game goes to next round
2012-01-27 15:41:57 -08:00
Andy Janata 7a8da9bf72 wasn't actually sending the event type when moving a game back to the lobby, clients didn't know what to do 2012-01-27 00:15:07 -08:00
Andy Janata 6226558535 set response encoding to utf-8 2012-01-26 22:17:45 -08:00
Andy Janata 48976b4dc0 - change how the client's own card is displayed after playing it to avoid race condition
- show all white cards when switching to judging mode
2012-01-26 22:17:36 -08:00
Andy Janata 2e26e938e5 - reload the round white cards when page reloaded
- can't select a hand card after playing a card
2012-01-26 19:25:40 -08:00
Andy Janata 7600ec27de - refactor game handlers a bit to add another abstract class that ensures the user requesting is in the game in question
- add play card handler. need to send the white card count down to users that refresh the page.
- ajax event handlers get the request object as well as the result object so the server doesn't have to send the game id back in a response
2012-01-26 18:07:39 -08:00
Andy Janata 234b82afd2 - display black card in game
- display message indicating what the game is currently waiting for
- reload the black card when reloading page
- change the js constant generator to explain what the dummy things are for in the output
- add support for enums that need two user-visible values (specifically the game player state: the short message for the scoreboard and the long message telling the player what they need to do)
- hide the start game button after the game is started
- refactor game event longpoll handlers to use a helper that gets the game and reports an error if it can't
- game (should) reset to a lobby if it loses players to put it less than 3
2012-01-24 16:20:43 -08:00
Andy Janata 347dfb0b02 toString in QueuedMessage 2012-01-23 23:03:08 -08:00
Andy Janata 5915a3558d - reload hand after reloading page
- use transform animation in all browsers to reduce complexity :(
2012-01-23 23:02:59 -08:00
Andy Janata c73ce88646 deal cards to players when the game starts 2012-01-23 15:06:20 -08:00
Andy Janata eec3ad81ca - make currentGames be a list instead of a single object, just in case I do multiple games later
- add event handlers for leave and start game buttons
- leave game button works
2012-01-23 13:20:15 -08:00
Andy Janata 2ce38e4222 refactor to get a base abstract GameHandler since a bunch of handlers will need to get the game object 2012-01-23 12:52:33 -08:00
Andy Janata e21fd8ed00 debug ajax responses to stdout, if new code uncommented 2012-01-22 23:58:59 -08:00
Andy Janata 8e3c1372dc - fix formatting in css file
- add some templates for game lobbies
- client properly joins a game and shows the lobby!
- reconnect to in-progress game when refreshing page
2012-01-22 23:58:36 -08:00
Andy Janata 109a58444a don't sanitize chat, instead use a text element to display chat and log messages 2012-01-22 23:54:58 -08:00
Andy Janata 8b6d171d66 fix warnings 2012-01-20 19:11:39 -08:00
Andy Janata 577586139e - escape html in chat on client and server
- rework how the gamelist was shown
2012-01-20 14:55:08 -08:00
Andy Janata 4fe85b5233 add some comments to Constants 2012-01-19 00:37:45 -08:00
Andy Janata 5bda9fd452 client can join games. doesn't load the game yet, which is the same thing that happens with creating a game. the same thing should happen for both cases.
reworked some tests to be able to hide a method from GameManager. part of this goal was to reduce unnecessary game refresh broadcasts if a client tried to create multiple games.
2012-01-18 16:42:18 -08:00
Andy Janata 8187147e74 catch assertion errors in CahServlet 2012-01-18 16:39:11 -08:00
Andy Janata 979a9c4123 - create games
- list games
  - automatically refreshes list when game is created or destroyed
  - destroy games after removing all players (including at logout)
2012-01-17 21:58:09 -08:00
Andy Janata 40de91b5ac some work on the game list 2012-01-17 20:37:09 -08:00
Andy Janata e832d4fd02 dump a stack on an invalid operation, in case it was guice's fault 2012-01-17 17:48:44 -08:00
Andy Janata 79f2f59716 - add game list ajax call
- skeleton for game lobby list
- fix ajax handlers to use the constants instead of literals for the ops
2012-01-17 17:48:21 -08:00
Andy Janata 565c17b338 - add GameManager and test
- fix up Guice
2012-01-16 23:59:56 -08:00
Andy Janata e64978a0da remove literals from AjaxServlet 2012-01-16 23:58:48 -08:00
Andy Janata 76d9be8f1c more constants instead of immediate strings.
add a wrapper around the request parameters so we can use our enum values as the parameter names.
2012-01-16 16:28:21 -08:00
Andy Janata 61451105b0 do not return error messages, only return the error code and let the client look up the error message. this could eventually allow for localization of the error messages (but not the rest of the client yet) 2012-01-16 14:33:58 -08:00
Andy Janata 9a281cd38f use constants for long poll events, ajax request operation names, ajax response field names, and error codes 2012-01-12 21:36:31 -08:00
Andy Janata f33070ab7e move the js constant updater build tool down after java compile since it needs the new constant file compiled first
make the js constant updater only run on enums
2012-01-12 21:33:54 -08:00
Andy Janata 61fc4ece55 fix a compiler warning 2012-01-12 20:05:48 -08:00
Andy Janata 8da78ebac7 move MessageType back inside QueuedMessage since the client doesn't need it
make converter to produce js enums out of java enums
make everything use the constants on both sides for ajax operation code and disconnect reason
move the handler update out of the subpackage that it generates into
make the enum update and handler update run at build
2012-01-12 20:05:39 -08:00
Andy Janata 45e5705e56 move Type and DisconnectReason enums to a single file, preparing to do the same for all the scattered strings for operations 2012-01-12 13:35:53 -08:00
Andy Janata 0183bb0732 game data object with methods to add and remove players from the game 2012-01-12 13:09:01 -08:00
Andy Janata 3906b5582c cleanup 2012-01-12 13:07:34 -08:00
Andy Janata c4210a3faa properly invalidate sessions when ping timeout occurs so when the user comes back they'll get a new session 2012-01-12 13:07:05 -08:00
Andy Janata 3c391f23cd add names list when connecting 2012-01-12 13:05:49 -08:00
Andy Janata eba02a35bd add support for being able to return more than one event in a single long poll request, since the client will poll no more often than every half-second. this could have caused a rather large backlog of events to deliver if chat was active. 2012-01-06 16:43:40 -08:00
Andy Janata 8a45078d77 remove dead clients
refactor the injector out to the servlet context
2012-01-06 15:53:55 -08:00
Andy Janata 9508575949 log out button 2012-01-06 15:53:04 -08:00
Andy Janata ce273d533c fix some compiler warnings after tweaking what it warns on 2011-12-24 19:51:49 -08:00
Andy Janata 401b3fed2e remove an unused instance variable in AjaxServlet 2011-12-24 19:38:33 -08:00