Ejemplo n.º 1
0
 def copy(match_info):
     the_copy = MatchInfo()
     the_copy.max_races = match_info.max_races
     the_copy.is_best_of = match_info.is_best_of
     the_copy.ranked = match_info.ranked
     the_copy.race_info = RaceInfo.copy(match_info.race_info)
     return the_copy
Ejemplo n.º 2
0
    def __init__(self,
                 parent,
                 race_info: RaceInfo,
                 race_config: RaceConfig = RaceConfig()):
        self.race_id = None  # After recording, the ID of the race in the DB
        self.parent = parent  # The parent managing this race. Must implement write() and process().
        self.race_info = RaceInfo.copy(race_info)
        self.racers = []  # A list of Racer

        self._status = RaceStatus.uninitialized  # The status of this race
        self._config = race_config  # The RaceConfig to use (determines some race behavior)

        self._countdown = int(0)  # The current countdown
        self._start_datetime = None  # UTC time for the beginning of the race
        self._adj_start_time = float(
            0
        )  # System clock time for the beginning of the race (modified by pause)
        self._last_pause_time = float(
            0)  # System clock time for last time we called pause()

        self._last_no_entrants_time = None  # System clock time for the last time the race had zero entrants

        self._delay_record = False  # If true, delay an extra config.FINALIZE_TIME_SEC before recording
        self._countdown_future = None  # The Future object for the race countdown
        self._finalize_future = None  # The Future object for the finalization countdown