def __init__(self, engine, players, maxplayers=None, gameMode=0, multiMode=0, allowGuitar=True, allowDrum=True, allowMic=False, tutorial=False): self.engine = engine self.players = [] self.minPlayers = players self.maxPlayers = maxplayers or players self.gameMode = gameMode #Quickplay, Practice, Career self.multiMode = multiMode #Face-Off, Pro FO, Party, Co-Op, RB Co-Op, GH Co-Op, Battle self.allowGuitar = allowGuitar self.allowDrum = allowDrum self.allowMic = allowMic self.tutorial = tutorial self.scene = None self.sceneName = "" self.songQueue = SongQueue() self.playingQueue = False self.done = False self.setGameName()
def __init__(self, engine, players, maxplayers = None, gameMode = 0, multiMode = 0, allowGuitar = True, allowDrum = True, allowMic = False, tutorial = False): self.engine = engine self.players = [] self.minPlayers = players self.maxPlayers = maxplayers or players self.gameMode = gameMode #Quickplay, Practice, Career self.multiMode = multiMode #Face-Off, Pro FO, Co-Op, RB Co-Op self.allowGuitar = allowGuitar self.allowDrum = allowDrum self.allowMic = allowMic self.tutorial = tutorial self.scene = None self.sceneName = "" self.songQueue = SongQueue() self.playingQueue = False self.done = False self.setGameName()
class World: def __init__(self, engine, players, maxplayers=None, gameMode=0, multiMode=0, allowGuitar=True, allowDrum=True, allowMic=False, tutorial=False): self.engine = engine self.players = [] self.minPlayers = players self.maxPlayers = maxplayers or players self.gameMode = gameMode #Quickplay, Practice, Career self.multiMode = multiMode #Face-Off, Pro FO, Party, Co-Op, RB Co-Op, GH Co-Op, Battle self.allowGuitar = allowGuitar self.allowDrum = allowDrum self.allowMic = allowMic self.tutorial = tutorial self.scene = None self.sceneName = "" self.songQueue = SongQueue() self.playingQueue = False self.done = False self.setGameName() def setGameName(self): if self.minPlayers > 1: if self.gameMode == 0: self.gameName = _("Face-Off") elif self.gameMode == 1: self.gameName = _("Pro Face-Off") elif self.gameMode == 2: self.gameName = _("Party Mode") elif self.gameMode == 3: self.gameName = _("FoFiX Co-Op Mode") elif self.gameMode == 4: self.gameName = _("RB Co-Op Mode") elif self.gameMode == 5: self.gameName = _("GH Co-Op Mode") elif self.gameMode == 6: self.gameName = _("Battle Mode") else: if self.gameMode == 0: self.gameName = _("Quickplay") elif self.gameMode == 1: self.gameName = _("Practice") elif self.gameMode == 2: self.gameName = _("Career Mode") def finishGame(self): if self.done: return self.players = [] if self.scene: self.engine.view.popLayer(self.scene) self.engine.removeTask(self.scene) for layer in self.engine.view.layers: if isinstance(layer, Dialogs.LoadingSplashScreen): Dialogs.hideLoadingSplashScreen(self.engine, layer) self.scene = None self.done = True self.engine.finishGame() def startGame(self, **args): self.createScene(STARTUP_SCENE, **args) def resetWorld(self): if self.scene: self.engine.view.popLayer(self.scene) self.engine.removeTask(self.scene) for layer in self.engine.view.layers: if isinstance(layer, Dialogs.LoadingSplashScreen): Dialogs.hideLoadingSplashScreen(self.engine, layer) self.scene = None self.sceneName = "" self.players = [] self.songQueue.reset() self.engine.mainMenu.restartGame() def createPlayer(self, name): playerNum = len(self.players) player = Player.Player(name, playerNum) player.controller = self.engine.input.activeGameControls[playerNum] player.controlType = self.engine.input.controls.type[player.controller] player.keyList = Player.playerkeys[playerNum] player.configController() player.practiceMode = (self.gameMode == 1) self.players.append(player) self.songQueue.parts.append(player.part.id) self.songQueue.diffs.append(player.getDifficultyInt()) if self.scene: self.scene.addPlayer(player) def deletePlayer(self, number): player = self.players.pop(number) if self.scene: self.scene.removePlayer(player) def createScene(self, name, **args): if self.scene: self.engine.view.popLayer(self.scene) self.engine.removeTask(self.scene) self.scene = SceneFactory.create(engine=self.engine, name=name, **args) self.engine.addTask(self.scene) self.engine.view.pushLayer(self.scene) def getPlayers(self): return self.players
class World: def __init__(self, engine, players, maxplayers = None, gameMode = 0, multiMode = 0, allowGuitar = True, allowDrum = True, allowMic = False, tutorial = False): self.engine = engine self.players = [] self.minPlayers = players self.maxPlayers = maxplayers or players self.gameMode = gameMode #Quickplay, Practice, Career self.multiMode = multiMode #Face-Off, Pro FO, Co-Op, RB Co-Op self.allowGuitar = allowGuitar self.allowDrum = allowDrum self.allowMic = allowMic self.tutorial = tutorial self.scene = None self.sceneName = "" self.songQueue = SongQueue() self.playingQueue = False self.done = False self.setGameName() def setGameName(self): if self.minPlayers > 1: if self.gameMode == 0: self.gameName = _("Face-Off") elif self.gameMode == 1: self.gameName = _("Pro Face-Off") elif self.gameMode == 3: self.gameName = _("FoFiX Co-Op Mode") elif self.gameMode == 4: self.gameName = _("RB Co-Op Mode") elif self.gameMode == 6: self.gameName = _("Battle Mode") else: if self.gameMode == 0: self.gameName = _("Quickplay") elif self.gameMode == 1: self.gameName = _("Practice") elif self.gameMode == 2: self.gameName = _("Career Mode") def finishGame(self): if self.done: return self.players = [] if self.scene: self.engine.view.popLayer(self.scene) self.engine.removeTask(self.scene) for layer in self.engine.view.layers: if isinstance(layer, Dialogs.LoadingSplashScreen): Dialogs.hideLoadingSplashScreen(self.engine, layer) self.scene = None self.done = True self.engine.finishGame() def startGame(self, **args): self.createScene(STARTUP_SCENE, **args) def resetWorld(self): if self.scene: self.engine.view.popLayer(self.scene) self.engine.removeTask(self.scene) for layer in self.engine.view.layers: if isinstance(layer, Dialogs.LoadingSplashScreen): Dialogs.hideLoadingSplashScreen(self.engine, layer) self.scene = None self.sceneName = "" self.players = [] self.songQueue.reset() self.engine.mainMenu.restartGame() def createPlayer(self, name): playerNum = len(self.players) player = Player.Player(name, playerNum) player.controller = self.engine.input.activeGameControls[playerNum] player.controlType = self.engine.input.controls.type[player.controller] player.keyList = Player.playerkeys[playerNum] player.configController() player.practiceMode = (self.gameMode == 1) self.players.append(player) self.songQueue.parts.append(player.part.id) self.songQueue.diffs.append(player.getDifficultyInt()) if self.scene: self.scene.addPlayer(player) def deletePlayer(self, number): player = self.players.pop(number) if self.scene: self.scene.removePlayer(player) def createScene(self, name, **args): if self.scene: self.engine.view.popLayer(self.scene) self.engine.removeTask(self.scene) self.scene = SceneFactory.create(engine = self.engine, name = name, **args) self.engine.addTask(self.scene) self.engine.view.pushLayer(self.scene) def getPlayers(self): return self.players