Beispiel #1
0
 def _selectVehicle(self, vehInvID):
     if vehInvID == self.__vehInvID:
         return
     Waiting.show('updateCurrentVehicle', isSingle=True, overlapsUI=False)
     self.onChangeStarted()
     self.__vehInvID = vehInvID
     AccountSettings.setFavorites(CURRENT_VEHICLE, vehInvID)
     self.refreshModel()
     self._setChangeCallback()
Beispiel #2
0
 def _selectVehicle(self, vehInvID):
     if vehInvID == self.__vehInvID:
         return
     Waiting.show('updateCurrentVehicle', isSingle=True)
     self.onChangeStarted()
     self.__vehInvID = vehInvID
     AccountSettings.setFavorites(CURRENT_VEHICLE, vehInvID)
     self.refreshModel()
     self._setChangeCallback()
Beispiel #3
0
 def moveSelectedVehicle(self, vehInvID):
     vehicles = self.getSelectedSlots()
     currentIndex = vehicles.index(vehInvID)
     if currentIndex == 0:
         newIndex = self._proxy.getConfig().maxVehiclesPerPlayer - 1
     else:
         newIndex = currentIndex - 1
     vehicles.insert(newIndex, vehicles.pop(currentIndex))
     AccountSettings.setFavorites(FALLOUT_VEHICLES, self.__vehicles)
     self._proxy.onVehiclesChanged()
 def moveSelectedVehicle(self, vehInvID):
     vehicles = self.getSelectedSlots()
     currentIndex = vehicles.index(vehInvID)
     if currentIndex == 0:
         newIndex = self._proxy.getConfig().maxVehiclesPerPlayer - 1
     else:
         newIndex = currentIndex - 1
     vehicles.insert(newIndex, vehicles.pop(currentIndex))
     AccountSettings.setFavorites(FALLOUT_VEHICLES, self.__vehicles)
     self._proxy.onVehiclesChanged()
Beispiel #5
0
 def __selectVehicle(self, vehInvID):
     if vehInvID == self.__vehInvID:
         return
     Waiting.show("updateCurrentVehicle", isSingle=True)
     self.onChangeStarted()
     self.__vehInvID = vehInvID
     AccountSettings.setFavorites(CURRENT_VEHICLE, vehInvID)
     self.refreshModel()
     if not self.__changeCallbackID:
         self.__changeCallbackID = BigWorld.callback(0.1, self.__changeDone)
Beispiel #6
0
 def __selectVehicle(self, vehInvID):
     if vehInvID == self.__vehInvID:
         return
     Waiting.show('updateCurrentVehicle', isSingle=True)
     self.onChangeStarted()
     self.__vehInvID = vehInvID
     AccountSettings.setFavorites(CURRENT_VEHICLE, vehInvID)
     self.refreshModel()
     if not self.__changeCallbackID:
         self.__changeCallbackID = BigWorld.callback(0.1, self.__changeDone)
Beispiel #7
0
    def __updateVehicles(self):
        maxVehs = self._proxy.getConfig().maxVehiclesPerPlayer
        valid = [INV_ID_CLEAR_VEHICLE] * maxVehs
        battleType = self.getBattleType()
        vehicles = self.__vehicles.get(battleType, ())
        vehGetter = g_itemsCache.items.getVehicle
        for idx, invID in enumerate(vehicles[:maxVehs]):
            invVehicle = vehGetter(invID)
            if invVehicle is not None:
                valid[idx] = invID

        if valid != vehicles:
            self.__vehicles[battleType] = valid
            AccountSettings.setFavorites(FALLOUT_VEHICLES, self.__vehicles)
Beispiel #8
0
 def addSelectedVehicle(self, vehInvID):
     canSelect, _ = self._proxy.canSelectVehicle(g_itemsCache.items.getVehicle(vehInvID))
     if not canSelect:
         LOG_ERROR('Selected vehicle in invalid!', vehInvID)
         return
     emptySlots = self._proxy.getEmptySlots()
     if not emptySlots:
         LOG_ERROR('No available slots to add new vehicle!', vehInvID)
         return
     firstEmptySlot = emptySlots[0]
     vehicles = self.getSelectedSlots()
     vehicles[firstEmptySlot] = vehInvID
     AccountSettings.setFavorites(FALLOUT_VEHICLES, self.__vehicles)
     self._proxy.onVehiclesChanged()
    def __updateVehicles(self):
        maxVehs = self._proxy.getConfig().maxVehiclesPerPlayer
        valid = [INV_ID_CLEAR_VEHICLE] * maxVehs
        battleType = self.getBattleType()
        vehicles = self.__vehicles.get(battleType, ())
        vehGetter = g_itemsCache.items.getVehicle
        for idx, invID in enumerate(vehicles[:maxVehs]):
            invVehicle = vehGetter(invID)
            if invVehicle is not None:
                valid[idx] = invID

        if valid != vehicles:
            self.__vehicles[battleType] = valid
            AccountSettings.setFavorites(FALLOUT_VEHICLES, self.__vehicles)
 def addSelectedVehicle(self, vehInvID):
     canSelect, _ = self._proxy.canSelectVehicle(
         g_itemsCache.items.getVehicle(vehInvID))
     if not canSelect:
         LOG_ERROR('Selected vehicle in invalid!', vehInvID)
         return
     emptySlots = self._proxy.getEmptySlots()
     if not emptySlots:
         LOG_ERROR('No available slots to add new vehicle!', vehInvID)
         return
     firstEmptySlot = emptySlots[0]
     vehicles = self.getSelectedSlots()
     vehicles[firstEmptySlot] = vehInvID
     AccountSettings.setFavorites(FALLOUT_VEHICLES, self.__vehicles)
     self._proxy.onVehiclesChanged()
 def _selectVehicle(self, vehInvID, callback=None, waitingOverlapsUI=False):
     if vehInvID == self.__vehInvID:
         return
     if self.item:
         self.item.stopPerksController()
     Waiting.show('updateCurrentVehicle',
                  isSingle=True,
                  overlapsUI=waitingOverlapsUI)
     self.onChangeStarted()
     self.__vehInvID = vehInvID
     if self.isOnlyForBattleRoyaleBattles():
         AccountSettings.setFavorites(ROYALE_VEHICLE, vehInvID)
     else:
         AccountSettings.setFavorites(CURRENT_VEHICLE, vehInvID)
     self.refreshModel()
     self._setChangeCallback(callback)
Beispiel #12
0
 def removeSelectedVehicle(self, vehInvID):
     vehicles = self.getSelectedSlots()
     vehicles[vehicles.index(vehInvID)] = INV_ID_CLEAR_VEHICLE
     AccountSettings.setFavorites(FALLOUT_VEHICLES, self.__vehicles)
     self._proxy.onVehiclesChanged()
 def removeSelectedVehicle(self, vehInvID):
     vehicles = self.getSelectedSlots()
     vehicles[vehicles.index(vehInvID)] = INV_ID_CLEAR_VEHICLE
     AccountSettings.setFavorites(FALLOUT_VEHICLES, self.__vehicles)
     self._proxy.onVehiclesChanged()