mirror of
https://github.com/shlomif/PySolFC.git
synced 2025-04-05 00:02:29 -04:00
+ 1 new game
+ new option: `Enable shuffle' git-svn-id: https://pysolfc.svn.sourceforge.net/svnroot/pysolfc/PySolFC/trunk@200 39dd0a4e-7c14-0410-91b3-c4f2d318f732
This commit is contained in:
parent
7096a96d59
commit
3319f877a1
6 changed files with 91 additions and 7 deletions
|
@ -198,7 +198,8 @@ class PysolMenubarActions:
|
|||
if game.gameinfo.si.game_type == GI.GT_CUSTOM:
|
||||
ms.custom_game = 1
|
||||
if game.canShuffle():
|
||||
ms.shuffle = 1
|
||||
if opt.shuffle:
|
||||
ms.shuffle = 1
|
||||
|
||||
# update menu items and toolbar
|
||||
def _updateMenus(self):
|
||||
|
@ -492,8 +493,9 @@ class PysolMenubarActions:
|
|||
|
||||
def mShuffle(self, *args):
|
||||
if self._cancelDrag(): return
|
||||
if self.game.canShuffle():
|
||||
self.game._mahjonggShuffle()
|
||||
if self.menustate.shuffle:
|
||||
if self.game.canShuffle():
|
||||
self.game._mahjonggShuffle()
|
||||
|
||||
def mStatus(self, *args):
|
||||
if self._cancelDrag(break_pause=False): return
|
||||
|
|
|
@ -133,11 +133,11 @@ class Strata(Game):
|
|||
for i in range(8):
|
||||
s.foundations.append(DieRussische_Foundation(x, y, self,
|
||||
suit=i%4, max_cards=8))
|
||||
x = x + l.XS
|
||||
x += l.XS
|
||||
x, y, = l.XM+l.XS, l.YM+l.YS
|
||||
for i in range(8):
|
||||
s.rows.append(AC_RowStack(x, y, self, max_move=1, max_accept=1))
|
||||
x = x + l.XS
|
||||
x += l.XS
|
||||
s.talon = RedealTalonStack(l.XM, l.YM+l.YS/2, self, max_rounds=3)
|
||||
l.createRoundText(s.talon, 'nn')
|
||||
|
||||
|
@ -177,6 +177,67 @@ class Fifteen(Capricieuse):
|
|||
return cards
|
||||
|
||||
|
||||
# /***********************************************************************
|
||||
# // Choice
|
||||
# ************************************************************************/
|
||||
|
||||
class Choice_Foundation(RK_FoundationStack):
|
||||
def acceptsCards(self, from_stack, cards):
|
||||
if not RK_FoundationStack.acceptsCards(self, from_stack, cards):
|
||||
return False
|
||||
# check the suit
|
||||
num_cards = len(self.cards)
|
||||
for f in self.game.s.foundations:
|
||||
if len(f.cards) > num_cards:
|
||||
suit = f.cards[num_cards].suit
|
||||
break
|
||||
else:
|
||||
return True
|
||||
return cards[0].suit == suit
|
||||
|
||||
|
||||
class Choice(Game):
|
||||
|
||||
def createGame(self, rows=8, playcards=16):
|
||||
# create layout
|
||||
l, s = Layout(self), self.s
|
||||
|
||||
# set window
|
||||
decks = self.gameinfo.decks
|
||||
max_rows = max(8, rows)
|
||||
self.setSize(l.XM + max_rows*l.XS,
|
||||
l.YM + 2*l.YS + (playcards+4*decks)*l.YOFFSET)
|
||||
|
||||
# create stacks
|
||||
x, y = l.XM + (max_rows-8)*l.XS/2, l.YM
|
||||
for i in range(8):
|
||||
stack = Choice_Foundation(x, y, self, base_rank=(i+5), dir=0,
|
||||
suit=ANY_SUIT, max_cards=(4*decks) )
|
||||
stack.CARD_YOFFSET = l.YOFFSET
|
||||
s.foundations.append(stack)
|
||||
x += l.XS
|
||||
|
||||
x, y = l.XM + (max_rows-rows)*l.XS/2, l.YM + l.YS + (4*decks)*l.YOFFSET
|
||||
for i in range(rows):
|
||||
s.rows.append(AC_RowStack(x, y, self))
|
||||
x += l.XS
|
||||
|
||||
x, y = self.width - l.XS, self.height - l.YS
|
||||
s.talon = InitialDealTalonStack(x, y, self)
|
||||
|
||||
# define stack-groups
|
||||
l.defaultStackGroups()
|
||||
|
||||
|
||||
def startGame(self):
|
||||
for i in range(11):
|
||||
self.s.talon.dealRowAvail(frames=0)
|
||||
self.startDealSample()
|
||||
self.s.talon.dealRowAvail()
|
||||
|
||||
shallHighlightMatch = Game._shallHighlightMatch_AC
|
||||
|
||||
|
||||
|
||||
# register the game
|
||||
registerGame(GameInfo(292, Capricieuse, "Capricieuse",
|
||||
|
@ -190,4 +251,7 @@ registerGame(GameInfo(606, Strata, "Strata",
|
|||
altnames=('Persian Patience',) ))
|
||||
registerGame(GameInfo(673, Fifteen, "Fifteen",
|
||||
GI.GT_BAKERS_DOZEN | GI.GT_OPEN, 2, 0, GI.SL_MOSTLY_SKILL))
|
||||
registerGame(GameInfo(755, Choice, "Choice",
|
||||
GI.GT_3DECK_TYPE | GI.GT_OPEN | GI.GT_ORIGINAL, 3, 0, GI.SL_MOSTLY_SKILL,
|
||||
ranks=(5, 6, 7, 8, 9, 10, 11, 12) ))
|
||||
|
||||
|
|
|
@ -47,6 +47,7 @@ autofaceup = boolean
|
|||
autodrop = boolean
|
||||
autodeal = boolean
|
||||
quickplay = boolean
|
||||
shuffle = boolean
|
||||
undo = boolean
|
||||
bookmarks = boolean
|
||||
hint = boolean
|
||||
|
@ -174,6 +175,7 @@ class Options:
|
|||
('autodrop', 'bool'),
|
||||
('autodeal', 'bool'),
|
||||
('quickplay', 'bool'),
|
||||
('shuffle', 'bool'),
|
||||
('undo', 'bool'),
|
||||
('bookmarks', 'bool'),
|
||||
('hint', 'bool'),
|
||||
|
@ -243,6 +245,7 @@ class Options:
|
|||
self.autodrop = False
|
||||
self.autodeal = True
|
||||
self.quickplay = True
|
||||
self.shuffle = True
|
||||
self.undo = True
|
||||
self.bookmarks = True
|
||||
self.hint = True
|
||||
|
|
|
@ -217,6 +217,7 @@ class PysolMenubar(PysolMenubarActions):
|
|||
undo = Tkinter.BooleanVar(),
|
||||
bookmarks = Tkinter.BooleanVar(),
|
||||
hint = Tkinter.BooleanVar(),
|
||||
shuffle = Tkinter.BooleanVar(),
|
||||
highlight_piles = Tkinter.BooleanVar(),
|
||||
highlight_cards = Tkinter.BooleanVar(),
|
||||
highlight_samerank = Tkinter.BooleanVar(),
|
||||
|
@ -263,6 +264,7 @@ class PysolMenubar(PysolMenubarActions):
|
|||
tkopt.quickplay.set(opt.quickplay)
|
||||
tkopt.undo.set(opt.undo)
|
||||
tkopt.hint.set(opt.hint)
|
||||
tkopt.shuffle.set(opt.shuffle)
|
||||
tkopt.bookmarks.set(opt.bookmarks)
|
||||
tkopt.highlight_piles.set(opt.highlight_piles)
|
||||
tkopt.highlight_cards.set(opt.highlight_cards)
|
||||
|
@ -446,6 +448,7 @@ class PysolMenubar(PysolMenubarActions):
|
|||
submenu.add_checkbutton(label=n_("Enable &undo"), variable=self.tkopt.undo, command=self.mOptEnableUndo)
|
||||
submenu.add_checkbutton(label=n_("Enable &bookmarks"), variable=self.tkopt.bookmarks, command=self.mOptEnableBookmarks)
|
||||
submenu.add_checkbutton(label=n_("Enable &hint"), variable=self.tkopt.hint, command=self.mOptEnableHint)
|
||||
submenu.add_checkbutton(label=n_("Enable shu&ffle"), variable=self.tkopt.shuffle, command=self.mOptEnableShuffle)
|
||||
submenu.add_checkbutton(label=n_("Enable highlight p&iles"), variable=self.tkopt.highlight_piles, command=self.mOptEnableHighlightPiles)
|
||||
submenu.add_checkbutton(label=n_("Enable highlight &cards"), variable=self.tkopt.highlight_cards, command=self.mOptEnableHighlightCards)
|
||||
submenu.add_checkbutton(label=n_("Enable highlight same &rank"), variable=self.tkopt.highlight_samerank, command=self.mOptEnableHighlightSameRank)
|
||||
|
@ -1076,6 +1079,11 @@ class PysolMenubar(PysolMenubarActions):
|
|||
self.app.opt.hint = self.tkopt.hint.get()
|
||||
self.game.updateMenus()
|
||||
|
||||
def mOptEnableShuffle(self, *args):
|
||||
if self._cancelDrag(break_pause=False): return
|
||||
self.app.opt.shuffle = self.tkopt.shuffle.get()
|
||||
self.game.updateMenus()
|
||||
|
||||
def mOptEnableHighlightPiles(self, *args):
|
||||
if self._cancelDrag(break_pause=False): return
|
||||
self.app.opt.highlight_piles = self.tkopt.highlight_piles.get()
|
||||
|
|
|
@ -216,6 +216,7 @@ class PysolMenubar(PysolMenubarActions):
|
|||
undo = Tkinter.BooleanVar(),
|
||||
bookmarks = Tkinter.BooleanVar(),
|
||||
hint = Tkinter.BooleanVar(),
|
||||
shuffle = Tkinter.BooleanVar(),
|
||||
highlight_piles = Tkinter.BooleanVar(),
|
||||
highlight_cards = Tkinter.BooleanVar(),
|
||||
highlight_samerank = Tkinter.BooleanVar(),
|
||||
|
@ -261,6 +262,7 @@ class PysolMenubar(PysolMenubarActions):
|
|||
tkopt.quickplay.set(opt.quickplay)
|
||||
tkopt.undo.set(opt.undo)
|
||||
tkopt.hint.set(opt.hint)
|
||||
tkopt.shuffle.set(opt.shuffle)
|
||||
tkopt.bookmarks.set(opt.bookmarks)
|
||||
tkopt.highlight_piles.set(opt.highlight_piles)
|
||||
tkopt.highlight_cards.set(opt.highlight_cards)
|
||||
|
@ -451,6 +453,7 @@ class PysolMenubar(PysolMenubarActions):
|
|||
submenu.add_checkbutton(label=n_("Enable &undo"), variable=self.tkopt.undo, command=self.mOptEnableUndo)
|
||||
submenu.add_checkbutton(label=n_("Enable &bookmarks"), variable=self.tkopt.bookmarks, command=self.mOptEnableBookmarks)
|
||||
submenu.add_checkbutton(label=n_("Enable &hint"), variable=self.tkopt.hint, command=self.mOptEnableHint)
|
||||
submenu.add_checkbutton(label=n_("Enable shu&ffle"), variable=self.tkopt.shuffle, command=self.mOptEnableShuffle)
|
||||
submenu.add_checkbutton(label=n_("Enable highlight p&iles"), variable=self.tkopt.highlight_piles, command=self.mOptEnableHighlightPiles)
|
||||
submenu.add_checkbutton(label=n_("Enable highlight &cards"), variable=self.tkopt.highlight_cards, command=self.mOptEnableHighlightCards)
|
||||
submenu.add_checkbutton(label=n_("Enable highlight same &rank"), variable=self.tkopt.highlight_samerank, command=self.mOptEnableHighlightSameRank)
|
||||
|
@ -1077,6 +1080,11 @@ class PysolMenubar(PysolMenubarActions):
|
|||
self.app.opt.hint = self.tkopt.hint.get()
|
||||
self.game.updateMenus()
|
||||
|
||||
def mOptEnableShuffle(self, *args):
|
||||
if self._cancelDrag(break_pause=False): return
|
||||
self.app.opt.shuffle = self.tkopt.shuffle.get()
|
||||
self.game.updateMenus()
|
||||
|
||||
def mOptEnableHighlightPiles(self, *args):
|
||||
if self._cancelDrag(break_pause=False): return
|
||||
self.app.opt.highlight_piles = self.tkopt.highlight_piles.get()
|
||||
|
|
|
@ -674,8 +674,7 @@ class StackDesc:
|
|||
text = stack.getHelp()+'\n'+stack.getBaseCard()
|
||||
text = text.strip()
|
||||
if text:
|
||||
frame = Tkinter.Frame(self.canvas, highlightthickness=1,
|
||||
highlightbackground='black')
|
||||
frame = Tkinter.Frame(self.canvas)
|
||||
self.frame = frame
|
||||
label = Tkinter.Message(frame, font=font, text=text,
|
||||
width=cardw-8, relief='solid',
|
||||
|
|
Loading…
Add table
Reference in a new issue