Example #1
0
 def _populate(self):
     super(NY_Break, self)._populate()
     NYSoundEvents.playSound(NYSoundEvents.ON_OPEN_BREAK)
     NYSoundEvents.setState(NYSoundEvents.STATE_ON_BREAK)
     self.resetFilters()
     self.__selectedToys.clear()
     self.__gain = 0
     self.__inDispose = False
     self.__inBreakDlg = False
     toys, total, sortedTotal = self.__updateShownToysAndSelection()
     initData = {
         'cancelBtnLabel': NY.BREAKSCREEN_CANCELBTN_LABEL,
         'backBtnDescrLabel': NY.BREAKSCREEN_BACKBTN_TO_HANGAR,
         'breakToyFragmentTitle': NY.BREAKSCREEN_BREAKTOYFRAGMENT_TITLE,
         'lackToyFragmentTitle': NY.BREAKSCREEN_LACKTOYFRAGMENT_TITLE,
         'balanceToyFragmentTitle': NY.BREAKSCREEN_BALANCETOYFRAGMENT_TITLE,
         'enoughToyFragmentTitle': NY.BREAKSCREEN_ENOUGHTOYFRAGMENT_TITLE,
         'dummyVO': self._getDummy(),
         'dummyFilterVO': self._getDummyFilter(),
         'decorationsAmountText': formatSortString(total, sortedTotal),
         'title': NY.BREAKSCREEN_TITLE
     }
     self.as_setInitDataS(initData)
     self.as_setToysS(toys)
     self.as_setBalanceToyFragmentS(
         BigWorld.wg_getIntegralFormat(
             self._newYearController.getToyFragments()))
     self.__updateSelectedToyPrice()
     self.__updateBreakButton()
     self._newYearController.onToyFragmentsChanged += self.__onToyFragmentsChanged
     self._newYearController.onToysBreak += self.__showOnToysBreakAnimation
     self._newYearController.onToysBreakFailed += self.__onToysBreakFailed
     self._newYearController.onInventoryUpdated += self.__updateToys
     self.newYearUIManager.onCraftPopoverFilterChanged += self.__updateToys
    def __onBoxesCountChanged(self, _, __, addedInfo):
        descrs = self._newYearController.boxStorage.getDescriptors()
        for bId, count in addedInfo.iteritems():
            if self.__setting == (descrs[bId].setting
                                  or ny_common.NO_SETTING_BOX_ID):
                self.__rewardsTotal += count
                NYSoundEvents.playSound(NYSoundEvents.ON_BOX_IS_GOT)

        self.__updateData()
Example #3
0
 def _dispose(self):
     self.__selectedToys.clear()
     NYSoundEvents.playSound(NYSoundEvents.ON_CLOSE_BREAK)
     self._newYearController.onToyFragmentsChanged -= self.__onToyFragmentsChanged
     self._newYearController.onToysBreak -= self.__showOnToysBreakAnimation
     self._newYearController.onToysBreakFailed -= self.__onToysBreakFailed
     self._newYearController.onInventoryUpdated -= self.__updateToys
     self.newYearUIManager.onCraftPopoverFilterChanged -= self.__updateToys
     super(NY_Break, self)._dispose()
Example #4
0
 def _populate(self):
     super(NYRewards, self)._populate()
     self.__nyLevel, self.__nyMaxLevel, _, _ = self._newYearController.getProgress(
     )
     self.__updateData()
     NYSoundEvents.playSound(NYSoundEvents.ON_OPEN_REWARDS)
     NYSoundEvents.setState(NYSoundEvents.STATE_ON_REWARDS)
     self._newYearController.onProgressChanged += self.__onNYProgressChanged
     self._newYearController.vehDiscountsStorage.onUpdated += self.__onStoragesUpdated
     self._newYearController.tankmanDiscountsStorage.onUpdated += self.__onStoragesUpdated
Example #5
0
 def onTabButtonClick(self, tabID):
     if tabID == self.__currentTabId:
         return
     self.__currentTabId = tabID
     self.as_enableBtnsS(False)
     NYSoundEvents.playSound(NYSoundEvents.ON_TAB_CLICK)
     if tabID in Mappings.ID_TO_ANCHOR:
         newState = Mappings.ID_TO_ANCHOR[tabID]
         if self._customizableObjMgr.state != newState:
             self._customizableObjMgr.switchTo(Mappings.ID_TO_ANCHOR[tabID], partial(self.__showViewById, tabID))
         else:
             self.__showViewById(tabID)
