示例#1
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)
     return self._data.dump()
示例#2
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())
示例#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()
     return
示例#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)
     return self._data.dump()
示例#5
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()
     return
示例#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())
     return
示例#7
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
示例#8
0
 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)
示例#9
0
 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)
示例#10
0
 def invalidateVehLocks(self, locks):
     if self._data.invalidateLocks(locks):
         self.as_refreshNationTreeDataS(SelectedNation.getName())
示例#11
0
 def __handleReloadData(self, event):
     if event.key is Keys.KEY_R:
         g_techTreeDP.load(isReload=True)
         self.as_refreshNationTreeDataS(SelectedNation.getName())
示例#12
0
 def __stopDataCollect(self):
     self.as_setAvailableNationsS(g_techTreeDP.getAvailableNations())
     self.as_setSelectedNationS(SelectedNation.getName())
示例#13
0
 def __shop_onResync(self):
     self.__requestVehiclesFromShop()
     self.as_refreshNationTreeDataS(SelectedNation.getName())
示例#14
0
 def __center_onIsLongDisconnected(self, isLongDisconnected):
     if not isLongDisconnected:
         self.__requestVehiclesFromShop()
     self.as_refreshNationTreeDataS(SelectedNation.getName())
示例#15
0
 def __stopDataCollect(self):
     self.as_setAvailableNationsS(g_techTreeDP.getAvailableNations())
     self.as_setSelectedNationS(SelectedNation.getName())
示例#16
0
文件: techtree.py 项目: webiumsk/WoT
 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
示例#17
0
 def __shop_onResync(self):
     self.__requestVehiclesFromShop()
     self.as_refreshNationTreeDataS(SelectedNation.getName())
示例#18
0
 def __center_onIsLongDisconnected(self, isLongDisconnected):
     if not isLongDisconnected:
         self.__requestVehiclesFromShop()
     self.as_refreshNationTreeDataS(SelectedNation.getName())
示例#19
0
 def __handleReloadData(self, event):
     if event.key is Keys.KEY_R:
         g_techTreeDP.load(isReload=True)
         self.as_refreshNationTreeDataS(SelectedNation.getName())
示例#20
0
 def invalidateVehLocks(self, locks):
     if self._data.invalidateLocks(locks):
         self.as_refreshNationTreeDataS(SelectedNation.getName())
示例#21
0
文件: techtree.py 项目: webiumsk/WoT
 def redraw(self):
     self.as_refreshNationTreeDataS(SelectedNation.getName())