本文整理汇总了Python中Game.Game.save方法的典型用法代码示例。如果您正苦于以下问题:Python Game.save方法的具体用法?Python Game.save怎么用?Python Game.save使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Game.Game
的用法示例。
在下文中一共展示了Game.save方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from Game import Game [as 别名]
# 或者: from Game.Game import save [as 别名]
class GameEngine:
def __init__(self):
print 'cons'
self.game = Game()
def update(self):
print 'update'
while not self.game.over():
self.game.update()
def load(self):
print 'load'
def save(self):
print 'save'
self.game.save()
示例2: ViewMain
# 需要导入模块: from Game import Game [as 别名]
# 或者: from Game.Game import save [as 别名]
class ViewMain(QMainWindow):
"""This Class Provides the Graphical Interface for Game"""
# Use Constants To Avoid Magic Numbers
# Declare stack widget names
MAIN_PAGE = 0
SETTINGS_PAGE = 1
GAME_PAGE = 2
INSTRUCTIONS_PAGE = 3
CREDITS_PAGE = 4
STORY_PAGE = 5
SCORE_PAGE = 6
finished = pyqtSignal()
def __init__(self, parent=None):
"""Initialize the abstracted class instance"""
super(ViewMain, self).__init__(parent)
# Init Data Members
self.gui = Gui(self)
self.game = None
self.connectGui()
self.gameWasLoaded = False
self.useLoadWorkaround = True
# Dictionary of Graphics Objects
self.graphicsObjects = {}
# Overlays
self.overlays = {}
self.currStackIndex = self.MAIN_PAGE
self.gui.soundManager.playCurrMusic()
#self.gui.soundManager.setVolume(0)
# Timer initialization and setup for normal popups
self.popupTimelineStart = QTimeLine(200)
self.popupTimelineStart.setFrameRange(0,100)
self.popupTimelineEnd = QTimeLine(200)
self.popupTimelineEnd.setFrameRange(0,100)
self.popupTimelineWait = QTimeLine()
self.popupTimelineWait.setFrameRange(0,100)
self.popupClue = False
self.popupStory = False
# Initialization and setup for animated popups
self.popupAnimationOpen = QPropertyAnimation(self.gui.popup,"geometry")
self.popupAnimationOpen.setDuration(200)
self.popupAnimationOpen.setStartValue(QRect(0, 591, 0, 0))
self.popupAnimationOpen.setEndValue(QRect(25, 25, 750, 450))
self.popupAnimationClose = QPropertyAnimation(self.gui.popup,"geometry")
self.popupAnimationClose.setDuration(200)
self.popupAnimationClose.setStartValue(QRect(25, 25, 750, 450))
self.popupAnimationClose.setEndValue(QRect(0, 591, 0, 0))
self.popupAnimationWait = QTimeLine()
self.toMain = False
#self.gui.personView.centerOn(0,0)
self.gui.mapView.centerOn(0,0)
########################################
### Signals and slots connected here ###
########################################
# Connections for normal popups
self.popupTimelineStart.frameChanged.connect(self.drawPopup)
self.popupTimelineStart.finished.connect(self.popupWait)
self.popupTimelineEnd.frameChanged.connect(self.erasePopup)
self.popupTimelineWait.finished.connect(self.enableErasePopup)
self.popupTimelineEnd.finished.connect(self.writeClue)
# Connections for animated popups
self.popupAnimationOpen.finished.connect(self.popupAnimationWait.start)
self.popupAnimationWait.finished.connect(self.popupAnimationClose.start)
self.popupAnimationClose.finished.connect(self.popupAnimationCleanup)
self.finished.connect(self.writeStory)
def connectGui(self):
"""Connect signals for Gui"""
self.gui.actionQuit.triggered.connect(self.close)
self.gui.quitButton.released.connect(self.close)
self.gui.settingsButton.released.connect(self.setSettings)
self.gui.actionSettings.triggered.connect(self.setSettings)
self.gui.loadButton.released.connect(self.loadFileDialog)
self.gui.actionSave_Game.triggered.connect(self.saveFileDialog)
self.gui.doneButton.released.connect(self.goBack)
self.gui.startButton.released.connect(self.enterName)
self.gui.actionMain_Menu.triggered.connect(self.setMain)
self.gui.actionHelp.triggered.connect(self.setInstructions)
self.gui.instrButton.released.connect(self.setInstructions)
self.gui.doneButton2.released.connect(self.goBack)
self.gui.doneButton3.released.connect(self.goBack)
self.gui.doneButtonScore.released.connect(self.scoreButton)
self.gui.actionCredits.triggered.connect(self.setCredits)
self.gui.latLongCheck.stateChanged.connect(self.latLong)
self.gui.colorCheck.stateChanged.connect(self.colorize)
self.gui.legendCheck.stateChanged.connect(self.legend)
#.........这里部分代码省略.........