Пример #1
0
 def _resolveLoadCtx(self, ctx=None):
     nation = ctx['nation'] if ctx is not None and 'nation' in ctx else None
     if nation is not None and nation in nations.INDICES:
         nationIdx = nations.INDICES[nation]
         SelectedNation.select(nationIdx)
     else:
         SelectedNation.byDefault()
 def __formatBlueprintBalance(self):
     bpRequester = self._itemsCache.items.blueprints
     self.__intelligenceAmount = bpRequester.getIntelligenceData()
     self.__nationalFragmentsData = bpRequester.getAllNationalFragmentsData(
     )
     selectedNation = SelectedNation.getIndex()
     nationalAmount = self.__nationalFragmentsData.get(selectedNation, 0)
     balanceStr = text_styles.main(
         backport.text(
             R.strings.blueprints.blueprintScreen.resourcesOnStorage()))
     intFragmentVO = {
         'iconPath':
         backport.image(R.images.gui.maps.icons.blueprints.fragment.small.
                        intelligence()),
         'title':
         backport.getIntegralFormat(self.__intelligenceAmount),
         'fragmentCD':
         BlueprintTypes.INTELLIGENCE_DATA
     }
     natFragmentVO = {
         'iconPath':
         backport.image(
             R.images.gui.maps.icons.blueprints.fragment.small.dyn(
                 SelectedNation.getName())()),
         'title':
         backport.getIntegralFormat(nationalAmount),
         'fragmentCD':
         getNationalFragmentCD(selectedNation)
     }
     balanceVO = {
         'balanceStr': balanceStr,
         'internationalItemVO': intFragmentVO,
         'nationalItemVO': natFragmentVO
     }
     return balanceVO
Пример #3
0
 def _resolveLoadCtx(self, ctx=None):
     nation = ctx["nation"] if ctx is not None and "nation" in ctx else None
     if nation is not None and nation in nations.INDICES:
         nationIdx = nations.INDICES[nation]
         SelectedNation.select(nationIdx)
     else:
         SelectedNation.byDefault()
Пример #4
0
 def getNationTreeData(self, nationName):
     if nationName not in nations.INDICES:
         LOG_ERROR('Nation not found', nationName)
         return {}
     nationIdx = nations.INDICES[nationName]
     SelectedNation.select(nationIdx)
     self._data.load(nationIdx, override=self._getOverride())
     return self._data.dump()
Пример #5
0
 def _resolveLoadCtx(self, ctx = None):
     rootCD = ctx['rootCD'] if ctx is not None and 'rootCD' in ctx else None
     if rootCD is None:
         if g_currentVehicle.isPresent():
             self._data.setRootCD(g_currentVehicle.item.intCD)
     else:
         self._data.setRootCD(rootCD)
     SelectedNation.select(self._data.getNationID())
Пример #6
0
 def _resolveLoadCtx(self, ctx=None):
     rootCD = ctx['rootCD'] if ctx is not None and 'rootCD' in ctx else None
     if rootCD is None:
         if g_currentVehicle.isPresent():
             self._data.setRootCD(g_currentVehicle.item.intCD)
     else:
         self._data.setRootCD(rootCD)
     SelectedNation.select(self._data.getNationID())
Пример #7
0
 def _resolveLoadCtx(self, ctx=None):
     nation = ctx[BackButtonContextKeys.NATION] if ctx is not None and BackButtonContextKeys.NATION in ctx else None
     if nation is not None and nation in nations.INDICES:
         nationIdx = nations.INDICES[nation]
         SelectedNation.select(nationIdx)
     else:
         SelectedNation.byDefault()
     return
Пример #8
0
 def getNationTreeData(self, nationName):
     if nationName not in nations.INDICES:
         LOG_ERROR('Nation not found', nationName)
         return {}
     nationIdx = nations.INDICES[nationName]
     SelectedNation.select(nationIdx)
     self._data.load(nationIdx, override=self._getOverride())
     return self._data.dump()
Пример #9
0
 def getNationTreeData(self, nationName):
     """
     Overridden method of the class _Py_ScriptHandler.getNationTreeData.
     """
     if nationName not in nations.INDICES:
         LOG_ERROR('Nation not found', nationName)
         return {}
     nationIdx = nations.INDICES[nationName]
     SelectedNation.select(nationIdx)
     self._data.load(nationIdx, override=self._getOverride())
     return self._data.dump()
Пример #10
0
 def dump(self, data):
     self.clear()
     self._cache['nodes'] = map(self._getVehicleData, data.getNodes())
     self._cache['scrollIndex'] = data._scrollIndex
     self._cache['displaySettings'].update(
         g_techTreeDP.getDisplaySettings(SelectedNation.getIndex()))
     self._cache['gridSettings'].update(
         g_techTreeDP.getGridSettings(SelectedNation.getIndex()))
     self._cache['premiumSettings'].update(
         g_techTreeDP.getPremiumGridSettings(SelectedNation.getIndex()))
     return self._cache
