Exemplo n.º 1
0
 def __onArenaCreated(self):
     from states.StateBattlePreparing import StateBattlePreparing
     if self.__currentState:
         self.__currentState.deactivate()
     self.__currentState = StateBattlePreparing(self.__lessonId,
                                                self.__account)
     self.__currentState.activate()
Exemplo n.º 2
0
    def start(self, lessonNum, isBattleLesson):
        LOG_DEBUG_DEV_BOOTCAMP('Starting bootcamp', lessonNum, isBattleLesson)
        from gui.shared.personality import ServicesLocator
        if BattleReplay.g_replayCtrl.isPlaying:
            self.__replayController = BootcampReplayController()
            self.__replayController.init()
        g_bootcampEvents.onBattleLessonFinished += self.onBattleLessonFinished
        g_bootcampEvents.onGarageLessonFinished += self.onGarageLessonFinished
        g_bootcampEvents.onBattleLoaded += self.onBattleLoaded
        g_bootcampEvents.onResultScreenFinished += self.onResultScreenFinished
        g_bootcampEvents.onRequestBootcampFinish += self.onRequestBootcampFinish
        g_bootcampEvents.onOutroVideoStop += self.onOutroVideoStop
        g_bootcampEvents.onBootcampBecomeNonPlayer += self.onBootcampBecomeNonPlayer
        g_playerEvents.onAvatarBecomeNonPlayer += self.__onAvatarBecomeNonPlayer
        g_playerEvents.onArenaCreated += self.__onArenaCreated
        self.connectionMgr.onDisconnected += self.__cm_onDisconnected
        self.__requestBootcampFinishFromBattle = False
        ctx = self.getContext()
        isRelogin = ctx['relogin']
        LOG_DEBUG_DEV_BOOTCAMP('IsRelogin', isRelogin)
        if not BattleReplay.isPlaying():
            if not isRelogin:
                self.showActionWaitWindow()
                yield self.settingsCore.serverSettings.settingsCache.update()
                self.settingsCore.serverSettings.applySettings()
                if ctx['isNewbie'] and not ctx['completed'] and ctx[
                        'runCount'] == 1:
                    self.__preferences = BootcampPreferences()
                    self.__preferences.setup()
                self.hideActionWaitWindow()
                eula = EULADispatcher()
                yield eula.processLicense()
                eula.fini()
        self.__running = True
        self.__lessonId = lessonNum
        self.__lessonType = BOOTCAMP_LESSON.BATTLE if isBattleLesson else BOOTCAMP_LESSON.GARAGE
        if (lessonNum == 0 or not isBattleLesson) and not isRelogin:
            self.showActionWaitWindow()
            yield ServicesLocator.itemsCache.update(CACHE_SYNC_REASON.SHOW_GUI)
            self.hideActionWaitWindow()
        if self.__currentState is not None:
            self.__currentState.deactivate()
        self.__hangarSpace = ctx['hangarSpace']
        self.__hangarSpacePremium = ctx['hangarSpacePremium']
        self.__bonuses = ctx['bonuses']
        showRewards = ctx['needAwarding']
        previousLesson = self.getContextIntParameter('lastLessonNum') - 1
        if previousLesson >= 0 and previousLesson < len(
                self.__bonuses['battle']):
            self.__bonuses['battle'][previousLesson][
                'showRewards'] = showRewards
        self.__nation = ctx['nation']
        self.__nationsData = ctx['nationsData']
        self.__p['completed'] = ctx['completed']
        self.__p['needAwarding'] = ctx['needAwarding']
        from states.StateBattlePreparing import StateBattlePreparing
        if not BattleReplay.isPlaying():
            if isBattleLesson:
                self.enqueueBattleLesson()
            else:
                self.showActionWaitWindow()
                yield self.nextFrame()
                self.__currentState = StateInGarage(self.__lessonId,
                                                    self.__account,
                                                    self.__checkpoint)
                ReloadLobbyHelper().reload()
                self.hideActionWaitWindow()
                self.__currentState.activate()
        else:
            self.__currentState = StateBattlePreparing(self.__lessonId,
                                                       BigWorld.player())
            self.__currentState.activate()
        BigWorld.overloadBorders(True)
        if self.__chapter is None:
            self.__chapter = Chapter()
        if self.__gui is None:
            self.__gui = BootcampGUI()
        for bankName in self.BOOTCAMP_SOUND_BANKS:
            SoundGroups.g_instance.loadSoundBank(bankName)

        g_bootcampEvents.onBootcampStarted()
        from BootcampGarage import g_bootcampGarage
        g_bootcampGarage.initSubscriptions()
        return
 def start(self, lessonNum, isBattleLesson):
     LOG_DEBUG_DEV_BOOTCAMP('Starting bootcamp', lessonNum, isBattleLesson)
     if BattleReplay.g_replayCtrl.isPlaying:
         self.__replayController = BootcampReplayController()
         self.__replayController.init()
     g_bootcampEvents.onInterludeVideoStarted += self.onInterludeVideoStarted
     g_bootcampEvents.onBattleLessonFinished += self.onBattleLessonFinished
     g_bootcampEvents.onGarageLessonFinished += self.onGarageLessonFinished
     g_bootcampEvents.onBattleLoaded += self.onBattleLoaded
     g_bootcampEvents.onResultScreenPopulated += self.onResultScreenPopulated
     g_bootcampEvents.onResultScreenFinished += self.onResultScreenFinished
     g_bootcampEvents.onRequestBootcampFinish += self.onRequestBootcampFinish
     g_bootcampEvents.onBootcampBecomeNonPlayer += self.onBootcampBecomeNonPlayer
     g_playerEvents.onAvatarBecomeNonPlayer += self.__onAvatarBecomeNonPlayer
     g_playerEvents.onArenaCreated += self.__onArenaCreated
     self.connectionMgr.onDisconnected += self.__cm_onDisconnected
     self.__requestBootcampFinishFromBattle = False
     ctx = self.getContext()
     isRelogin = ctx['relogin']
     LOG_DEBUG_DEV_BOOTCAMP('IsRelogin', isRelogin)
     autoStartBattle = isRelogin or BattleReplay.isPlaying()
     if not autoStartBattle:
         self.showActionWaitWindow()
         yield self.settingsCore.serverSettings.settingsCache.update()
         self.settingsCore.serverSettings.applySettings()
         isNewbie = False
         if ctx['isNewbieSettings'] and not ctx['completed']:
             isNewbie = True
         self.__setupPreferences(isNewbie)
         self.hideActionWaitWindow()
         eula = EULADispatcher()
         yield eula.processLicense()
         eula.fini()
     self.__running = True
     self.__lessonId = lessonNum
     self.__lessonType = BOOTCAMP_LESSON.BATTLE if isBattleLesson else BOOTCAMP_LESSON.GARAGE
     if (lessonNum == 0 or not isBattleLesson) and not autoStartBattle:
         self.showActionWaitWindow()
         yield self.itemsCache.update(CACHE_SYNC_REASON.SHOW_GUI)
         self.__isRecruit = isCurrentUserRecruit()
         self.hideActionWaitWindow()
     if self.__currentState is not None:
         self.__currentState.deactivate()
     self.__hangarSpace = ctx['hangarSpace']
     self.__hangarSpacePremium = ctx['hangarSpacePremium']
     self.__bonuses = ctx['bonuses']
     showRewards = ctx['needAwarding']
     previousLesson = self.getContextIntParameter('lastLessonNum') - 1
     if previousLesson >= 0 and previousLesson < len(
             self.__bonuses['battle']):
         self.__bonuses['battle'][previousLesson][
             'showRewards'] = showRewards
     self.__nation = ctx['nation']
     self.__nationsData = ctx['nationsData']
     self.__p['completed'] = ctx['completed']
     self.__p['needAwarding'] = ctx['needAwarding']
     weave(self.__weaver)
     if AccountSettings.isCleanPC():
         dropNewSettingsCounters()
     g_bootcampEvents.onBootcampStarted()
     if not autoStartBattle:
         if isBattleLesson:
             g_prbLoader.createBattleDispatcher()
             g_prbLoader.setEnabled(True)
             self.enqueueBattleLesson()
         else:
             self.showActionWaitWindow()
             yield self.nextFrame()
             self.__currentState = StateInGarage()
             self.__lobbyReloader.reload()
             self.hideActionWaitWindow()
             self.__currentState.activate()
     else:
         from states.StateBattlePreparing import StateBattlePreparing
         self.__currentState = StateBattlePreparing(self.__lessonId,
                                                    BigWorld.player())
         self.__currentState.activate()
     BigWorld.overloadBorders(True)
     if self.__chapter is None:
         self.__chapter = Chapter()
     if self.__gui is None:
         self.__gui = BootcampGUI()
     WWISE.loadSoundPool(self.BOOTCAMP_SOUND_BANKS, 'Bootcamp')
     self.__combatSoundAssistant = BootcampCombatSoundAssistant()
     self.sessionProvider.getCtx().setPlayerFullNameFormatter(
         _BCNameFormatter())
     return