本文整理汇总了Python中GameEngine.GameEngine.cmdMode方法的典型用法代码示例。如果您正苦于以下问题:Python GameEngine.cmdMode方法的具体用法?Python GameEngine.cmdMode怎么用?Python GameEngine.cmdMode使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类GameEngine.GameEngine
的用法示例。
在下文中一共展示了GameEngine.cmdMode方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: main
# 需要导入模块: from GameEngine import GameEngine [as 别名]
# 或者: from GameEngine.GameEngine import cmdMode [as 别名]
def main():
playing = None
configFile = None
fullscreen = None
resolution = None
theme = None
#debug = False
difficulty = None
part = None
mode = 0
nbrplayers = 1
for opt, arg in opts:
if opt in ["--verbose", "-v"]:
Log.quiet = False
if opt in ["--config", "-c"]:
configFile = arg
if opt in ["--fullscreen", "-f"]:
fullscreen = arg
if opt in ["--resolution", "-r"]:
resolution = arg
if opt in ["--theme", "-t"]:
theme = arg
if opt in ["--song", "-s"]:
playing = arg
if opt in ["--part", "-p"]:
part = arg
if opt in ["--diff", "-d", "-l"]:
difficulty = arg
#evilynux - Multiplayer and mode selection support
if opt in ["--mode", "-m"]:
mode = int(arg)
if opt in ["--nbrplayers", "-n"]:
nbrplayers = int(arg)
# Load the configuration file.
if configFile is not None:
if configFile.lower() == "reset":
fileName = os.path.join(Resource.getWritableResourcePath(), Version.PROGRAM_UNIXSTYLE_NAME + ".ini")
os.remove(fileName)
config = Config.load(Version.PROGRAM_UNIXSTYLE_NAME + ".ini", setAsDefault = True)
else:
config = Config.load(configFile, setAsDefault = True)
else:
config = Config.load(Version.PROGRAM_UNIXSTYLE_NAME + ".ini", setAsDefault = True)
#Lysdestic - Allow support for manipulating fullscreen via CLI
if fullscreen is not None:
Config.set("video", "fullscreen", fullscreen)
#Lysdestic - Change resolution from CLI
if resolution is not None:
Config.set("video", "resolution", resolution)
#Lysdestic - Alter theme from CLI
if theme is not None:
Config.set("coffee", "themename", theme)
engine = GameEngine(config)
engine.cmdPlay = 0
# Check for a valid invocation of one-shot mode.
if playing is not None:
Log.debug('Validating song directory for one-shot mode.')
library = Config.get("game","base_library")
basefolder = os.path.join(Version.dataPath(),library,"songs",playing)
if not (os.path.exists(os.path.join(basefolder, "song.ini")) and (os.path.exists(os.path.join(basefolder, "notes.mid")) or os.path.exists(os.path.join(basefolder, "notes-unedited.mid"))) and (os.path.exists(os.path.join(basefolder, "song.ogg")) or os.path.exists(os.path.join(basefolder, "guitar.ogg")))):
Log.warn("Song directory provided ('%s') is not a valid song directory. Starting up FoFiX in standard mode." % playing)
engine.startupMessages.append(_("Song directory provided ('%s') is not a valid song directory. Starting up FoFiX in standard mode.") % playing)
playing = None
# Set up one-shot mode if the invocation is valid for it.
if playing is not None:
Log.debug('Entering one-shot mode.')
Config.set("game", "selected_library", "songs")
Config.set("game", "selected_song", playing)
engine.cmdPlay = 1
if difficulty is not None:
engine.cmdDiff = int(difficulty)
if part is not None:
engine.cmdPart = int(part)
#evilynux - Multiplayer and mode selection support
if nbrplayers == 1:
engine.cmdMode = nbrplayers, mode, 0
else:
engine.cmdMode = nbrplayers, 0, mode
encoding = Config.get("game", "encoding")
if encoding is not None:
#stump: XXX: Everything I have seen indicates that this is a
# horrible, horrible hack. Is there another way? Do we even need this?
reload(sys)
sys.setdefaultencoding(encoding)
# Play the intro video if it is present, we have the capability, and
# we are not in one-shot mode.
videoLayer = False
if videoAvailable and not engine.cmdPlay:
# TODO: Parameters to add to theme.ini:
#.........这里部分代码省略.........
示例2: provided
# 需要导入模块: from GameEngine import GameEngine [as 别名]
# 或者: from GameEngine.GameEngine import cmdMode [as 别名]
Log.warn("Song directory provided ('%s') is not a valid song directory. Starting up FoFiX in standard mode." % playing)
engine.startupMessages.append(_("Song directory provided ('%s') is not a valid song directory. Starting up FoFiX in standard mode.") % playing)
playing = None
# Set up one-shot mode if the invocation is valid for it.
if playing is not None:
Log.debug('Entering one-shot mode.')
Config.set("setlist", "selected_song", playing)
engine.cmdPlay = 1
if difficulty is not None:
engine.cmdDiff = int(difficulty)
if part is not None:
engine.cmdPart = int(part)
#evilynux - Multiplayer and mode selection support
if nbrplayers == 1:
engine.cmdMode = nbrplayers, mode, 0
else:
engine.cmdMode = nbrplayers, 0, mode
encoding = Config.get("game", "encoding")
if encoding is not None:
#stump: XXX: Everything I have seen indicates that this is a
# horrible, horrible hack. Is there another way? Do we even need this?
reload(sys)
sys.setdefaultencoding(encoding)
# Play the intro video if it is present, we have the capability, and
# we are not in one-shot mode.
videoLayer = False
if not engine.cmdPlay:
themename = Config.get("coffee", "themename")