Пример #11
0
 def _resolveLoadCtx(self, ctx=None):
     exitEvent = None
     rootCD = None
     if ctx:
         exitEvent = ctx.get(BackButtonContextKeys.EXIT)
         rootCD = ctx.get(BackButtonContextKeys.ROOT_CD)
     self._previewAlias = exitEvent.name if exitEvent else VIEW_ALIAS.LOBBY_HANGAR
     if rootCD or g_currentVehicle.isPresent():
         self._data.setRootCD(rootCD or g_currentVehicle.item.intCD)
     SelectedNation.select(self._data.getNationID())
     return
Пример #12
0
 def getNationTreeData(self, nationName):
     """
     Overridden method of the class _Py_ScriptHandler.getNationTreeData.
     """
     if nationName not in nations.INDICES:
         LOG_ERROR('Nation not found', nationName)
         return {}
     nationIdx = nations.INDICES[nationName]
     SelectedNation.select(nationIdx)
     self._data.load(nationIdx, override=self._getOverride())
     return self._data.dump()
 def getNationTreeData(self, nationName):
     if nationName not in nations.INDICES:
         _logger.error('Nation with name %s not found', nationName)
         return {}
     self.__stopTopOfTheTreeSounds()
     nationIdx = nations.INDICES[nationName]
     SelectedNation.select(nationIdx)
     self.__updateBlueprintBalance()
     self.__setVehicleCollectorState()
     self._data.load(nationIdx)
     self.__playBlueprintPlusSound()
     return self._data.dump()
 def _resolveLoadCtx(self, ctx=None):
     exitEvent = ctx[
         BackButtonContextKeys.
         EXIT] if ctx is not None and BackButtonContextKeys.EXIT in ctx else None
     self._previewAlias = exitEvent.name if exitEvent is not None else VIEW_ALIAS.LOBBY_HANGAR
     rootCD = ctx[
         BackButtonContextKeys.
         ROOT_CD] if ctx is not None and BackButtonContextKeys.ROOT_CD in ctx else None
     if rootCD is None and g_currentVehicle.isPresent():
         self._data.setRootCD(g_currentVehicle.item.intCD)
     else:
         self._data.setRootCD(rootCD)
     SelectedNation.select(self._data.getNationID())
     return
 def getNationTreeData(self, nationName):
     if nationName not in nations.INDICES:
         _logger.error('Nation with name %s not found', nationName)
         return {}
     self.__stopTopOfTheTreeSounds()
     nationIdx = nations.INDICES[nationName]
     SelectedNation.select(nationIdx)
     if self.__uiSpamController.shouldBeHidden(TECH_TREE_EVENT):
         g_techTreeDP.techTreeEventsListener.setNationViewed(nationIdx)
     self.__updateBlueprintBalance()
     self.__setVehicleCollectorState()
     self._data.load(nationIdx)
     self.__playBlueprintPlusSound()
     return self._data.dump()
Пример #16
0
    def invalidateRestore(self, vehicles):
        for intCD in vehicles:
            _, nationID, _ = vehicles_core.parseIntCompactDescr(intCD)
            if nationID == SelectedNation.getIndex():
                return True

        return False
Пример #17
0
 def requestNationTreeData(self):
     """
     Overridden method of the class _Py_ScriptHandler.requestNationTreeData.
     """
     self.as_setAvailableNationsS(g_techTreeDP.getAvailableNations())
     self.as_setSelectedNationS(SelectedNation.getName())
     return True
 def __setVehicleCollectorState(self):
     isVehicleCollectorEnabled = self._lobbyContext.getServerSettings(
     ).isCollectorVehicleEnabled()
     self.as_setVehicleCollectorStateS(
         isVehicleCollectorEnabled
         and hasCollectibleVehicles(SelectedNation.getIndex())
         and not self.__bootcampController.isInBootcamp())
Пример #19
0
 def dump(self, data):
     self.clear()
     nodes = data._nodes
     itemGetter = data.getItem
     self._cache['nodes'] = map(lambda node: self._getVehicleData(node, itemGetter(node['id'])), nodes)
     self._cache['scrollIndex'] = data._scrollIndex
     self._cache['displaySettings'].update(g_techTreeDP.getDisplaySettings(SelectedNation.getIndex()))
     return self._cache
 def __exitEvent(self):
     return events.LoadViewEvent(VIEW_ALIAS.LOBBY_TECHTREE,
                                 ctx={
                                     BackButtonContextKeys.NATION:
                                     SelectedNation.getName(),
                                     BackButtonContextKeys.BLUEPRINT_MODE:
                                     self.__blueprintMode
                                 })
Пример #21
0
 def requestNationTreeData(self):
     """
     Overridden method of the class _Py_ScriptHandler.requestNationTreeData.
     """
     if USE_XML_DUMPING and IS_DEVELOPMENT:
         self.as_useXMLDumpingS()
     self.as_setAvailableNationsS(g_techTreeDP.getAvailableNations())
     self.as_setSelectedNationS(SelectedNation.getName())
     return True
 def onPlayHintAnimation(self, isEnabled=True):
     if isEnabled:
         g_techTreeDP.techTreeEventsListener.setNationViewed(
             SelectedNation.getIndex())
         self.soundManager.playInstantSound(
             Sounds.TOP_OF_THE_TREE_ANIMATION_ON_SOUND_ID)
     else:
         self.soundManager.playInstantSound(
             Sounds.TOP_OF_THE_TREE_ANIMATION_OFF_SOUND_ID)
