def _onLoading(self, *args, **kwargs):
     super(BattleAbilitiesSetupConfirm, self)._onLoading(*args, **kwargs)
     if self.__withInstall:
         self.viewModel.setBottomContentType(BuyAndExchangeBottomContentType.DEAL_PANEL)
     else:
         self.viewModel.setBottomContentType(ConfirmBottomContentType.SAVE_SLOTS_CONTENT)
     self._mainContent = AmmunitionBuyMainContent(viewModel=self.viewModel.mainContent, items=self.__items, itemsType=FittingTypes.BATTLE_ABILITY)
     self._mainContent.onLoading()
 def _onLoading(self, *args, **kwargs):
     super(BattleAbilitiesSetupConfirm, self)._onLoading(*args, **kwargs)
     if self.__withInstall:
         self.viewModel.setBottomContentType(BuyAndExchangeBottomContentType.DEAL_PANEL)
     else:
         self.viewModel.setBottomContentType(ConfirmBottomContentType.SAVE_SLOTS_CONTENT)
     self.viewModel.setVehicleType(kwargs.get('vehicleType', ''))
     self.viewModel.setApplyForAllVehiclesByType(kwargs.get('applyForAllVehiclesByType', False))
     self._mainContent = AmmunitionBuyMainContent(viewModel=self.viewModel.mainContent, items=self.__items, itemsType=FittingTypes.BATTLE_ABILITY)
     self._mainContent.onLoading()
     self.__uiEpicBattleLogger.log(EpicBattleLogActions.OPEN.value, item=EpicBattleLogKeys.ABILITIES_CONFIRM.value, parentScreen=EpicBattleLogKeys.SETUP_VIEW.value)
 def _onLoading(self, *args, **kwargs):
     super(TankSetupConfirmDialog, self)._onLoading(*args, **kwargs)
     vehicle = self._itemsCache.items.getVehicle(self.__vehicleInvID)
     self._buyContent = AmmunitionBuyBottomContent(viewModel=self.viewModel.dealPanel, vehicle=vehicle, items=self.__items)
     self._buyContent.onLoading()
     if self.__startState == BuyAndExchangeStateEnum.EXCHANGE_CONTENT:
         filterItems = REQ_CRITERIA.INVENTORY
     else:
         filterItems = None
     self._mainContent = AmmunitionBuyMainContent(viewModel=self.viewModel.mainContent, items=self.__items, vehicleInvID=self.__vehicleInvID, itemsType=self._itemsType, filterCriteria=filterItems)
     self._mainContent.onLoading()
     return
class BattleAbilitiesSetupConfirm(FullScreenDialogView):
    __uiEpicBattleLogger = EpicBattleLogger()
    __slots__ = ('__items', '_mainContent', '__rollBack', '__withInstall')

    def __init__(self, *args, **kwargs):
        settings = ViewSettings(layoutID=R.views.lobby.tanksetup.dialogs.Confirm(), model=AmmunitionBuyModel())
        settings.args = args
        settings.kwargs = kwargs
        self.__items = kwargs.pop('items', tuple())
        self._mainContent = None
        self.__rollBack = False
        self.__withInstall = kwargs.pop('withInstall', False)
        super(BattleAbilitiesSetupConfirm, self).__init__(settings)
        return

    @property
    def viewModel(self):
        return self.getViewModel()

    def _onLoading(self, *args, **kwargs):
        super(BattleAbilitiesSetupConfirm, self)._onLoading(*args, **kwargs)
        if self.__withInstall:
            self.viewModel.setBottomContentType(BuyAndExchangeBottomContentType.DEAL_PANEL)
        else:
            self.viewModel.setBottomContentType(ConfirmBottomContentType.SAVE_SLOTS_CONTENT)
        self.viewModel.setVehicleType(kwargs.get('vehicleType', ''))
        self.viewModel.setApplyForAllVehiclesByType(kwargs.get('applyForAllVehiclesByType', False))
        self._mainContent = AmmunitionBuyMainContent(viewModel=self.viewModel.mainContent, items=self.__items, itemsType=FittingTypes.BATTLE_ABILITY)
        self._mainContent.onLoading()
        self.__uiEpicBattleLogger.log(EpicBattleLogActions.OPEN.value, item=EpicBattleLogKeys.ABILITIES_CONFIRM.value, parentScreen=EpicBattleLogKeys.SETUP_VIEW.value)

    def _initialize(self, *args, **kwargs):
        super(BattleAbilitiesSetupConfirm, self)._initialize()
        if self._mainContent is not None:
            self._mainContent.initialize()
        return

    def _finalize(self):
        if self._mainContent is not None:
            self._mainContent.finalize()
        super(BattleAbilitiesSetupConfirm, self)._finalize()
        return

    def _getAdditionalData(self):
        return {'rollBack': self.__rollBack}

    def _onCancelClicked(self):
        self.__rollBack = True
        self._onCancel()
        self.__uiEpicBattleLogger.log(EpicBattleLogActions.CLICK.value, item=EpicBattleLogButtons.NOT_INSTALL.value, parentScreen=EpicBattleLogKeys.ABILITIES_CONFIRM.value)

    def _onAcceptClicked(self):
        super(BattleAbilitiesSetupConfirm, self)._onAcceptClicked()
        self.__uiEpicBattleLogger.log(EpicBattleLogActions.CLICK.value, item=EpicBattleLogButtons.INSTALL.value, parentScreen=EpicBattleLogKeys.ABILITIES_CONFIRM.value)

    def _onExitClicked(self):
        super(BattleAbilitiesSetupConfirm, self)._onExitClicked()
        self.__uiEpicBattleLogger.log(EpicBattleLogActions.CLICK.value, item=EpicBattleLogButtons.CLOSE.value, parentScreen=EpicBattleLogKeys.ABILITIES_CONFIRM.value)