Example #6
0
 def onSlotClick(self, toyID, toyIndex):
     LOG_DEBUG('toyIndex: ' + str(toyIndex))
     toyID = int(toyID)
     placedToy = self.newYearController.getPlacedToy(self.__slotID)
     if placedToy.id == toyID and toyIndex == _PLACED_TOY_INDEX:
         toyID = INVALID_TOY_ID
     else:
         objectName = g_cache.slots[self.__slotID].object
         toyDescr = g_cache.toys.get(toyID, None)
         if toyDescr is not None and toyDescr.type == NY_CONSTANTS.SLOT_TYPE_LAMP and objectName == AnchorNames.HOUSE:
             NYSoundEvents.playSound(NYSoundEvents.ON_HOUSE_LAMP_SET)
         else:
             NYSoundEvents.playSound(NYSoundEvents.ON_TOY_HANG.get(objectName, None))
     if self.newYearController.placeToy(toyID, self.__slotID):
         self._updateToysData()
     self.destroy()
     return
Example #7
0
 def _populate(self):
     super(NYCraft, self)._populate()
     self._newYearController.clearCraftedToys()
     selectedToy = self.newYearUIManager.getSelectedCraftToy()
     self.__toyType = selectedToy.get('type', None) if selectedToy else None
     self.__toyLevel = selectedToy.get('level',
                                       None) if selectedToy else None
     self.__toyNation = selectedToy.get('nation',
                                        None) if selectedToy else None
     initData = {
         'shardsBtnLabel':
         NY.CRAFTSCREEN_BUTTONS_SHARDSBTN,
         'craftBtnLabel':
         NY.CRAFTSCREEN_BUTTONS_CRAFTBTN,
         'title':
         NY.CRAFTSCREEN_TITLE,
         'shardsDescription':
         NY.CRAFTSCREEN_DESCRIPTION,
         'toyFragmentCount':
         BigWorld.wg_getIntegralFormat(
             self._newYearController.getToyFragments()),
         'nationsBlock': {
             'title':
             NY.CRAFTSCREEN_NATIONSLIDER_TITLE,
             'selectedId':
             indexByToyNation(self.__toyNation),
             'typeId':
             NY_CONSTANTS.NATIONS_SECTION,
             'tooltips': [
                 NY.CRAFTSCREEN_NATIONSLIDER_TOOLTIP_ANY,
                 NY.CRAFTSCREEN_NATIONSLIDER_TOOLTIP_SOVIET,
                 NY.CRAFTSCREEN_NATIONSLIDER_TOOLTIP_MODERNWESTERN,
                 NY.CRAFTSCREEN_NATIONSLIDER_TOOLTIP_TRADITIONALWESTERN,
                 NY.CRAFTSCREEN_NATIONSLIDER_TOOLTIP_ASIAN
             ]
         },
         'typesBlock': {
             'title':
             NY.CRAFTSCREEN_TYPESLIDER_TITLE,
             'selectedId':
             indexByToyType(self.__toyType),
             'typeId':
             NY_CONSTANTS.TYPES_SECTION,
             'tooltips': [
                 NY.CRAFTSCREEN_TYPESLIDER_TOOLTIP_ANY,
                 NY.CRAFTSCREEN_TYPESLIDER_TOOLTIP_TOP,
                 NY.CRAFTSCREEN_TYPESLIDER_TOOLTIP_HANGING,
                 NY.CRAFTSCREEN_TYPESLIDER_TOOLTIP_GARLAND,
                 NY.CRAFTSCREEN_TYPESLIDER_TOOLTIP_GIFT,
                 NY.CRAFTSCREEN_TYPESLIDER_TOOLTIP_SNOWMAN,
                 NY.CRAFTSCREEN_TYPESLIDER_TOOLTIP_HOUSE_DECORATION,
                 NY.CRAFTSCREEN_TYPESLIDER_TOOLTIP_HOUSE_LAMP,
                 NY.CRAFTSCREEN_TYPESLIDER_TOOLTIP_STREET_GARLAND
             ]
         },
         'levelsBlock': {
             'title':
             NY.CRAFTSCREEN_LEVELSLIDER_TITLE,
             'selectedId':
             indexByToyLevel(self.__toyLevel),
             'typeId':
             NY_CONSTANTS.LEVELS_SECTION,
             'tooltips': [
                 NY.CRAFTSCREEN_LEVELSLIDER_TOOLTIP_ANY,
                 NY.CRAFTSCREEN_LEVELSLIDER_TOOLTIP_1,
                 NY.CRAFTSCREEN_LEVELSLIDER_TOOLTIP_2,
                 NY.CRAFTSCREEN_LEVELSLIDER_TOOLTIP_3,
                 NY.CRAFTSCREEN_LEVELSLIDER_TOOLTIP_4,
                 NY.CRAFTSCREEN_LEVELSLIDER_TOOLTIP_5
             ]
         },
         'carouselData':
         self.__getToysVO()
     }
     self.as_setInitDataS(initData)
     self.__updatePrice()
     NYSoundEvents.playSound(NYSoundEvents.ON_OPEN_CRAFT)
     NYSoundEvents.setState(NYSoundEvents.STATE_ON_CRAFT)
     self._newYearController.onToyFragmentsChanged += self.__onToyFragmentsChanged
     self._newYearController.onCraftedToysChanged += self.__onCraftedToysChanged
     return
