mirror of
https://github.com/shlomif/PySolFC.git
synced 2025-04-05 00:02:29 -04:00
+ 2 new games (1000 total)
* bugs fixes git-svn-id: file:///home/shlomif/Backup/svn-dumps/PySolFC/svnsync-repos/pysolfc/PySolFC/trunk@133 efabe8c0-fbe8-4139-b769-b5e6d273206e
This commit is contained in:
parent
9d63b66ba7
commit
d4edb60a90
6 changed files with 170 additions and 22 deletions
|
@ -6,7 +6,7 @@ msgid ""
|
|||
msgstr ""
|
||||
"Project-Id-Version: PySol 0.0.1\n"
|
||||
"POT-Creation-Date: Fri Jan 12 13:34:09 2007\n"
|
||||
"PO-Revision-Date: 2007-01-13 20:30+0300\n"
|
||||
"PO-Revision-Date: 2007-01-17 19:12+0300\n"
|
||||
"Last-Translator: Скоморох <skomoroh@gmail.com>\n"
|
||||
"Language-Team: Russian <ru@li.org>\n"
|
||||
"MIME-Version: 1.0\n"
|
||||
|
@ -655,7 +655,7 @@ msgid "Crossroads"
|
|||
msgstr "Перекрестки"
|
||||
|
||||
msgid "Crown"
|
||||
msgstr "Корона"
|
||||
msgstr "Венец"
|
||||
|
||||
msgid "Cruel"
|
||||
msgstr "Изнурительный"
|
||||
|
@ -1042,7 +1042,7 @@ msgid "Fascination Fan"
|
|||
msgstr "Очаровательный веер"
|
||||
|
||||
msgid "Fastness"
|
||||
msgstr "Крепость"
|
||||
msgstr "Оплот"
|
||||
|
||||
msgid "Fatimeh's Game"
|
||||
msgstr "Пасьянс Фатимы"
|
||||
|
@ -1070,7 +1070,7 @@ msgid "Final Battle"
|
|||
msgstr "Последняя битва"
|
||||
|
||||
msgid "Firecracker"
|
||||
msgstr "Хлопушка"
|
||||
msgstr "Петарда"
|
||||
|
||||
msgid "Firing Squad"
|
||||
msgstr "Салютная команда"
|
||||
|
|
|
@ -382,6 +382,7 @@ class Game:
|
|||
images = [],
|
||||
tk_images = [], # saved tk images
|
||||
saved_images = {}, # saved resampled images
|
||||
canvas_images = [], # ids of canvas images
|
||||
frame_num = 0, # number of the current frame
|
||||
width = 0,
|
||||
height = 0,
|
||||
|
@ -1099,6 +1100,8 @@ class Game:
|
|||
images = self.win_animation.images
|
||||
saved_images = self.win_animation.saved_images # cached images
|
||||
canvas = self.canvas
|
||||
canvas.delete(*self.win_animation.canvas_images)
|
||||
self.win_animation.canvas_images = []
|
||||
|
||||
x0 = int(int(canvas.cget('width'))*(canvas.xview()[0]))
|
||||
y0 = int(int(canvas.cget('height'))*(canvas.yview()[0]))
|
||||
|
@ -1132,17 +1135,19 @@ class Game:
|
|||
round_k = int(round(k*100))
|
||||
if img_index not in saved_images:
|
||||
saved_images[img_index] = {}
|
||||
if round_k == 100:
|
||||
tmp = im
|
||||
elif round_k in saved_images[img_index]:
|
||||
tmp = saved_images[img_index][round_k]
|
||||
if round_k in saved_images[img_index]:
|
||||
tk_tmp = saved_images[img_index][round_k]
|
||||
else:
|
||||
new_size = (int(iw*k), int(ih*k))
|
||||
tmp = im.resize(new_size, resample=Image.BICUBIC)
|
||||
saved_images[img_index][round_k] = tmp
|
||||
if round_k == 100:
|
||||
tmp = im
|
||||
else:
|
||||
tmp = im.resize(new_size, resample=Image.BICUBIC)
|
||||
tk_tmp = ImageTk.PhotoImage(image=tmp)
|
||||
saved_images[img_index][round_k] = tk_tmp
|
||||
|
||||
tk_tmp = ImageTk.PhotoImage(image=tmp)
|
||||
id = canvas.create_image(xpos, ypos, image=tk_tmp, anchor='nw')
|
||||
self.win_animation.canvas_images.append(id)
|
||||
if k > 0.6:
|
||||
raised_images.append(id)
|
||||
tmp_tk_images.append(tk_tmp)
|
||||
|
@ -1161,6 +1166,8 @@ class Game:
|
|||
if self.win_animation.timer:
|
||||
after_cancel(self.win_animation.timer) # stop loop
|
||||
self.win_animation.timer = None
|
||||
self.canvas.delete(*self.win_animation.canvas_images)
|
||||
self.win_animation.canvas_images = []
|
||||
self.win_animation.tk_images = [] # delete all images
|
||||
self.saved_images = {}
|
||||
self.canvas.showAllItems()
|
||||
|
|
|
@ -423,7 +423,6 @@ class Casket(Game):
|
|||
def createGame(self):
|
||||
# create layout
|
||||
l, s = Layout(self), self.s
|
||||
font=self.app.getFont("canvas_default")
|
||||
|
||||
# set window
|
||||
self.setSize(l.XM+10*l.XS, l.YM+4.5*l.YS)
|
||||
|
|
|
@ -603,6 +603,77 @@ class DoubleDolphin(Dolphin):
|
|||
self.s.talon.dealRowAvail()
|
||||
|
||||
|
||||
# /***********************************************************************
|
||||
# // Waterfall
|
||||
# ************************************************************************/
|
||||
|
||||
class Waterfall_Foundation(AbstractFoundationStack):
|
||||
def acceptsCards(self, from_stack, cards):
|
||||
if not AbstractFoundationStack.acceptsCards(self, from_stack, cards):
|
||||
return False
|
||||
c1 = cards[0]
|
||||
if not self.cards:
|
||||
return c1.rank == ACE and c1.suit == 0
|
||||
c2 = self.cards[-1]
|
||||
if c2.rank == KING:
|
||||
suit = (c2.suit+1) % 4
|
||||
rank = ACE
|
||||
else:
|
||||
suit = c2.suit
|
||||
rank = c2.rank+1
|
||||
return c1.suit == suit and c1.rank == rank
|
||||
|
||||
|
||||
class Waterfall(Game):
|
||||
|
||||
def createGame(self):
|
||||
rows = 8
|
||||
l, s = Layout(self), self.s
|
||||
self.setSize(l.XM+rows*l.XS, l.YM+2*l.YS+20*l.YOFFSET)
|
||||
|
||||
x, y = l.XM, l.YM
|
||||
for i in range(rows):
|
||||
s.rows.append(RK_RowStack(x, y, self))
|
||||
x += l.XS
|
||||
x, y = l.XM+(rows-1)*l.XS/2, self.height-l.YS
|
||||
s.foundations.append(Waterfall_Foundation(x, y, self, suit=ANY_SUIT,
|
||||
max_cards=104))
|
||||
stack = s.foundations[0]
|
||||
tx, ty, ta, tf = l.getTextAttr(stack, 'se')
|
||||
font = self.app.getFont('canvas_default')
|
||||
stack.texts.misc = MfxCanvasText(self.canvas, tx, ty,
|
||||
anchor=ta, font=font)
|
||||
x, y = self.width-l.XS, self.height-l.YS
|
||||
s.talon = DealRowTalonStack(x, y, self)
|
||||
l.createText(s.talon, 'sw')
|
||||
|
||||
l.defaultStackGroups()
|
||||
|
||||
def startGame(self):
|
||||
for i in range(3):
|
||||
self.s.talon.dealRow(frames=0)
|
||||
self.startDealSample()
|
||||
self.s.talon.dealRow()
|
||||
|
||||
def updateText(self):
|
||||
if self.preview > 1:
|
||||
return
|
||||
f = self.s.foundations[0]
|
||||
if len(f.cards) == 104:
|
||||
t = ''
|
||||
elif len(f.cards) == 0:
|
||||
t = SUITS[0]
|
||||
else:
|
||||
c = f.cards[-1]
|
||||
if c.rank == KING:
|
||||
suit = (c.suit+1) % 4
|
||||
else:
|
||||
suit = c.suit
|
||||
t = SUITS[suit]
|
||||
f.texts.misc.config(text=t)
|
||||
|
||||
shallHighlightMatch = Game._shallHighlightMatch_RK
|
||||
|
||||
|
||||
# register the game
|
||||
registerGame(GameInfo(36, Golf, "Golf",
|
||||
|
@ -627,7 +698,9 @@ registerGame(GameInfo(432, Robert, "Robert",
|
|||
registerGame(GameInfo(551, DiamondMine, "Diamond Mine",
|
||||
GI.GT_1DECK_TYPE, 1, 0, GI.SL_BALANCED))
|
||||
registerGame(GameInfo(661, Dolphin, "Dolphin",
|
||||
GI.GT_GOLF, 1, 0, GI.SL_MOSTLY_SKILL | GI.GT_ORIGINAL))
|
||||
GI.GT_GOLF | GI.GT_ORIGINAL, 1, 0, GI.SL_MOSTLY_SKILL))
|
||||
registerGame(GameInfo(662, DoubleDolphin, "Double Dolphin",
|
||||
GI.GT_GOLF, 2, 0, GI.SL_MOSTLY_SKILL | GI.GT_ORIGINAL))
|
||||
GI.GT_GOLF | GI.GT_ORIGINAL, 2, 0, GI.SL_MOSTLY_SKILL))
|
||||
registerGame(GameInfo(709, Waterfall, "Waterfall",
|
||||
GI.GT_2DECK_TYPE | GI.GT_ORIGINAL, 2, 0, GI.SL_MOSTLY_SKILL))
|
||||
|
||||
|
|
|
@ -39,10 +39,9 @@ from pysollib.pysoltk import MfxCanvasText
|
|||
# // Heads and Tails
|
||||
# ************************************************************************/
|
||||
|
||||
class HeadsAndTails_Reserve(TalonStack):
|
||||
def clickHandler(self, event):
|
||||
# no deal
|
||||
return True
|
||||
class HeadsAndTails_Reserve(OpenStack):
|
||||
def canFlipCard(self):
|
||||
return False
|
||||
|
||||
|
||||
class HeadsAndTails(Game):
|
||||
|
@ -125,17 +124,87 @@ class HeadsAndTails(Game):
|
|||
if not from_stack:
|
||||
return
|
||||
old_state = self.enterState(self.S_FILL)
|
||||
from_stack.flipMove()
|
||||
from_stack.moveMove(1, stack)
|
||||
#stack.flipMove()
|
||||
self.leaveState(old_state)
|
||||
|
||||
shallHighlightMatch = Game._shallHighlightMatch_SS
|
||||
|
||||
|
||||
# /***********************************************************************
|
||||
# // Barrier
|
||||
# ************************************************************************/
|
||||
|
||||
|
||||
class Barrier_ReserveStack(OpenStack):
|
||||
def canFlipCard(self):
|
||||
return False
|
||||
|
||||
|
||||
class Barrier(Game):
|
||||
|
||||
def createGame(self):
|
||||
reserves = 8
|
||||
rows = 10
|
||||
max_rows = max(8, rows, reserves)
|
||||
|
||||
l, s = Layout(self), self.s
|
||||
self.setSize(l.XM+max_rows*l.XS, l.YM+4*l.YS+12*l.YOFFSET)
|
||||
|
||||
s.addattr(reserves2=[]) # register extra stack variables
|
||||
|
||||
x, y = l.XM+(max_rows-reserves)*l.XS/2+l.XS/2, l.YM
|
||||
for i in range(reserves/2):
|
||||
stack = Barrier_ReserveStack(x, y, self)
|
||||
s.reserves2.append(stack)
|
||||
l.createText(stack, "ne")
|
||||
x += 2*l.XS
|
||||
x, y = l.XM+(max_rows-reserves)*l.XS/2, l.YM+l.YS
|
||||
for i in range(reserves):
|
||||
s.reserves.append(OpenStack(x, y, self))
|
||||
x += l.XS
|
||||
x, y = l.XM+(max_rows-rows)*l.XS/2, l.YM+2*l.YS
|
||||
for i in range(rows):
|
||||
s.rows.append(AC_RowStack(x, y, self))
|
||||
x += l.XS
|
||||
x, y = l.XM+(max_rows-8)*l.XS/2, self.height-l.YS
|
||||
for i in range(8):
|
||||
s.foundations.append(SS_FoundationStack(x, y, self, suit=i/2))
|
||||
x += l.XS
|
||||
x, y = l.XM, self.height-l.YS
|
||||
s.talon = InitialDealTalonStack(x, y, self)
|
||||
|
||||
l.defaultStackGroups()
|
||||
|
||||
def startGame(self):
|
||||
rows = len(self.s.rows)
|
||||
reserves = len(self.s.reserves)
|
||||
n = (104-reserves-2*rows)/(reserves/2)
|
||||
for i in range(n):
|
||||
self.s.talon.dealRow(rows=self.s.reserves2, frames=0, flip=0)
|
||||
self.s.talon.dealRow(rows=self.s.reserves, frames=0)
|
||||
self.startDealSample()
|
||||
self.s.talon.dealRow()
|
||||
self.s.talon.dealRow()
|
||||
|
||||
def fillStack(self, stack):
|
||||
if stack in self.s.reserves and not stack.cards:
|
||||
si = list(self.s.reserves).index(stack)
|
||||
from_stack = self.s.reserves2[si/2]
|
||||
if not from_stack.cards:
|
||||
return
|
||||
old_state = self.enterState(self.S_FILL)
|
||||
from_stack.flipMove()
|
||||
from_stack.moveMove(1, stack)
|
||||
self.leaveState(old_state)
|
||||
|
||||
shallHighlightMatch = Game._shallHighlightMatch_AC
|
||||
|
||||
|
||||
# register the game
|
||||
|
||||
registerGame(GameInfo(307, HeadsAndTails, "Heads and Tails",
|
||||
GI.GT_2DECK_TYPE, 2, 0, GI.SL_BALANCED))
|
||||
|
||||
|
||||
registerGame(GameInfo(708, Barrier, "Barrier",
|
||||
GI.GT_2DECK_TYPE | GI.GT_ORIGINAL, 2, 0, GI.SL_BALANCED))
|
||||
|
||||
|
|
|
@ -193,7 +193,7 @@ class LesQuatreCoins_Talon(RedealTalonStack):
|
|||
if sound and not self.game.demo:
|
||||
self.game.startDealSample()
|
||||
rows = self.game.s.rows
|
||||
rows = rows[:1]+rows[4:8]+(rows[2],rows[1])+rows[8:]+rows[3:4]
|
||||
rows = rows[:1]+rows[4:8]+rows[2:3]+rows[1:2]+rows[8:]+rows[3:4]
|
||||
num_cards = self.dealRowAvail(rows=rows)
|
||||
if sound and not self.game.demo:
|
||||
self.game.stopSamples()
|
||||
|
|
Loading…
Add table
Reference in a new issue