Esempio n. 1
0
    def _startBattleSession(self):
        if self.sessionProvider.registerViewComponents(
                *self.__componentsConfig.getConfig()):
            for alias, objFactory in self.__componentsConfig.getViewsConfig():
                self.sessionProvider.addViewComponent(
                    alias, objFactory(), rule=VIEW_COMPONENT_RULE.NONE)

        else:
            _logger.warning(
                'View components can not be added into battle session provider'
            )
        ctrl = self.sessionProvider.shared.vehicleState
        if ctrl is not None:
            if ctrl.isInPostmortem:
                self._onPostMortemSwitched(noRespawnPossible=False,
                                           respawnAvailable=False)
            self._isInPostmortem = ctrl.isInPostmortem
            ctrl.onPostMortemSwitched += self._onPostMortemSwitched
            ctrl.onRespawnBaseMoving += self.__onRespawnBaseMoving
        crosshairCtrl = self.sessionProvider.shared.crosshair
        if crosshairCtrl is not None:
            crosshairCtrl.onCrosshairViewChanged += self.__onCrosshairViewChanged
            self.__onCrosshairViewChanged(crosshairCtrl.getViewID())
        self.__settingsCore.onSettingsChanged += self.__onSettingsChanged
        if not self.__settingsCore.isReady:
            self.__settingsCore.onSettingsReady += self.__onSettingsReady
        aih_global_binding.subscribe(
            aih_global_binding.BINDING_ID.CTRL_MODE_NAME,
            self._onAvatarCtrlModeChanged)
        return
Esempio n. 2
0
    def _startBattleSession(self):
        self.sessionProvider.registerViewComponents(*self.__componentsConfig.getConfig())
        for alias, objFactory in self.__componentsConfig.getViewsConfig():
            self.sessionProvider.addViewComponent(alias, objFactory(), rule=VIEW_COMPONENT_RULE.NONE)

        ctrl = self.sessionProvider.shared.vehicleState
        if ctrl is not None:
            if ctrl.isInPostmortem:
                self._onPostMortemSwitched(noRespawnPossible=False, respawnAvailable=False)
            ctrl.onPostMortemSwitched += self._onPostMortemSwitched
            ctrl.onRespawnBaseMoving += self.__onRespawnBaseMoving
        aih_global_binding.subscribe(aih_global_binding.BINDING_ID.CTRL_MODE_NAME, self._onAvatarCtrlModeChanged)
        return
Esempio n. 3
0
    def _startBattleSession(self):
        """This method is invoked when battle starts, because method _populate
        is not invoked in replay when player rewinds replay back."""
        self.sessionProvider.registerViewComponents(*self.__componentsConfig.getConfig())
        for alias, objFactory in self.__componentsConfig.getViewsConfig():
            self.sessionProvider.addViewComponent(alias, objFactory(), rule=VIEW_COMPONENT_RULE.NONE)

        ctrl = self.sessionProvider.shared.vehicleState
        if ctrl is not None:
            if ctrl.isInPostmortem:
                self.__onPostMortemSwitched()
            ctrl.onPostMortemSwitched += self.__onPostMortemSwitched
        aih_global_binding.subscribe(aih_global_binding.BINDING_ID.CTRL_MODE_NAME, self.__onAvatarCtrlModeChanged)
        return
Esempio n. 4
0
 def _startBattleSession(self):
     """This method is invoked when battle starts, because method _populate
     is not invoked in replay when player rewinds replay back."""
     self.sessionProvider.registerViewComponents(*self.__components)
     self.sessionProvider.addViewComponent(
         _ALIASES.HIT_DIRECTION,
         indicators.createDamageIndicator(),
         rule=VIEW_COMPONENT_RULE.NONE)
     ctrl = self.sessionProvider.shared.vehicleState
     if ctrl is not None:
         if ctrl.isInPostmortem:
             self.__onPostMortemSwitched()
         ctrl.onPostMortemSwitched += self.__onPostMortemSwitched
     aih_global_binding.subscribe(
         aih_global_binding.BINDING_ID.CTRL_MODE_NAME,
         self.__onAvatarCtrlModeChanged)
     return
    def startControl(self, *args):
        self.settingsCore.interfaceScale.onScaleChanged += self.__onScaleFactorChanged
        aih_global_binding.subscribe(_BINDING_ID.CTRL_MODE_NAME, self.__onAvatarControlModeChanged)
        aih_global_binding.subscribe(_BINDING_ID.AIM_OFFSET, self.__onAimOffsetChanged)
        aih_global_binding.subscribe(_BINDING_ID.CLIENT_GUN_MARKER_STATE, self.__onClientGunMarkerStateChanged)
        aih_global_binding.subscribe(_BINDING_ID.SERVER_GUN_MARKER_STATE, self.__onServerGunMarkerStateChanged)
        aih_global_binding.subscribe(_BINDING_ID.CHARGE_MARKER_STATE, self.__onChargeMarkerStateUpdated)
        aih_global_binding.subscribe(_BINDING_ID.ZOOM_FACTOR, self.__onZoomFactorChanged)
        aih_global_binding.subscribe(_BINDING_ID.STRATEGIC_CAMERA, self.__onStrategicCameraChanged)
        aih_global_binding.subscribe(_BINDING_ID.SPG_SHOTS_INDICATOR_STATE, self.__onSPGShotsIndicatorStateChanged)
        for bindingID in _GUN_MARKERS_SET_IDS:
            aih_global_binding.subscribe(bindingID, self.__onGunMarkersSetChanged)

        self.__viewID = getCrosshairViewIDByCtrlMode(self.__ctrlMode)
        self.__scale = round(self.settingsCore.interfaceScale.get(), 1)
        self.__calculateSize(notify=False)
        self.__calculatePosition(notify=False)
 def start(self):
     aih_global_binding.subscribe(BINDING_ID.AIM_OFFSET,
                                  self.__onAimOffsetChanged)
     self.__onAimOffsetChanged(self._aimOffset)
Esempio n. 7
0
    def startControl(self, *args):
        """ Starts to control."""
        self.settingsCore.interfaceScale.onScaleChanged += self.__onScaleFactorChanged
        aih_global_binding.subscribe(_BINDING_ID.CTRL_MODE_NAME,
                                     self.__onAvatarControlModeChanged)
        aih_global_binding.subscribe(_BINDING_ID.AIM_OFFSET,
                                     self.__onAimOffsetChanged)
        aih_global_binding.subscribe(_BINDING_ID.CLIENT_GUN_MARKER_STATE,
                                     self.__onClientGunMarkerStateChanged)
        aih_global_binding.subscribe(_BINDING_ID.SERVER_GUN_MARKER_STATE,
                                     self.__onServerGunMarkerStateChanged)
        aih_global_binding.subscribe(_BINDING_ID.ZOOM_FACTOR,
                                     self.__onZoomFactorChanged)
        for bindingID in _GUN_MARKERS_SET_IDS:
            aih_global_binding.subscribe(bindingID,
                                         self.__onGunMarkersSetChanged)

        self.__viewID = getCrosshairViewIDByCtrlMode(self.__ctrlMode)
        self.__scale = round(self.settingsCore.interfaceScale.get(), 1)
        self.__calculateSize(notify=False)
        self.__calculatePosition(notify=False)