primitivus: fixed state state change in tarot game
This commit is contained in:
parent
56ad7cdd11
commit
88ae55bdbd
1 changed files with 13 additions and 8 deletions
|
|
@ -292,15 +292,10 @@ class CardGame(QuickCardGame,urwid.WidgetWrap):
|
|||
"""A card has been played by player"""
|
||||
QuickCardGame.cardsPlayed(self, player, cards)
|
||||
self.table.putCard(self.getPlayerLocation(player),self.played[player])
|
||||
self._checkState()
|
||||
self.parent.host.redraw()
|
||||
|
||||
##EVENTS##
|
||||
def onClick(self, hand, card_wid):
|
||||
"""Called when user do an action on the hand"""
|
||||
if not self.state in ['play','ecart','wait_for_ecart']:
|
||||
#it's not our turn, we ignore the click
|
||||
card_wid.select(False)
|
||||
return
|
||||
|
||||
def _checkState(self):
|
||||
if isinstance(self.center.widget_list[1].original_widget, Hand): #if we have a hand displayed
|
||||
self.center.widget_list[1] = urwid.Filler(self.table) #we show again the table
|
||||
if self.state == "chien":
|
||||
|
|
@ -312,6 +307,16 @@ class CardGame(QuickCardGame,urwid.WidgetWrap):
|
|||
self.hand.sort()
|
||||
self.to_show = []
|
||||
self.hand_wid.update(self.hand)
|
||||
|
||||
|
||||
##EVENTS##
|
||||
def onClick(self, hand, card_wid):
|
||||
"""Called when user do an action on the hand"""
|
||||
if not self.state in ['play','ecart','wait_for_ecart']:
|
||||
#it's not our turn, we ignore the click
|
||||
card_wid.select(False)
|
||||
return
|
||||
self._checkState()
|
||||
if self.state == "ecart":
|
||||
if len(self.hand_wid.getSelected()) == 6:
|
||||
pop_up_widget = sat_widgets.ConfirmDialog(_("Do you put these cards in chien ?"), yes_cb=self.onEcartDone, no_cb=self.parent.host.removePopUp)
|
||||
|
|
|
|||
Loading…
Reference in a new issue