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) return self._data.dump()
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())
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() return
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() return
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()) return
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 goToNextVehicle(self, vehCD): Event = events.LoadEvent exitEvent = Event(Event.LOAD_TECHTREE, ctx={'nation': SelectedNation.getName()}) loadEvent = Event(Event.LOAD_RESEARCH, ctx={ 'rootCD': vehCD, 'exit': exitEvent }) self.fireEvent(loadEvent, scope=EVENT_BUS_SCOPE.LOBBY)
def goToNextVehicle(self, vehCD): Event = events.LoadEvent exitEvent = Event(Event.LOAD_TECHTREE, ctx={'nation': SelectedNation.getName()}) loadEvent = Event(Event.LOAD_RESEARCH, ctx={'rootCD': vehCD, 'exit': exitEvent}) self.fireEvent(loadEvent, scope=EVENT_BUS_SCOPE.LOBBY)
def invalidateVehLocks(self, locks): if self._data.invalidateLocks(locks): self.as_refreshNationTreeDataS(SelectedNation.getName())
def __handleReloadData(self, event): if event.key is Keys.KEY_R: g_techTreeDP.load(isReload=True) self.as_refreshNationTreeDataS(SelectedNation.getName())
def __stopDataCollect(self): self.as_setAvailableNationsS(g_techTreeDP.getAvailableNations()) self.as_setSelectedNationS(SelectedNation.getName())
def __shop_onResync(self): self.__requestVehiclesFromShop() self.as_refreshNationTreeDataS(SelectedNation.getName())
def __center_onIsLongDisconnected(self, isLongDisconnected): if not isLongDisconnected: self.__requestVehiclesFromShop() self.as_refreshNationTreeDataS(SelectedNation.getName())
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
def redraw(self): self.as_refreshNationTreeDataS(SelectedNation.getName())