示例#1
0
    def start(self, version=None, want_rgb=True, **kwargs):
        """Launch the game."""
        del want_rgb  # Unused
        if not os.path.isdir(self.data_dir):
            raise sc_process.SC2LaunchError(
                "Expected to find StarCraft II installed at '%s'. If it's not "
                "installed, do that and run it once so auto-detection works. If "
                "auto-detection failed repeatedly, then set the SC2PATH environment "
                "variable with the correct location." % self.data_dir)

        version = version or FLAGS.sc2_version
        if isinstance(version, lib.Version) and not version.data_version:
            # This is for old replays that don't have the embedded data_version.
            version = self._get_version(version.game_version)
        elif isinstance(version, six.string_types):
            version = self._get_version(version)
        elif not version:
            version = self._get_version("latest")
        if version.build_version < lib.VERSIONS["3.16.1"].build_version:
            raise sc_process.SC2LaunchError(
                "SC2 Binaries older than 3.16.1 don't support the api.")
        if FLAGS.sc2_dev_build:
            version = version._replace(build_version=0)
        exec_path = os.path.join(self.data_dir,
                                 "Versions/Base%05d" % version.build_version,
                                 self._exec_name)

        if not os.path.exists(exec_path):
            raise sc_process.SC2LaunchError("No SC2 binary found at: %s" %
                                            exec_path)

        return sc_process.StarcraftProcess(self,
                                           exec_path=exec_path,
                                           version=version,
                                           **kwargs)
示例#2
0
  def start(self, version=None, **kwargs):
    """Launch the game."""
    if not os.path.isdir(self.data_dir):
      raise sc_process.SC2LaunchError(
          "Expected to find StarCraft II installed at '%s'. If it's not "
          "installed, do that and run it once so auto-detection works. If "
          "auto-detection failed repeatedly, then set the SC2PATH environment "
          "variable with the correct location." % self.data_dir)

    version = version or FLAGS.sc2_version
    if isinstance(version, lib.Version) and not version.data_version:
      # This is for old replays that don't have the embedded data_version.
      version = _get_version(version.game_version)
    elif isinstance(version, str):
      version = _get_version(version)
    elif not version:
      versions_dir = os.path.join(self.data_dir, "Versions")
      build_version = max(int(v[4:]) for v in os.listdir(versions_dir)
                          if v.startswith("Base"))
      version = lib.Version(None, build_version, None, None)
    if version.build_version < VERSIONS["3.16.1"].build_version:
      raise sc_process.SC2LaunchError(
          "SC2 Binaries older than 3.16.1 don't support the api.")
    exec_path = os.path.join(
        self.data_dir, "Versions/Base%s" % version.build_version,
        self._exec_name)

    if not os.path.exists(exec_path):
      raise sc_process.SC2LaunchError("No SC2 binary found at: %s" % exec_path)

    return sc_process.StarcraftProcess(
        self, exec_path=exec_path, data_version=version.data_version, **kwargs)
示例#3
0
 def start(self, version=None, **kwargs):#game_version=None, data_version=None, **kwargs):
   """Launch the game process."""
   if not version:
       version = self.mostRecentVersion
   pysc2Version = lib.Version( # convert to pysc2 Version
       version.version,
       version.baseVersion,
       version.dataHash,
       version.fixedHash)
   return sc_process.StarcraftProcess(
               self,
               exec_path=self.exec_path(version.baseVersion),
               version=pysc2Version,
               **kwargs)
示例#4
0
  def start(self, want_rgb=True, **kwargs):
    """Launch the game."""
    del want_rgb  # Unused
    if not os.path.isdir(self.data_dir):
      raise sc_process.SC2LaunchError(
          "Expected to find StarCraft II installed at '%s'. If it's not "
          "installed, do that and run it once so auto-detection works. If "
          "auto-detection failed repeatedly, then set the SC2PATH environment "
          "variable with the correct location." % self.data_dir)
    exec_path = os.path.join(
        self.data_dir, "Versions/Base%05d" % self.version.build_version,
        self._exec_name)

    if not os.path.exists(exec_path):
      raise sc_process.SC2LaunchError("No SC2 binary found at: %s" % exec_path)

    return sc_process.StarcraftProcess(
        self, exec_path=exec_path, version=self.version, **kwargs)
示例#5
0
 def start(self, **kwargs):
     """Launch the game."""
     return sc_process.StarcraftProcess(self, **kwargs)