def onResultScreenFinished(self):
     self.__currentState.deactivate()
     isVictory = self.__battleResults.type == BOOTCAMP_BATTLE_RESULT_MESSAGE.VICTORY
     if self.__lessonId == 0:
         if not isVictory:
             g_prbLoader.createBattleDispatcher()
             g_prbLoader.setEnabled(True)
             self.appLoader.showLobby()
             self.__currentState = StateInitial()
             self.enqueueBattleLesson()
         else:
             self.__currentState = StateInGarage()
     else:
         self.__currentState = StateInGarage()
     self.__currentState.activate()
 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
Exemple #3
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)
        autoStartBattle = isRelogin or BattleReplay.isPlaying()
        if not autoStartBattle:
            self.showActionWaitWindow()
            yield self.settingsCore.serverSettings.settingsCache.update()
            self.settingsCore.serverSettings.applySettings()
            self.__preferences = BootcampPreferences()
            isNewbie = False
            if ctx['isNewbie'] and not ctx['completed'] and ctx['runCount'] == 1:
                isNewbie = True
            self.__preferences.setup(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 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']
        weave(self.__weaver)
        from BootcampGarage import g_bootcampGarage
        g_bootcampGarage.initSubscriptions()
        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.__lessonId, self.__account, self.__checkpoint)
                ReloadLobbyHelper().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()
        for bankName in self.BOOTCAMP_SOUND_BANKS:
            SoundGroups.g_instance.loadSoundBank(bankName)

        self.sessionProvider.getCtx().setPlayerFullNameFormatter(_BCNameFormatter())
        return