예제 #1
0
 def _doActivate(self):
     from bootcamp.Bootcamp import g_bootcamp
     from gui.battle_results.context import RequestResultsContext
     from bootcamp.BattleResultTransition import BattleResultTransition
     from gui.shared.personality import ServicesLocator
     sessionProvider = dependency.instance(IBattleSessionProvider)
     battleResultProvider = dependency.instance(IBattleResultsService)
     battleCtx = sessionProvider.getCtx()
     if g_bootcamp.transitionFlash is not None:
         g_bootcamp.transitionFlash.close()
     g_bootcamp.transitionFlash = BattleResultTransition()
     g_bootcamp.transitionFlash.active(True)
     yield ServicesLocator.itemsCache.update(CACHE_SYNC_REASON.SHOW_GUI)
     resultType = g_bootcamp.getBattleResults().type
     if resultType == BOOTCAMP_BATTLE_RESULT_MESSAGE.FAILURE:
         g_bootcampEvents.onResultScreenFinished()
         g_bootcamp.transitionFlash.active(False)
         g_bootcamp.transitionFlash.close()
         g_bootcamp.transitionFlash = None
         return
     else:
         if battleCtx.lastArenaUniqueID:
             yield battleResultProvider.requestResults(
                 RequestResultsContext(battleCtx.lastArenaUniqueID))
             battleCtx.lastArenaUniqueID = None
         return
예제 #2
0
 def __setBattleResults(self):
     self.__isResultsSet = self.__isResultsSet or True
     g_appLoader.attachCursor(APP_NAME_SPACE.SF_LOBBY, _CTRL_FLAG.GUI_ENABLED)
     g_bootcampEvents.onResultScreenFinished += self.onResultScreenFinished
     resultType, resultReason, resultTypeStr, resultReasonStr, reusableInfo = g_bootcamp.getBattleResults()
     if not reusableInfo is not None:
         raise AssertionError
         bgImagePath = self.__getBackgroundImagePath(resultType, g_bootcamp.getLessonNum() - 1)
         self.as_resultTypeHandlerS(resultTypeStr, bgImagePath)
         if resultType == BATTLE_RESULT.VICTORY:
             battleResultsExtra = deepcopy(g_bootcamp.getBattleResultsExtra(g_bootcamp.getLessonNum() - 1))
         else:
             battleResultsExtra = {'medals': [],
              'stats': [],
              'unlocks': []}
         battleResultsStats = self.battleResults.getResultsVO(self.__arenaUniqueID)
         showPremium = g_bootcamp.getLessonNum() == g_bootcamp.getContextIntParameter('lastLessonNum') and self.bootcampController.needAwarding()
         battleResultsExtra['showRewards'] = resultType == BATTLE_RESULT.VICTORY and g_bootcamp.getLessonNum() != 1
         if showPremium:
             self.__addPremiumData(battleResultsExtra['medals'])
         battleResultsExtra['stats'] = self.getBattleStatsData(battleResultsStats)
         self.as_setBootcampDataS(battleResultsExtra)
         self.as_setDataS(self.battleResults.getResultsVO(self.__arenaUniqueID))
         self.__hasBonusInMedals = bool(battleResultsExtra.get('unlocks', None))
         xp = reusableInfo.personal.getBaseXPRecords().getRecord('xp')
         credits = reusableInfo.personal.getBaseCreditsRecords().getRecord('credits')
         self.__hasBonusInStats = xp > 0 or credits > 0
     return
 def _populate(self):
     super(BCOverlayFinalWindow, self)._populate()
     from gui.app_loader.settings import APP_NAME_SPACE
     from gui.app_loader import g_appLoader
     g_appLoader.detachCursor(APP_NAME_SPACE.SF_BATTLE)
     from bootcamp.Bootcamp import g_bootcamp
     resultType, _, resultTypeStr, _, _ = g_bootcamp.getBattleResults()
     from debug_utils_bootcamp import LOG_DEBUG_DEV_BOOTCAMP
     LOG_DEBUG_DEV_BOOTCAMP('BCOverlayFinalWindow', resultType)
     self.as_msgTypeHandlerS(resultType, resultTypeStr)
 def _doActivate(self):
     from bootcamp.Bootcamp import g_bootcamp
     yield self.itemsCache.update(CACHE_SYNC_REASON.SHOW_GUI)
     resultType = g_bootcamp.getBattleResults().type
     if resultType == BOOTCAMP_BATTLE_RESULT_MESSAGE.FAILURE:
         g_bootcampEvents.onResultScreenFinished()
         return
     else:
         battleCtx = self.sessionProvider.getCtx()
         if battleCtx.lastArenaUniqueID:
             app = self.appLoader.getApp(settings.APP_NAME_SPACE.SF_LOBBY)
             self.appLoader.getWaitingWorker().hide(
                 R.strings.waiting.exit_battle())
             if app is not None and app.initialized:
                 self.__requestBattleResults(battleCtx.lastArenaUniqueID)
             else:
                 self.__storedArenaUniqueID = battleCtx.lastArenaUniqueID
                 g_eventBus.addListener(
                     events.AppLifeCycleEvent.INITIALIZED,
                     self.__onAppInitialized, EVENT_BUS_SCOPE.GLOBAL)
             battleCtx.lastArenaUniqueID = None
             battleCtx.lastArenaBonusType = None
         return
 def _populate(self):
     super(BCOverlayFinalWindow, self)._populate()
     g_appLoader.detachCursor(app_settings.APP_NAME_SPACE.SF_BATTLE)
     battleResults = g_bootcamp.getBattleResults()
     LOG_DEBUG_DEV_BOOTCAMP('BCOverlayFinalWindow', battleResults.type)
     self.as_msgTypeHandlerS(battleResults.type, battleResults.typeStr)