def start(self, startCtx=None): """ Battle session is started. :param startCtx: instance of BattleSessionProviderStartCtx. :return: """ isReplayRecording = startCtx.replayCtrl.isRecording isReplayPlaying = startCtx.replayCtrl.isPlaying self.__arenaDP = ArenaDataProvider(avatar=startCtx.avatar) self.__ctx.start(self.__arenaDP) self.__ammoCtrl = consumables.createAmmoCtrl(isReplayPlaying, isReplayRecording) self.__equipmentsCtrl = consumables.createEquipmentCtrl( isReplayPlaying) self.__optDevicesCtrl = consumables.createOptDevicesCtrl() self.__vehicleStateCtrl = vehicle_state_ctrl.createCtrl( isReplayRecording) self.__arenaLoadCtrl = ArenaLoadController() self.__arenaTeamsBasesCtrl = createTeamsBasesCtrl(isReplayPlaying) self.__periodCtrl = createPeriodCtrl(isReplayPlaying, isReplayRecording) self.__respawnsCtrl = RespawnsController(startCtx) self.__repairCtrl = RepairController() self.__dynSquadFunctional = DynSquadFunctional(isReplayPlaying) self.__notificationsCtrl = NotificationsController(self.__arenaDP) self.__gasAttackCtrl = GasAttackController(startCtx) ctx = weakref.proxy(self.__ctx) self.__arenaListeners = ListenersCollection() self.__arenaListeners.addController(ctx, self.__arenaLoadCtrl) self.__arenaListeners.addController(ctx, self.__arenaTeamsBasesCtrl) self.__arenaListeners.addController(ctx, self.__periodCtrl) self.__arenaListeners.addController(ctx, self.__respawnsCtrl) self.__arenaListeners.addController(ctx, self.__dynSquadFunctional) self.__arenaListeners.start(startCtx.avatar.arena, arenaDP=self.__arenaDP) self.__feedback = createFeedbackAdaptor(isReplayPlaying) self.__feedback.start(self.__arenaDP) self.__messagesCtrl = createBattleMessagesCtrl(isReplayPlaying) self.__messagesCtrl.start(ctx) self.__drrScaleCtrl = DRRScaleController() self.__drrScaleCtrl.start(self.__messagesCtrl) self.__hitDirectionCtrl = HitDirectionController() self.__hitDirectionCtrl.start() g_playerEvents.onBattleResultsReceived += self.__pe_onBattleResultsReceived self.__chatCommands = ChatCommandsController() self.__chatCommands.start(self.__arenaDP, self.__feedback) self.__requestsCtrl = AvatarRequestsController() self.__avatarStatsCtrl = AvatarStatsController() self.__debugCtrl = DebugController() self.__debugCtrl.start() self.__viewComponentsBridge = createComponentsBridge() self.__viewComponentsBridge.registerControllers( (BATTLE_CTRL.PERIOD, self.__periodCtrl), (BATTLE_CTRL.TEAM_BASES, self.__arenaTeamsBasesCtrl), (BATTLE_CTRL.DEBUG, self.__debugCtrl), (BATTLE_CTRL.HIT_DIRECTION, self.__hitDirectionCtrl))
def start(self, startCtx = None): """ Battle session is started. :param startCtx: instance of BattleSessionProviderStartCtx. :return: """ isReplayRecording = startCtx.replayCtrl.isRecording isReplayPlaying = startCtx.replayCtrl.isPlaying self.__arenaDP = ArenaDataProvider(avatar=startCtx.avatar) self.__ctx.start(self.__arenaDP) self.__ammoCtrl = consumables.createAmmoCtrl(isReplayPlaying, isReplayRecording) self.__equipmentsCtrl = consumables.createEquipmentCtrl(isReplayPlaying) self.__optDevicesCtrl = consumables.createOptDevicesCtrl() self.__vehicleStateCtrl = vehicle_state_ctrl.createCtrl(isReplayRecording) self.__arenaLoadCtrl = ArenaLoadController() self.__arenaTeamsBasesCtrl = createTeamsBasesCtrl(isReplayPlaying) self.__periodCtrl = createPeriodCtrl(isReplayPlaying, isReplayRecording) self.__respawnsCtrl = RespawnsController(startCtx) self.__repairCtrl = RepairController() self.__dynSquadFunctional = DynSquadFunctional(isReplayPlaying) self.__notificationsCtrl = NotificationsController(self.__arenaDP) self.__gasAttackCtrl = GasAttackController(startCtx) ctx = weakref.proxy(self.__ctx) self.__arenaListeners = ListenersCollection() self.__arenaListeners.addController(ctx, self.__arenaLoadCtrl) self.__arenaListeners.addController(ctx, self.__arenaTeamsBasesCtrl) self.__arenaListeners.addController(ctx, self.__periodCtrl) self.__arenaListeners.addController(ctx, self.__respawnsCtrl) self.__arenaListeners.addController(ctx, self.__dynSquadFunctional) self.__arenaListeners.start(startCtx.avatar.arena, arenaDP=self.__arenaDP) self.__feedback = createFeedbackAdaptor(isReplayPlaying) self.__feedback.start(self.__arenaDP) self.__messagesCtrl = createBattleMessagesCtrl(isReplayPlaying) self.__messagesCtrl.start(ctx) self.__drrScaleCtrl = DRRScaleController() self.__drrScaleCtrl.start(self.__messagesCtrl) self.__hitDirectionCtrl = HitDirectionController() self.__hitDirectionCtrl.start() g_playerEvents.onBattleResultsReceived += self.__pe_onBattleResultsReceived self.__chatCommands = ChatCommandsController() self.__chatCommands.start(self.__arenaDP, self.__feedback) self.__requestsCtrl = AvatarRequestsController() self.__avatarStatsCtrl = AvatarStatsController() self.__debugCtrl = DebugController() self.__debugCtrl.start() self.__viewComponentsBridge = createComponentsBridge() self.__viewComponentsBridge.registerControllers((BATTLE_CTRL.PERIOD, self.__periodCtrl), (BATTLE_CTRL.TEAM_BASES, self.__arenaTeamsBasesCtrl), (BATTLE_CTRL.DEBUG, self.__debugCtrl), (BATTLE_CTRL.HIT_DIRECTION, self.__hitDirectionCtrl))
def start(self, setup): self.__isReplayPlaying = setup.isReplayPlaying self.__arenaVisitor = arena_visitor.createByAvatar(avatar=setup.avatar) setup.sessionProvider = weakref.proxy(self) self.__arenaDP = ArenaDataProvider(setup) self.__ctx.start(self.__arenaDP) self.__battleCache.load() self.__arenaListeners = ListenersCollection() self.__arenaListeners.start(setup) self.__viewComponentsBridge = createComponentsBridge() setup.sessionProvider = weakref.proxy(self) self.__sharedRepo = controllers.createShared(setup) self.__dynamicRepo = controllers.createDynamic(setup) self.__requestsCtrl = AvatarRequestsController() self.__invitations = invitations.createInvitationsHandler(setup) setup.clear() g_playerEvents.onBattleResultsReceived += self.__pe_onBattleResultsReceived
def start(self, setup): """ Battle session is started. :param setup: instance of BattleSessionSetup. :return: """ raise isinstance(setup, controllers.BattleSessionSetup) or AssertionError self.__isReplayPlaying = setup.isReplayPlaying self.__arenaVisitor = arena_visitor.createByAvatar(avatar=setup.avatar) setup.sessionProvider = weakref.proxy(self) self.__arenaDP = ArenaDataProvider(setup) self.__ctx.start(self.__arenaDP) self.__arenaListeners = ListenersCollection() self.__arenaListeners.start(setup) self.__viewComponentsBridge = createComponentsBridge() setup.sessionProvider = weakref.proxy(self) self.__sharedRepo = controllers.createShared(setup) self.__dynamicRepo = controllers.createDynamic(setup) self.__requestsCtrl = AvatarRequestsController() self.__invitations = invitations.createInvitationsHandler(setup) setup.clear() g_playerEvents.onBattleResultsReceived += self.__pe_onBattleResultsReceived