added control view

This commit is contained in:
2020-04-05 23:27:33 +02:00
parent 914e9a1f3d
commit 129e676335
7 changed files with 94 additions and 24 deletions

17
views/control.py Normal file
View File

@ -0,0 +1,17 @@
from app_instance import api
from wiz_game import the_game
@api.route("/control/")
def index(req, resp):
print(req.params)
resp.content = api.template('home/control.html', deck=the_game.card_deck,
trump_card=the_game.trump_card, trump_color=the_game.get_trump_color())
@api.route("/control/deal/{cards}")
def deal(req, resp, cards):
the_game.deal_cards(int(cards))
resp.content = api.template('home/control.html', deck=the_game.card_deck,
trump_card=the_game.trump_card, trump_color=the_game.get_trump_color())

View File

@ -6,6 +6,6 @@ from wiz_game import the_game
@api.route("/player/{player}")
def index(req, resp, player: str):
p = int(player)
print(p)
print(the_game.players)
resp.content = api.template('home/player.html', player=player, cards=the_game.players[p].cards)
tcard = the_game.trump_card
tcolor = the_game.get_trump_color()
resp.content = api.template('home/player.html', player=player, cards=the_game.players[p].cards, trump_card=tcard, trump_color=tcolor)