本文整理汇总了Python中fsgs.platform.PlatformHandler.create方法的典型用法代码示例。如果您正苦于以下问题:Python PlatformHandler.create方法的具体用法?Python PlatformHandler.create怎么用?Python PlatformHandler.create使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类fsgs.platform.PlatformHandler
的用法示例。
在下文中一共展示了PlatformHandler.create方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: load_game_variant
# 需要导入模块: from fsgs.platform import PlatformHandler [as 别名]
# 或者: from fsgs.platform.PlatformHandler import create [as 别名]
def load_game_variant(self, variant_uuid):
# game_database = fsgs.get_game_database()
# values = game_database.get_game_values_for_uuid(variant_uuid)
from .Database import Database
database = Database.instance()
try:
database_name = database.find_game_database_for_game_variant(
variant_uuid)
except LookupError:
return False
values = self.game.set_from_variant_uuid(database_name, variant_uuid)
if not values:
return False
# print("")
# for key in sorted(values.keys()):
# print(" * {0} = {1}".format(key, values[key]))
# print("")
from fsgs.platform import PlatformHandler
platform_handler = PlatformHandler.create(self.game.platform.id)
loader = platform_handler.get_loader(self)
self.config.load(loader.load_values(values))
return True
示例2: create_context
# 需要导入模块: from fsgs.platform import PlatformHandler [as 别名]
# 或者: from fsgs.platform.PlatformHandler import create [as 别名]
def create_context(self):
item = self.items[0]
variant_uuid = item.configurations[0][0]
database_name = item.configurations[0][2]
print("\nitem:\n", item.configurations)
print("\nitem[0]:\n", item.configurations[0])
print("\n\nvariant_uuid =", variant_uuid, "\n\n")
# print("\n\ncreate_context")
# print("configurations: ", item.configurations)
# configs = sort_configurations(item.configurations)
# configs = item.configurations
# config = configs[0]
# self.context = GameContext.create_for_game(
# item.platform, item.name, config)
values = fsgs.game.set_from_variant_uuid(database_name, variant_uuid)
# print("")
# for key in sorted(values.keys()):
# print(" * {0} = {1}".format(key, values[key]))
# print("")
self.platform_handler = PlatformHandler.create(fsgs.game.platform.id)
loader = self.platform_handler.get_loader(fsgs)
fsgs.config.load(loader.load_values(values))
示例3: start
# 需要导入模块: from fsgs.platform import PlatformHandler [as 别名]
# 或者: from fsgs.platform.PlatformHandler import create [as 别名]
def start(self):
assert self.thread is None
platform_handler = PlatformHandler.create(self.fsgs.game.platform.id)
self.runner = platform_handler.get_runner(self.fsgs)
device_helper = EnumerateHelper()
device_helper.default_port_selection(self.runner.ports)
self.thread = threading.Thread(target=self._thread)
self.thread.start()
示例4: run_game
# 需要导入模块: from fsgs.platform import PlatformHandler [as 别名]
# 或者: from fsgs.platform.PlatformHandler import create [as 别名]
def run_game(self):
from fsgs.platform import PlatformHandler
platform_handler = PlatformHandler.create(self.game.platform.id)
runner = platform_handler.get_runner(self)
from fsgs.input.enumeratehelper import EnumerateHelper
device_helper = EnumerateHelper()
device_helper.default_port_selection(runner.ports)
runner.prepare()
process = runner.run()
process.wait()
runner.finish()
示例5: load_values
# 需要导入模块: from fsgs.platform import PlatformHandler [as 别名]
# 或者: from fsgs.platform.PlatformHandler import create [as 别名]
def load_values(cls, values, uuid=""):
print("loading config values", values)
platform_id = values.get("platform", "").lower()
if platform_id in ["amiga", "cdtv", "cd32"]:
value_config_loader = ValueConfigLoader(uuid=uuid)
value_config_loader.load_values(values)
config = value_config_loader.get_config()
cls.load(config)
values["__config_name"] = config.get("__config_name")
else:
print("Warning: Non-Amiga game loaded")
platform_handler = PlatformHandler.create(platform_id)
loader = platform_handler.get_loader(fsgs)
fsgs.config.load(loader.load_values(values))
cls.post_load_values(values)
示例6: load_values
# 需要导入模块: from fsgs.platform import PlatformHandler [as 别名]
# 或者: from fsgs.platform.PlatformHandler import create [as 别名]
def load_values(cls, values, uuid=""):
print("loading config values", values)
platform_id = values.get("platform", "").lower()
if platform_id in ["amiga", "cdtv", "cd32"]:
value_config_loader = ValueConfigLoader(uuid=uuid)
value_config_loader.load_values(values)
config = value_config_loader.get_config()
cls.load(config)
config_name = config.get("__config_name", "")
else:
print("Warning: Non-Amiga game loaded")
platform_handler = PlatformHandler.create(platform_id)
loader = platform_handler.get_loader(fsgs)
fsgs.config.load(loader.load_values(values))
config_name = "{0} ({1})".format(
values.get("game_name"), values.get("platform_name"))
LauncherSettings.set("config_path", "")
# print("config is", config)
# config["x_config_uuid"] = uuid
if config_name:
config_name = cls.create_fs_name(config_name)
# else:
# config_name, ext = os.path.splitext(os.path.basename(path))
if "(" in config_name:
config_base = config_name.split("(")[0].strip()
else:
config_base = config_name
# game = name
# if not Config.get("title"):
# Config.set("title", config_base)
LauncherSettings.set("config_base", config_base)
LauncherSettings.set("config_name", config_name)
LauncherSettings.set("config_xml_path", "")
# Settings.set("config_changed", "0")
cls.set("__changed", "0")