added control view
This commit is contained in:
17
views/control.py
Normal file
17
views/control.py
Normal 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())
|
@ -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)
|
||||
|
Reference in New Issue
Block a user