Permalink
Browse files

Trashcan: When swapping tiles, the X's go away on success.

  • Loading branch information...
1 parent 89a8e9d commit 8f010fd73c9944bdc25340c844fc2b9263e2aced @chellmuth committed Nov 5, 2008
Showing with 12 additions and 2 deletions.
  1. +9 −0 templates/board_test.html
  2. +3 −2 views.py
@@ -274,6 +274,15 @@
$("#ruler-temple #ruler-settlement #ruler-merchant #ruler-farm").show();
state = data;
+ if (data['empty_trash']) {
+ $.each(
+ [0, 1, 2, 3, 4, 5],
+ function(no, item) {
+ $("#hand" + no).children().removeClass('trash');
+ }
+ );
+ }
+
$.each(data['player_hand'], function(i, item) { set_civilization_tiles(i, item); });
$.each(data['temple_civ'], function(i, cell_no) { place_civ_on_board('civ-temple', cell_no); });
$.each(data['settlement_civ'], function(i, cell_no) { place_civ_on_board('civ-settlement', cell_no); });
View
@@ -83,7 +83,7 @@ def drop_tiles(request, game_id, player_no, tile0, tile1, tile2, tile3, tile4, t
update_browsers(game_id)
- return game_state_json(request, game_id, player_no)
+ return game_state_json(request, game_id, player_no, { 'empty_trash': 1 })
def choose_treasure(request, game_id, player_no, cell_nos):
cell_nos = [ int(x) for x in cell_nos.split("_") ]
@@ -545,7 +545,7 @@ def _get_reposition_info(board, player_no, ruler_type):
return safe, war
-def game_state_json(request, game_id, player_no):
+def game_state_json(request, game_id, player_no, options={}):
g = Game.objects.get(id=int(game_id))
board = StandardBoard(g,1)
build_board_data(board)
@@ -674,6 +674,7 @@ def game_state_json(request, game_id, player_no):
for player_no in xrange(1, g.num_players + 1) ]),
"state": state
}
+ json_obj.update(options)
resp = HttpResponse(simplejson.dumps(json_obj, indent=2))
resp.headers['Content-Type'] = 'text/javascript'

0 comments on commit 8f010fd

Please sign in to comment.