mirror of
https://github.com/shlomif/PySolFC.git
synced 2025-04-05 00:02:29 -04:00
Extract a common class/struct.
This is Refactoring / code cleanup. See: * https://en.wikipedia.org/wiki/God_object * https://en.wikipedia.org/wiki/Extract_class * https://en.wikipedia.org/wiki/Code_refactoring * https://www.refactoring.com/ * https://www.joelonsoftware.com/2002/01/23/rub-a-dub-dub/ Some small optimisations may have slipped in as well.
This commit is contained in:
parent
a5d584371e
commit
a472160ca7
1 changed files with 13 additions and 10 deletions
|
@ -430,6 +430,18 @@ class GameGlobalStatsStruct(NewStruct):
|
||||||
start_player = attr.ib(default=None)
|
start_player = attr.ib(default=None)
|
||||||
|
|
||||||
|
|
||||||
|
@attr.s
|
||||||
|
class GameWinAnimation(NewStruct):
|
||||||
|
timer = attr.ib(default=None)
|
||||||
|
images = attr.ib(factory=list)
|
||||||
|
tk_images = attr.ib(factory=list) # saved tk images
|
||||||
|
saved_images = attr.ib(factory=dict) # saved resampled images
|
||||||
|
canvas_images = attr.ib(factory=list) # ids of canvas images
|
||||||
|
frame_num = attr.ib(default=0) # number of the current frame
|
||||||
|
width = attr.ib(default=0)
|
||||||
|
height = attr.ib(default=0)
|
||||||
|
|
||||||
|
|
||||||
class Game(object):
|
class Game(object):
|
||||||
# for self.gstats.updated
|
# for self.gstats.updated
|
||||||
U_PLAY = _GLOBAL_U_PLAY
|
U_PLAY = _GLOBAL_U_PLAY
|
||||||
|
@ -698,16 +710,7 @@ class Game(object):
|
||||||
comment="",
|
comment="",
|
||||||
)
|
)
|
||||||
# some vars for win animation
|
# some vars for win animation
|
||||||
self.win_animation = Struct(
|
self.win_animation = GameWinAnimation()
|
||||||
timer=None,
|
|
||||||
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,
|
|
||||||
)
|
|
||||||
|
|
||||||
def getTitleName(self):
|
def getTitleName(self):
|
||||||
return self.app.getGameTitleName(self.id)
|
return self.app.getGameTitleName(self.id)
|
||||||
|
|
Loading…
Add table
Reference in a new issue