本文整理汇总了Python中Song.loadSongInfo方法的典型用法代码示例。如果您正苦于以下问题:Python Song.loadSongInfo方法的具体用法?Python Song.loadSongInfo怎么用?Python Song.loadSongInfo使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Song
的用法示例。
在下文中一共展示了Song.loadSongInfo方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: run
# 需要导入模块: import Song [as 别名]
# 或者: from Song import loadSongInfo [as 别名]
def run(self, ticks):
SceneClient.run(self, ticks)
if not self.wizardStarted:
self.wizardStarted = True
if not self.songName:
while True:
self.libraryName, self.songName = \
Dialogs.chooseSong(self.engine, \
selectedLibrary = Config.get("game", "selected_library"),
selectedSong = Config.get("game", "selected_song"))
if not self.songName:
self.session.world.finishGame()
return
Config.set("game", "selected_library", self.libraryName)
Config.set("game", "selected_song", self.songName)
info = Song.loadSongInfo(self.engine, self.songName, library = self.libraryName)
d = Dialogs.chooseItem(self.engine, info.difficulties,
_("Choose a difficulty:"), selected = self.player.difficulty)
if d:
self.player.difficulty = d
break
else:
info = Song.loadSongInfo(self.engine, self.songName, library = self.libraryName)
# Make sure the difficulty we chose is available
if not self.player.difficulty in info.difficulties:
self.player.difficulty = info.difficulties[0]
self.session.world.deleteScene(self)
self.session.world.createScene("GuitarScene", libraryName = self.libraryName, songName = self.songName)
示例2: checkParts
# 需要导入模块: import Song [as 别名]
# 或者: from Song import loadSongInfo [as 别名]
def checkParts(self):
info = Song.loadSongInfo(self.engine, self.songName, library=self.libraryName)
guitars = []
drums = []
vocals = []
for part in info.parts:
if part.id == 4 or part.id == 7:
drums.append(part)
elif part.id == 5:
vocals.append(part)
else:
guitars.append(part)
if len(drums) == 0 and self.engine.input.gameDrums > 0:
Dialogs.showMessage(
self.engine, _("There are no drum parts in this song. Change your controllers to play.")
)
return False
if len(guitars) == 0 and self.engine.input.gameGuitars > 0:
Dialogs.showMessage(
self.engine, _("There are no guitar parts in this song. Change your controllers to play.")
)
return False
if len(vocals) == 0 and self.engine.input.gameMics > 0:
Dialogs.showMessage(
self.engine, _("There are no vocal parts in this song. Change your controllers to play.")
)
return False
return True
示例3: startQueue
# 需要导入模块: import Song [as 别名]
# 或者: from Song import loadSongInfo [as 别名]
def startQueue(self):
firstSong = self.songQueue.nextSong(0)
Config.set("game", "selected_song", firstSong[0])
Config.set("game", "selected_library", firstSong[1])
Config.set("game", "selected_players", firstSong[2])
self.player.difficulty = firstSong[3]
self.player2.difficulty = firstSong[4]
self.player.part = firstSong[5]
self.player2.part = firstSong[6]
self.info = Song.loadSongInfo(self.engine, firstSong[0])
self.songName = firstSong[0]
self.startGame(queueCounter = 1)
示例4: startQueue
# 需要导入模块: import Song [as 别名]
# 或者: from Song import loadSongInfo [as 别名]
def startQueue(self):
#obviously a fair amount of work to be done on this anyway... But note that startGame will not work.
firstSong = self.songQueue.nextSong(0)
Config.set("game", "selected_song", firstSong[0])
Config.set("game", "selected_library", firstSong[1])
Config.set("game", "selected_players", firstSong[2])
self.player.difficulty = firstSong[3]
self.player2.difficulty = firstSong[4]
self.player.part = firstSong[5]
self.player2.part = firstSong[6]
self.info = Song.loadSongInfo(self.engine, firstSong[0])
self.songName = firstSong[0]
self.startGame(queueCounter = 1)
示例5: run
# 需要导入模块: import Song [as 别名]
# 或者: from Song import loadSongInfo [as 别名]
def run(self, ticks):
SceneClient.run(self, ticks)
players = 1
if not self.wizardStarted:
self.wizardStarted = True
if self.engine.cmdPlay == 1:
self.songName = Config.get("game", "selected_song")
self.libraryName = Config.get("game", "selected_library")
self.engine.cmdPlay = 2
if not self.songName:
while True:
self.libraryName, self.songName = \
Dialogs.chooseSong(self.engine, \
selectedLibrary = Config.get("game", "selected_library"),
selectedSong = Config.get("game", "selected_song"))
if self.libraryName == None:
newPath = Dialogs.chooseFile(self.engine, masks = ["*/songs"], prompt = _("Choose a new songs directory."), dirSelect = True)
if newPath != None:
Config.set("game", "base_library", os.path.dirname(newPath))
Config.set("game", "selected_library", "songs")
Config.set("game", "selected_song", "")
if not self.songName:
self.session.world.finishGame()
return
Config.set("game", "selected_library", self.libraryName)
Config.set("game", "selected_song", self.songName)
info = Song.loadSongInfo(self.engine, self.songName, library = self.libraryName)
selected = False
escape = False
escaped = False
while True:
if len(info.parts) > 1:
p = Dialogs.chooseItem(self.engine, info.parts, "%s \n %s" % (info.name, _("Player 1 Choose a part:")), selected = self.player.part)
else:
p = info.parts[0]
if p:
self.player.part = p
else:
break;
while True:
if len(info.difficulties) > 1:
d = Dialogs.chooseItem(self.engine, info.difficulties,
"%s \n %s" % (info.name, _("Player 1 Choose a difficulty:")), selected = self.player.difficulty)
else:
d = info.difficulties[0]
if d:
self.player.difficulty = d
else:
if len(info.parts) <= 1:
escape = True
break
while True:
if self.engine.config.get("game", "players") > 1:
p = Dialogs.chooseItem(self.engine, info.parts + ["Party Mode"] + ["No Player 2"], "%s \n %s" % (info.name, _("Player 2 Choose a part:")), selected = self.player2.part)
if p and p == "No Player 2":
players = 1
selected = True
self.player2.part = p
break
elif p and p == "Party Mode":
players = -1
selected = True
self.player2.part = p
break
elif p and p != "No Player 2" and p != "Party Mode":
players = 2
self.player2.part = p
else:
if len(info.difficulties) <= 1:
escaped = True
if len(info.parts) <= 1:
escape = True
break
while True:
if len(info.difficulties) > 1:
d = Dialogs.chooseItem(self.engine, info.difficulties, "%s \n %s" % (info.name, _("Player 2 Choose a difficulty:")), selected = self.player2.difficulty)
else:
d = info.difficulties[0]
if d:
self.player2.difficulty = d
else:
break
selected = True
break
else:
selected = True
break
if selected:
break
if selected or escaped:
#.........这里部分代码省略.........
示例6: startGame
# 需要导入模块: import Song [as 别名]
# 或者: from Song import loadSongInfo [as 别名]
def startGame(self, fromQueue=False): # note this is not refined.
if len(self.engine.world.songQueue) == 0:
return
showDialog = True
if not fromQueue and self.queueFormat == 1 and len(self.engine.world.songQueue) > 1:
self.engine.world.songQueue.setFullQueue()
self.engine.world.playingQueue = True
if self.queueOrder == 1:
self.songName, self.libraryName = self.engine.world.songQueue.getRandomSong()
else:
self.songName, self.libraryName = self.engine.world.songQueue.getSong()
info = Song.loadSongInfo(self.engine, self.songName, library=self.libraryName)
guitars = []
drums = []
vocals = []
for part in info.parts:
if part.id == 4 or part.id == 7:
drums.append(part)
elif part.id == 5:
vocals.append(part)
else:
guitars.append(part)
choose = [[] for i in self.players]
for i, player in enumerate(self.players):
j = self.engine.world.songQueue.getParts()[i]
if player.controlType == 2 or player.controlType == 3:
choose[i] = drums
elif player.controlType == 5:
choose[i] = vocals
else:
choose[i] = guitars
if self.queued:
showDialog = False
for i, player in enumerate(self.players):
if Song.parts[j] in choose[i]:
p = Song.parts[j]
elif self.queueParts == 0:
if j == 0:
for k in [3, 1, 2]:
if Song.parts[k] in choose[i]:
p = Song.parts[k]
break
elif j == 1:
for k in [2, 0, 3]:
if Song.parts[k] in choose[i]:
p = Song.parts[k]
break
elif j == 2:
for k in [1, 0, 3]:
if Song.parts[k] in choose[i]:
p = Song.parts[k]
break
elif j == 3:
for k in [0, 1, 2]:
if Song.parts[k] in choose[i]:
p = Song.parts[k]
break
j = self.engine.world.songQueue.getDiffs()[i]
if Song.difficulties[j] in info.partDifficulties[p.id]:
d = Song.difficulties[j]
elif self.queueDiffs == 0:
if j == 0:
for k in range(1, 4):
if Song.difficulties[k] in info.partDifficulties[p.id]:
d = Song.difficulties[k]
elif j == 1:
for k in range(2, 5):
if Song.difficulties[k % 4] in info.partDifficulties[p.id]:
d = Song.difficulties[k % 4]
elif j == 2:
if Song.difficulties[3] in info.partDifficulties[p.id]:
d = Song.difficulties[3]
else:
for k in range(1, -1, -1):
if Song.difficulties[k] in info.partDifficulties[p.id]:
d = Song.difficulties[k]
else:
for k in range(2, -1, -1):
if Song.difficulties[k] in info.partDifficulties[p.id]:
d = Song.difficulties[k]
elif self.queueDiffs == 1:
if j == 3:
for k in range(2, -1, -1):
if Song.difficulties[k] in info.partDifficulties[p.id]:
d = Song.difficulties[k]
elif j == 2:
for k in range(1, -2, -1):
if Song.difficulties[k % 4] in info.partDifficulties[p.id]:
d = Song.difficulties[k % 4]
elif j == 1:
if Song.difficulties[0] in info.partDifficulties[p.id]:
d = Song.difficulties[0]
else:
for k in range(2, 4):
if Song.difficulties[k] in info.partDifficulties[p.id]:
d = Song.difficulties[k]
else:
for k in range(1, 4):
if Song.difficulties[k] in info.partDifficulties[p.id]:
d = Song.difficulties[k]
#.........这里部分代码省略.........
示例7: checkCmdPlay
# 需要导入模块: import Song [as 别名]
# 或者: from Song import loadSongInfo [as 别名]
def checkCmdPlay(self):
info = Song.loadSongInfo(self.engine, self.songName, library=self.libraryName)
guitars = []
drums = []
vocals = []
autoPart = None
for part in info.parts:
if part.id == 4 or part.id == 7:
drums.append(part)
elif part.id == 5:
vocals.append(part)
else:
guitars.append(part)
if self.engine.cmdPlay == 2 and self.engine.cmdPart is not None and len(self.playerList) == 1:
if self.engine.cmdPart == part.id:
Log.debug("Command-line mode: Part found!")
if part.id == 4 and self.engine.input.gameDrums > 0:
autoPart = part.id
elif part.id == 5 and self.engine.input.gameMics > 0:
autoPart = part.id
elif self.engine.input.gameGuitars > 0:
autoPart = part.id
if autoPart is None:
if len(drums) == 0 and self.engine.input.gameDrums > 0:
if self.splash:
Dialogs.hideLoadingSplashScreen(self.engine, self.splash)
self.splash = None
Dialogs.showMessage(
self.engine, _("There are no drum parts in this song. Change your controllers to play.")
)
if self.engine.cmdPlay == 2:
self.engine.cmdPlay = 0
return False
if len(guitars) == 0 and self.engine.input.gameGuitars > 0:
if self.splash:
Dialogs.hideLoadingSplashScreen(self.engine, self.splash)
self.splash = None
Dialogs.showMessage(
self.engine, _("There are no guitar parts in this song. Change your controllers to play.")
)
if self.engine.cmdPlay == 2:
self.engine.cmdPlay = 0
return False
if len(vocals) == 0 and self.engine.input.gameMics > 0:
if self.splash:
Dialogs.hideLoadingSplashScreen(self.engine, self.splash)
self.splash = None
Dialogs.showMessage(
self.engine, _("There are no vocal parts in this song. Change your controllers to play.")
)
if self.engine.cmdPlay == 2:
self.engine.cmdPlay = 0
return False
# Make sure the difficulty we chose is available
p = self.playerList[0].part
player = self.playerList[0]
if self.engine.cmdDiff is not None:
diff = Song.difficulties[self.engine.cmdDiff]
if diff in info.partDifficulties[p.id]:
self.playerList[0].difficulty = diff
else:
self.playerList[0].difficulty = info.partDifficulties[p.id][0]
else:
if self.splash:
Dialogs.hideLoadingSplashScreen(self.engine, self.splash)
self.splash = None
self.playerList[0].difficulty = Dialogs.chooseItem(
self.engine,
info.partDifficulties[p.id],
"%s \n %s"
% (Song.removeSongOrderPrefixFromName(info.name), _("%s Choose a difficulty:") % player.name),
selected=player.difficulty,
)
return True
示例8: run
# 需要导入模块: import Song [as 别名]
# 或者: from Song import loadSongInfo [as 别名]
def run(self, ticks):
SceneClient.run(self, ticks)
players = 1
if not self.wizardStarted:
self.wizardStarted = True
if self.engine.cmdPlay == 1:
self.songName = Config.get("game", "selected_song")
self.libraryName = Config.get("game", "selected_library")
self.engine.cmdPlay = 2
if not self.songName:
while True:
self.libraryName, self.songName = \
Dialogs.chooseSong(self.engine, \
selectedLibrary = Config.get("game", "selected_library"),
selectedSong = Config.get("game", "selected_song"))
if self.libraryName == None:
newPath = Dialogs.chooseFile(self.engine, masks = ["*/songs"], prompt = _("Choose a new songs directory."), dirSelect = True)
if newPath != None:
Config.set("game", "base_library", os.path.dirname(newPath))
Config.set("game", "selected_library", "songs")
Config.set("game", "selected_song", "")
self.engine.resource.refreshBaseLib() #myfingershurt - to let user continue with new songpath without restart
if not self.songName:
self.session.world.finishGame()
return
Config.set("game", "selected_library", self.libraryName)
Config.set("game", "selected_song", self.songName)
info = Song.loadSongInfo(self.engine, self.songName, library = self.libraryName)
selected = False
escape = False
escaped = False
#while True: #this nesting is now useless
#MFH - add "Practice" mode, which will activate a section selection menu before "part"
#racer: main menu instead of second menu practice
#self.player.practiceMode = Player.PracticeSet
#MFH - parameters for newLocalGame:
#players = -1 (party mode), 1, 2
#mode1p = 0 (quickplay), 1 (practice), 2 (career)
#mode2p = 0 (face-off), 1 (pro face-off)
#Config.define("game", "players", int, 1)
#Config.define("player0","mode_1p", int, 0)
#Config.define("player1","mode_2p", int, 0)
if Config.get("player0","mode_1p") == 1 and Config.get("game","players") == 1: #practice mode
self.player.practiceMode = True
else:
self.player.practiceMode = False
while True: #new nesting for Practice Mode - section / start time selection
if self.player.practiceMode:
#self.engine.resource.load(self, "song", lambda: Song.loadSong(self.engine, songName, library = self.libraryName, notesOnly = True, part = [player.part for player in self.playerList]), onLoad = self.songLoaded)
#startTime = Dialogs.chooseItem(self.engine, info.sections, "%s \n %s" % (info.name, _("Start Section:")))
sectionLabels = [sLabel for sLabel,sPos in info.sections]
startLabel = Dialogs.chooseItem(self.engine, sectionLabels, "%s \n %s" % (info.name, _("Start Section:")))
if startLabel:
Log.debug("Practice start section selected: " + startLabel)
else:
startLabel = "Gig"
if startLabel:
self.player.practiceSection = startLabel
#find start position in array:
self.player.startPos = [sPos for sLabel,sPos in info.sections if sLabel == startLabel]
Log.debug("Practice start position retrieved: " + str(self.player.startPos) )
else:
break;
#if not self.player.practiceMode:
#selected = True #this causes "gig" mode to start song with all defaults
#escape = True #this causes "gig" mode to exit out to the song selection
#escaped = True #this does nothing :(
#break;
while True: #new nesting for Practice Mode selection
if len(info.parts) > 1:
p = Dialogs.chooseItem(self.engine, info.parts, "%s \n %s" % (info.name, _("Player 1 Choose a part:")), selected = self.player.part)
else:
p = info.parts[0]
if p:
self.player.part = p
else:
#.........这里部分代码省略.........
示例9: run
# 需要导入模块: import Song [as 别名]
# 或者: from Song import loadSongInfo [as 别名]
def run(self, ticks):
SceneClient.run(self, ticks)
players = 1
if not self.wizardStarted:
self.wizardStarted = True
if not self.songName:
while 1:
if self.engine.cmdPlay == 2:
self.songName = Config.get("game", "selected_song")
self.libraryName = Config.get("game", "selected_library")
else:
self.mode = 1
self.libraryName, self.songName = \
Dialogs.chooseSong(self.engine, \
selectedLibrary = Config.get("game", "selected_library"),
selectedSong = Config.get("game", "selected_song"))
if self.libraryName == None:
newPath = Dialogs.chooseFile(self.engine, masks = ["*/songs"], prompt = _("Choose a new songs directory."), dirSelect = True)
if newPath != None:
Config.set("game", "base_library", os.path.dirname(newPath))
Config.set("game", "selected_library", "songs")
Config.set("game", "selected_song", "")
self.engine.resource.refreshBaseLib() #myfingershurt - to let user continue with new songpath without restart
if not self.songName:
self.session.world.finishGame()
return
if not self.tut:
Config.set("game", "selected_library", self.libraryName)
Config.set("game", "selected_song", self.songName)
self.mode = 2
info = Song.loadSongInfo(self.engine, self.songName, library = self.libraryName)
selected = False
escape = False
escaped = False
#while True: #this nesting is now useless
#MFH - add "Practice" mode, which will activate a section selection menu before "part"
#racer: main menu instead of second menu practice
#self.player.practiceMode = Player.PracticeSet
#MFH - parameters for newLocalGame:
#players = -1 (party mode), 1, 2
#mode1p = 0 (quickplay), 1 (practice), 2 (career)
#mode2p = 0 (face-off), 1 (pro face-off)
#Config.define("game", "players", int, 1)
#Config.define("game","game_mode", int, 0)
#Config.define("game","multiplayer_mode", int, 0)
if Config.get("game","game_mode") == 1 and Config.get("game","players") == 1: #practice mode
self.player.practiceMode = True
else:
self.player.practiceMode = False
slowDownDivisor = Config.get("audio", "speed_factor")
while 1: #new nesting for Practice Mode - section / start time selection
if self.player.practiceMode:
values, options = Config.getOptions("audio", "speed_factor")
if self.subMenuPosTuple:
slowdown = Dialogs.chooseItem(self.engine, options, "%s \n %s" % (Dialogs.removeSongOrderPrefixFromName(info.name), _("Speed Select:")), pos = self.subMenuPosTuple)
else:
slowdown = Dialogs.chooseItem(self.engine, options, "%s \n %s" % (Dialogs.removeSongOrderPrefixFromName(info.name), _("Speed Select:")))
for i in range(len(values)):
if options[i] == slowdown:
self.player.practiceSpeed = values[i]
slowDownDivisor = values[i]
break
if self.player.practiceMode:
sectionLabels = [sLabel for sLabel,sPos in info.sections]
if self.subMenuPosTuple:
startLabel = Dialogs.chooseItem(self.engine, sectionLabels, "%s \n %s" % (Dialogs.removeSongOrderPrefixFromName(info.name), _("Start Section:")), pos = self.subMenuPosTuple)
else:
startLabel = Dialogs.chooseItem(self.engine, sectionLabels, "%s \n %s" % (Dialogs.removeSongOrderPrefixFromName(info.name), _("Start Section:")))
if startLabel:
Log.debug("Practice start section selected: " + startLabel)
else:
startLabel = "Gig"
if startLabel:
self.player.practiceSection = startLabel
#find start position in array:
try:
tempStart = [sPos for sLabel,sPos in info.sections if sLabel == startLabel]
if tempStart == []:
self.player.startPos = 0.0
else:
self.player.startPos = tempStart[0]
Log.debug("Practice start position retrieved: " + str(self.player.startPos))
except:
#.........这里部分代码省略.........