class BattleAbilitiesSetupConfirm(FullScreenDialogView):
    __slots__ = ('__items', '_mainContent', '__rollBack', '__withInstall')

    def __init__(self, *args, **kwargs):
        settings = ViewSettings(layoutID=R.views.lobby.tanksetup.dialogs.Confirm(), flags=ViewFlags.TOP_WINDOW_VIEW, model=AmmunitionBuyModel())
        settings.args = args
        settings.kwargs = kwargs
        self.__items = kwargs.pop('items', tuple())
        self._mainContent = None
        self.__rollBack = False
        self.__withInstall = kwargs.pop('withInstall', False)
        super(BattleAbilitiesSetupConfirm, self).__init__(settings)
        return

    @property
    def viewModel(self):
        return self.getViewModel()

    def _onLoading(self, *args, **kwargs):
        super(BattleAbilitiesSetupConfirm, self)._onLoading(*args, **kwargs)
        if self.__withInstall:
            self.viewModel.setBottomContentType(BuyAndExchangeBottomContentType.DEAL_PANEL)
        else:
            self.viewModel.setBottomContentType(ConfirmBottomContentType.SAVE_SLOTS_CONTENT)
        self._mainContent = AmmunitionBuyMainContent(viewModel=self.viewModel.mainContent, items=self.__items, itemsType=FittingTypes.BATTLE_ABILITY)
        self._mainContent.onLoading()

    def _initialize(self, *args, **kwargs):
        super(BattleAbilitiesSetupConfirm, self)._initialize()
        if self._mainContent is not None:
            self._mainContent.initialize()
        return

    def _finalize(self):
        if self._mainContent is not None:
            self._mainContent.finalize()
        super(BattleAbilitiesSetupConfirm, self)._finalize()
        return

    def _getAdditionalData(self):
        return {'rollBack': self.__rollBack}

    def _onCancelClicked(self):
        self.__rollBack = True
        self._onCancel()
class TankSetupConfirmDialog(BuyAndExchange):
    __slots__ = ('__items', '__vehicleInvID', '__totalPrice', '_mainContent', '_buyContent', '__startState', '_itemsType')

    def __init__(self, *args, **kwargs):
        settings = ViewSettings(layoutID=R.views.lobby.tanksetup.dialogs.Confirm(), model=AmmunitionBuyModel())
        settings.args = args
        settings.kwargs = kwargs
        self.__items = kwargs.pop('items', tuple())
        vehicle = kwargs.pop('vehicle', None)
        self.__vehicleInvID = vehicle.invID if vehicle is not None else None
        self.__totalPrice = sum([ item.getBuyPrice().price for item in self.__items if not isFreeInstalling(item, vehicle) ], ZERO_MONEY)
        self._mainContent = None
        self._buyContent = None
        startState = kwargs.pop('startState', None)
        self._itemsType = None
        super(TankSetupConfirmDialog, self).__init__(settings=settings, price=self.__totalPrice, startState=startState)
        self.__startState = startState if startState is not None else self._getStartStateByStats()
        return

    @property
    def viewModel(self):
        return self.getViewModel()

    def _onLoading(self, *args, **kwargs):
        super(TankSetupConfirmDialog, self)._onLoading(*args, **kwargs)
        vehicle = self._itemsCache.items.getVehicle(self.__vehicleInvID)
        self._buyContent = AmmunitionBuyBottomContent(viewModel=self.viewModel.dealPanel, vehicle=vehicle, items=self.__items)
        self._buyContent.onLoading()
        if self.__startState == BuyAndExchangeStateEnum.EXCHANGE_CONTENT:
            filterItems = REQ_CRITERIA.INVENTORY
        else:
            filterItems = None
        self._mainContent = AmmunitionBuyMainContent(viewModel=self.viewModel.mainContent, items=self.__items, vehicleInvID=self.__vehicleInvID, itemsType=self._itemsType, filterCriteria=filterItems)
        self._mainContent.onLoading()
        return

    def _initialize(self, *args, **kwargs):
        super(TankSetupConfirmDialog, self)._initialize()
        if self._buyContent is not None:
            self._buyContent.initialize()
        if self._mainContent is not None:
            self._mainContent.initialize()
        return

    def _finalize(self):
        if self._mainContent is not None:
            self._mainContent.finalize()
        if self._buyContent is not None:
            self._buyContent.finalize()
        super(TankSetupConfirmDialog, self)._finalize()
        return

    def _onInventoryResync(self, *args, **kwargs):
        super(TankSetupConfirmDialog, self)._onInventoryResync(*args, **kwargs)
        if self._buyContent is not None:
            self._buyContent.update()
        return

    def _transitToExchange(self):
        super(TankSetupConfirmDialog, self)._transitToExchange()
        if self._mainContent is not None:
            self._mainContent.updateFilter(filterCriteria=REQ_CRITERIA.INVENTORY)
        return

    def _exchangeComplete(self, result):
        if result == ExchangeContentResult.IS_OK:
            self._onAccept()

    def _stateToContent(self):
        stateToContent = super(TankSetupConfirmDialog, self)._stateToContent()
        stateToContent[BuyAndExchangeStateEnum.BUY_NOT_REQUIRED] = ConfirmBottomContentType.SAVE_SLOTS_CONTENT
        return stateToContent

    def _buyNotRequiredAccept(self):
        self._onAccept()