def __init__(self, ui = None, isEvent = False): super(TimersBar, self).__init__() arenaType = arena_info.getArenaType() self.__ui = ui self.__isTicking = False self.__state = COUNTDOWN_STATE.STOP self.__roundLength = arenaType.roundLength self.__endingSoonTime = arenaType.battleEndingSoonTime self.__endWarningIsEnabled = self.__checkEndWarningStatus() if isEvent or self.__endWarningIsEnabled: timerPath = 'eventBattleTimer.swf' _g_sound.playSound2D(_SOUNDS.STOP_TICKING) else: timerPath = 'BattleTimer.swf' self.__ui.movie.loadTimer(timerPath)
def setCurrentTimeLeft(self, totalTime): minutes, seconds = divmod(int(totalTime), ONE_MINUTE) minutesStr = '{:02d}'.format(minutes) secondsStr = '{:02d}'.format(seconds) if self.__isShown: self.__flashObject.as_setTotalTime(minutesStr, secondsStr) if totalTime == self.__appearTime and self.__warningIsValid: _g_sound.playSound2D(_SOUNDS.APPEAR) self.__flashObject.as_setTotalTime(minutesStr, secondsStr) self.__flashObject.as_setTextInfo(_ms(_WARNING_TEXT_KEY)) self.__flashObject.as_setState(True) self.__isShown = True if totalTime <= self.__appearTime - self.__duration and self.__isShown: self.__flashObject.as_setState(False) self.__isShown = False
def __handleEntityUpdated(self, event): ctx = event.ctx state = ctx['state'] if state == CameraMovementStates.FROM_OBJECT: return if self.hangarSpace.spaceInited: isMainView = ctx['entityId'] == self.hangarSpace.space.vehicleEntityId else: isMainView = True if state == CameraMovementStates.MOVING_TO_OBJECT: SoundGroupsInstance.playSound2D(self._MoveCameraEvents.MOVE_TO_MAIN if isMainView else self._MoveCameraEvents.MOVE_TO_HERO) if isMainView != self.__isMainView: self.__isMainView = isMainView WWISE.WW_setState(self._SelectedVehicleStates.STATE_NAME, self._SelectedVehicleStates.MAIN_VEHICLE if self.__isMainView else self._SelectedVehicleStates.HERO_VEHICLE) WWISE.WW_setState(self._CameraStates.STATE_NAME, self._CameraStates.MAIN_VEHICLE_AND_NOT_IN_IDLE if self.__isMainView else self._CameraStates.HERO_VEHICLE_OR_IN_IDLE)
def setTotalTime(self, level, totalTime): minutes, seconds = divmod(int(totalTime), 60) if self.__endWarningIsEnabled and self.__state == COUNTDOWN_STATE.STOP: if _BATTLE_END_SOUND_TIME < totalTime <= self.__endingSoonTime: if not self.__isTicking: _g_sound.playSound2D(_SOUNDS.COUNTDOWN_TICKING) self.__isTicking = True if totalTime == self.__endingSoonTime: _g_sound.playSound2D(_SOUNDS.BATTLE_ENDING_SOON) elif self.__isTicking: _g_sound.playSound2D(_SOUNDS.STOP_TICKING) if totalTime == _BATTLE_END_SOUND_TIME and self.__isTicking: _g_sound.playSound2D(_SOUNDS.BATTLE_END) self.__isTicking = False self.__call('timerBar.setTotalTime', [level, '{:02d}'.format(minutes), '{:02d}'.format(seconds)])