Example #8
0
 def onToyFragmentButtonClick(self):
     NYSoundEvents.playSound(NYSoundEvents.ON_TOY_FRAGMENT_CLICK)
     self._switchToBreak(previewAlias=VIEW_ALIAS.LOBBY_NY_SCREEN)
Example #9
0
 def onCraftButtonClick(self):
     NYSoundEvents.playSound(NYSoundEvents.ON_CRAFT_CLICK)
     self._switchToCraft(previewAlias=VIEW_ALIAS.LOBBY_NY_SCREEN)
Example #10
0
 def onClose(self):
     NYSoundEvents.playSound(NYSoundEvents.ON_CLOSE_COLLECTION_GROUPS)
     self._switchToNYMain(previewAlias=VIEW_ALIAS.LOBBY_NY_COLLECTIONS)
Example #11
0
 def onFilterChange(self, type, index):
     oldPrice = self._newYearController.getPriceForCraft(
         self.__toyType, self.__toyNation, self.__toyLevel)
     if type == NY_CONSTANTS.TYPES_SECTION:
         NYSoundEvents.playSound(NYSoundEvents.CRAFT_SELECT_TYPE_OR_LEVEL)
         self.__toyType = toyTypeByIndex(index)
     elif type == NY_CONSTANTS.LEVELS_SECTION:
         NYSoundEvents.playSound(NYSoundEvents.CRAFT_SELECT_TYPE_OR_LEVEL)
         self.__toyLevel = toyLevelByIndex(index)
     elif type == NY_CONSTANTS.NATIONS_SECTION:
         self.__toyNation = toyNationByIndex(index)
         NYSoundEvents.playSound(NYSoundEvents.CRAFT_SELECT_SETTING)
         NYSoundEvents.setBoxSwitch(self.__toyNation)
     newPrice = self._newYearController.getPriceForCraft(
         self.__toyType, self.__toyNation, self.__toyLevel)
     fragments = self._newYearController.getToyFragments()
     if newPrice > fragments >= oldPrice:
         NYSoundEvents.playSound(NYSoundEvents.CRAFT_COST_SAME)
     if newPrice != oldPrice:
         NYSoundEvents.playSound(
             NYSoundEvents.CRAFT_COST_INCREASED
             if newPrice > oldPrice else NYSoundEvents.CRAFT_COST_DECREASED)
     NYSoundEvents.playSound(NYSoundEvents.CRAFT_MACHINE_ANIMATION)
     selectedToy = {
         'type': self.__toyType,
         'level': self.__toyLevel,
         'nation': self.__toyNation
     }
     self.newYearUIManager.setSelectedCraftToy(selectedToy)
     self.__updatePrice()
 def _populate(self):
     super(NYMissionRewardWindow, self)._populate()
     self._newYearController.boxStorage.onCountChanged += self.__onBoxesCountChanged
     self._newYearController.onStateChanged += self.__onNyStateChanged
     self.__updateData()
     NYSoundEvents.playSound(NYSoundEvents.ON_BOX_IS_GOT)
Example #13
0
 def onPlaySound(self, soundType):
     NYSoundEvents.playSound(soundType)
Example #14
0
 def _dispose(self):
     NYSoundEvents.playSound(NYSoundEvents.ON_CLOSE_REWARDS)
     self._newYearController.onProgressChanged -= self.__onNYProgressChanged
     self._newYearController.vehDiscountsStorage.onUpdated -= self.__onStoragesUpdated
     self._newYearController.tankmanDiscountsStorage.onUpdated -= self.__onStoragesUpdated
     super(NYRewards, self)._dispose()
Example #15
0
 def _dispose(self):
     NYSoundEvents.playSound(NYSoundEvents.ON_CLOSE_CRAFT)
     self._newYearController.onToyFragmentsChanged -= self.__onToyFragmentsChanged
     self._newYearController.onCraftedToysChanged -= self.__onCraftedToysChanged
     super(NYCraft, self)._dispose()
Example #16
0
 def onToyCreatePlaySound(self, level):
     NYSoundEvents.playSound(NYSoundEvents.CRAFT_TOY_CRAFTED)
     NYSoundEvents.setRTPC(NYSoundEvents.RTPC_TOYS, int(level))
Example #17
0
 def onGetShards(self):
     NYSoundEvents.playSound(NYSoundEvents.CRAFT_TO_BREAK)
     self._switchToBreak(previewAlias=VIEW_ALIAS.LOBBY_NY_CRAFT)
Example #18
0
 def onCraft(self):
     NYSoundEvents.playSound(NYSoundEvents.CRAFT_BUTTON_PRESSED_CRAFT)
     self._newYearController.craftToy(self.__toyType, self.__toyNation,
                                      self.__toyLevel)