Пример #23
0
 def requestNationTreeData(self):
     """
     Overridden method of the class _Py_ScriptHandler.requestNationTreeData.
     """
     if USE_XML_DUMPING and IS_DEVELOPMENT:
         self.as_useXMLDumpingS()
     self.as_setAvailableNationsS(g_techTreeDP.getAvailableNations())
     self.as_setSelectedNationS(SelectedNation.getName())
     return True
Пример #24
0
 def goToNextVehicle(self, vehCD):
     exitEvent = events.LoadViewEvent(
         VIEW_ALIAS.LOBBY_TECHTREE,
         ctx={'nation': SelectedNation.getName()})
     loadEvent = events.LoadViewEvent(VIEW_ALIAS.LOBBY_RESEARCH,
                                      ctx={
                                          'rootCD': vehCD,
                                          'exit': exitEvent
                                      })
     self.fireEvent(loadEvent, scope=EVENT_BUS_SCOPE.LOBBY)
 def redraw(self):
     self._data.load()
     self.as_setRootDataS(self._getRootData())
     self.as_setResearchItemsS(SelectedNation.getName(), self._data.dump())
Пример #26
0
 def redraw(self):
     self.as_refreshNationTreeDataS(SelectedNation.getName())
Пример #27
0
 def redraw(self):
     self._data.load()
     self.as_setRootDataS(self._getRootData())
     self.as_setResearchItemsS(SelectedNation.getName(), self._data.dump())
     self._vehPostProgressionEntryPoint.redraw(self.vehicle)
     self.__checkPostProgressionHint()
Пример #28
0
 def requestNationTreeData(self):
     if USE_XML_DUMPING and IS_DEVELOPMENT:
         self.as_useXMLDumpingS()
     self.as_setAvailableNationsS(g_techTreeDP.getAvailableNations())
     self.as_setSelectedNationS(SelectedNation.getName())
     return True
Пример #29
0
 def requestNationTreeData(self):
     if USE_XML_DUMPING and IS_DEVELOPMENT:
         self.as_useXMLDumpingS()
     self.as_setAvailableNationsS(g_techTreeDP.getAvailableNations())
     self.as_setSelectedNationS(SelectedNation.getName())
     return True
Пример #30
0
 def __handleReloadData(self, event):
     if event.key is Keys.KEY_R:
         g_techTreeDP.load(isReload=True)
         self.as_refreshNationTreeDataS(SelectedNation.getName())
Пример #31
0
 def dump(self, data):
     self.clear()
     self._cache['nodes'] = map(lambda node: self._getVehicleData(node), data.getNodes())
     self._cache['scrollIndex'] = data._scrollIndex
     self._cache['displaySettings'].update(g_techTreeDP.getDisplaySettings(SelectedNation.getIndex()))
     return self._cache
Пример #32
0
 def goToNextVehicle(self, vehCD):
     exitEvent = events.LoadViewEvent(VIEW_ALIAS.LOBBY_TECHTREE, ctx={'nation': SelectedNation.getName()})
     loadEvent = events.LoadViewEvent(VIEW_ALIAS.LOBBY_RESEARCH, ctx={'rootCD': vehCD,
      'exit': exitEvent})
     self.fireEvent(loadEvent, scope=EVENT_BUS_SCOPE.LOBBY)
Пример #33
0
 def __onUpdateStage(self):
     g_techTreeDP.setOverride(self._getOverride())
     if g_techTreeDP.load():
         self.as_refreshNationTreeDataS(SelectedNation.getName())
Пример #34
0
 def __onUpdateStage(self):
     g_techTreeDP.setOverride(self._getOverride())
     if g_techTreeDP.load():
         self.as_refreshNationTreeDataS(SelectedNation.getName())
Пример #35
0
 def redraw(self):
     self.as_refreshNationTreeDataS(SelectedNation.getName())
 def requestNationTreeData(self):
     self.as_setAvailableNationsS(g_techTreeDP.getNationsMenuDataProvider())
     self.as_setSelectedNationS(SelectedNation.getName())
     return True
Пример #37
0
 def __redrawPageAfterNationWasChanged(self):
     targetVehicleCD = iterVehTypeCDsInNationGroup(
         self._data.getRootCD()).next()
     self._data.setRootCD(targetVehicleCD)
     SelectedNation.select(self._data.getNationID())
     self.redraw()
Пример #38
0
 def __handleReloadData(self, event):
     if event.key is Keys.KEY_R:
         g_techTreeDP.load(isReload=True)
         self.as_refreshNationTreeDataS(SelectedNation.getName())
Пример #39
0
 def invalidateVehLocks(self, locks):
     if self._data.invalidateLocks(locks):
         self.as_refreshNationTreeDataS(SelectedNation.getName())
Пример #40
0
 def invalidateVehLocks(self, locks):
     if self._data.invalidateLocks(locks):
         self.as_refreshNationTreeDataS(SelectedNation.getName())