NovaBryan/EVE_Dump
Log | Files | 📦 下载最新源码 (.zip) | Refs | README

purchaseDetailsPanel.py (21705B)


      1 #Embedded file name: C:\BuildAgent\work\20d73f1b24eed06e\eve\release\V24.01\eve\client\script\ui\view\aurumstore\purchasepanels\purchaseDetailsPanel.py
      2 import localization
      3 import logging
      4 from carbonui import const as uiconst
      5 from carbonui.fontconst import STYLE_HEADER
      6 from carbonui.control.scrollContainer import ScrollContainer
      7 from carbonui.control.singlelineedits.singleLineEditInteger import SingleLineEditInteger
      8 from carbonui.primitives.container import Container
      9 from carbonui.primitives.containerAutoSize import ContainerAutoSize
     10 from carbonui.primitives.sprite import Sprite
     11 from carbonui.primitives.line import Line
     12 from carbonui.uianimations import animations
     13 from carbonui.uicore import uicore
     14 from carbonui.util.color import Color
     15 from eve.client.script.ui.control.eveLabel import Label
     16 from eve.client.script.ui.shared.vgs.priceTag import PriceTagLarge
     17 from plex.client.api.repository import get_repository
     18 from vgs.client.currency import OFFER_CURRENCY_PLEX, OFFER_CURRENCY_YUAN, OFFER_CURRENCY_GEM
     19 from eve.client.script.ui.view.aurumstore.vgsUiConst import STORE_PRODUCT_PANEL_PADDING
     20 from eve.client.script.ui.view.aurumstore.purchasepanels.basePurchasePanel import BasePurchasePanel
     21 from eve.client.script.ui.view.aurumstore.purchasepanels.giftInputPanel import GiftingInputPanel
     22 from eve.client.script.ui.view.aurumstore.purchasepanels.currencySelectionPanel import PurchaseCurrencySelectionPanel
     23 from eve.client.script.ui.view.aurumstore.purchasepanels.paymentPlatformSelectionPanel import PaymentPlatformSelectionPanel
     24 from eve.client.script.ui.view.aurumstore.shared.const import QUANTITY_MIN, PRODUCTSCROLL_PANEL_HEIGHT, CONTAINER_WIDTH, PROGRESS_TRANSITION_TIME, TEXT_PADDING, QUANTITY_MAX
     25 from eve.client.script.ui.view.aurumstore.shared.offerpricing import get_number_of_available_currencies, get_offer_price_and_base_price_in_currency, offer_is_available_in_currency
     26 from eve.client.script.ui.view.aurumstore.shared.util import GetSortedTokens
     27 from eve.client.script.ui.view.aurumstore.vgsDetailProduct import VgsDetailProduct
     28 from eve.client.script.ui.view.viewStateConst import ViewState
     29 from eve.common.lib.vgsConst import CATEGORYTAG_PLEX, CATEGORYTAG_GEM
     30 from fastcheckout.const import FROM_NES_PRODUCT
     31 from fastcheckout.client.purchasepanels.purchaseButton import PurchaseButton
     32 import trinity
     33 SELECTION_PANEL_HEIGHT = 70
     34 PRODUCT_SCROLL_MIN_HEIGHT = 38
     35 PRODUCT_SCROLL_MAX_HEIGHT = 76
     36 PRODUCT_SCROLL_PAD_BOT = 10
     37 BOTTOM_CONTAINER_HEIGHT = 34
     38 BUY_BUTTON_WIDTH = 160
     39 BUY_BUTTON_HEIGHT = 30
     40 PADDING_BETWEEN_BUTTONS = 10
     41 PLEX_ICON_SIZE = 32
     42 PLEX_ICON_MARGIN = 8
     43 FADEOUT_DURATION = 0.5
     44 logger = logging.getLogger(__name__)
     45 STATE_SELECTCURRENCY = 1
     46 STATE_SELECTPAYMENTPLATFORM = 2
     47 STATE_CONFIRMPAYMENTMETHOD = 3
     48 STATE_GIFTINFO = 4
     49 STATE_RECEIPT = 5
     50 
     51 class PurchaseDetailsPanel(BasePurchasePanel):
     52     default_name = 'purchaseDetailsPanel'
     53 
     54     def ApplyAttributes(self, attributes):
     55         super(PurchaseDetailsPanel, self).ApplyAttributes(attributes)
     56         self.offer = attributes.offer
     57         self.plexBalance = attributes.plexBalance
     58         self.buyOfferCallback = attributes.buyOfferCallback
     59         self.previewCallback = attributes.previewCallback
     60         self.kiringPaymentInitiationCallback = attributes.kiringPaymentInitiationCallback
     61         self.buyAurumFunc = attributes.buyAurumFunc
     62         self.offerPrice = attributes.price
     63         self.basePrice = attributes.basePrice
     64         self.backButton = attributes.backButton
     65         self.buyButton = None
     66         self.buyAsGiftButton = None
     67         self.quantity = QUANTITY_MIN
     68         self.isSwitchingPanels = False
     69         self.currencySelectionPanel = None
     70         self.selectedCurrency = None
     71         self.productElements = []
     72         self.productScroll = None
     73         self.fastCheckoutService = sm.GetService('fastCheckoutClientService')
     74         self.vgsService = sm.GetService('vgsService')
     75         self.audioService = sm.GetService('audio')
     76         self.ReconstructPanel()
     77 
     78     def ReconstructPanel(self, animate = False):
     79         if self.isSwitchingPanels:
     80             return
     81         self.purchaseState = STATE_SELECTCURRENCY
     82         self.isSwitchingPanels = True
     83         if animate:
     84             animations.FadeOut(self, duration=0.3, sleep=True)
     85         self.Flush()
     86         self.ConstructProductLayout()
     87         self.ConstructGiftInputPanel()
     88         self.ConstructCurrencySelectionPanel()
     89         self.CreatePaymentPlatformSelectionPanel()
     90         self.ConstructBottomContainer()
     91         self.RestartPanel()
     92         if animate:
     93             animations.FadeIn(self, duration=0.3)
     94         self.isSwitchingPanels = False
     95 
     96     def RestartPanel(self):
     97         self.UpdateFrontPage()
     98         self.UpdateButtons()
     99 
    100     def ConstructProductLayout(self):
    101         self.productContainer = Container(name='productContainer', parent=self, align=uiconst.TOTOP, height=PRODUCTSCROLL_PANEL_HEIGHT)
    102         contentContainer = Container(name='contentContainer', parent=self.productContainer, align=uiconst.TOALL, padding=STORE_PRODUCT_PANEL_PADDING)
    103         productQuantities = GetSortedTokens(self.offer.productQuantities)
    104         if len(productQuantities) > 0:
    105             isOnlyOneItem = len(productQuantities) <= 1
    106             isOnlyOneCurrency = get_number_of_available_currencies(self.offer) <= 1
    107             isCurrencyPlex = offer_is_available_in_currency(self.offer, OFFER_CURRENCY_PLEX)
    108             showQuantity = isOnlyOneItem
    109             showPrice = isOnlyOneItem and isOnlyOneCurrency and isCurrencyPlex
    110             self.productScroll = ScrollContainer(name='productScroll', parent=contentContainer, align=uiconst.TOTOP, height=PRODUCT_SCROLL_MIN_HEIGHT if isOnlyOneItem else PRODUCT_SCROLL_MAX_HEIGHT, padBottom=PRODUCT_SCROLL_PAD_BOT)
    111             for product in productQuantities:
    112                 Line(parent=self.productScroll, align=uiconst.TOTOP, height=1)
    113                 self.productElements.append(VgsDetailProduct(name=product.name, parent=self.productScroll, align=uiconst.TOTOP, state=uiconst.UI_NORMAL, typeID=product.typeId, quantity=product.quantity, price=self.offerPrice, isSinglePurchase=self.offer.singlePurchase, onClick=self.previewCallback, onQuantityChangeCallback=self.OnQuantityChange, showQuantity=showQuantity, showPrice=showPrice))
    114 
    115             Line(parent=self.productScroll, align=uiconst.TOTOP, height=1)
    116         priceContainer = Container(name='priceContainer', parent=contentContainer, align=uiconst.TOALL)
    117         self.priceLabelInProductContainer = PriceTagLarge(parent=priceContainer, align=uiconst.TOPRIGHT, currency=self.selectedCurrency, price=self.offerPrice, basePrice=self.basePrice, showBasePrice=False, opacity=0.0, height=BOTTOM_CONTAINER_HEIGHT, fontClass=Label, fontsize=27)
    118 
    119     def ConstructGiftInputPanel(self):
    120         self.giftInputPanel = GiftingInputPanel(parent=self, align=uiconst.TOPLEFT, opacity=0, height=PRODUCTSCROLL_PANEL_HEIGHT, width=CONTAINER_WIDTH, offer=self.offer, left=self.width)
    121 
    122     def ConstructCurrencySelectionPanel(self):
    123         self.currencySelectionPanel = PurchaseCurrencySelectionPanel(parent=self, align=uiconst.TOPLEFT, width=CONTAINER_WIDTH, height=SELECTION_PANEL_HEIGHT, top=PRODUCTSCROLL_PANEL_HEIGHT - SELECTION_PANEL_HEIGHT, padding=(30, 0, 30, 0), offer=self.offer, defaultValue=self.offer.offerPricings[0].currency, onSelect=self.OnCurrencySelectionPanel)
    124 
    125     def _UpdateGiftButtonState(self):
    126         if self.buyAsGiftButton is None:
    127             return
    128         if self.selectedCurrency == OFFER_CURRENCY_PLEX:
    129             canAffordPurchase = self.plexBalance >= self.offerPrice * self.quantity
    130             if canAffordPurchase and not self.offer.singlePurchase:
    131                 if not session.charid:
    132                     self.DisableGiftButton()
    133                 else:
    134                     self.buyAsGiftButton.Show()
    135             else:
    136                 self.buyAsGiftButton.Hide()
    137         elif self.currencySelectionPanel and self.currencySelectionPanel.GetSelectedCurrency() != OFFER_CURRENCY_PLEX:
    138             self.buyAsGiftButton.Hide()
    139 
    140     def OnCurrencySelectionPanel(self, value):
    141         self.SetSelectedCurrency(value)
    142 
    143     def UpdateFrontPage(self):
    144         numCurrencies = get_number_of_available_currencies(self.offer)
    145         if numCurrencies > 1:
    146             if self.productScroll:
    147                 self.productScroll.height = PRODUCT_SCROLL_MIN_HEIGHT
    148                 self.productContainer.height = 2 * STORE_PRODUCT_PANEL_PADDING + PRODUCT_SCROLL_MIN_HEIGHT + PRODUCT_SCROLL_PAD_BOT
    149             else:
    150                 top = (PRODUCTSCROLL_PANEL_HEIGHT - SELECTION_PANEL_HEIGHT) / 2
    151                 self.paymentPlatformSelectionPanel.top = top
    152                 self.currencySelectionPanel.top = top
    153                 self.productContainer.height = 0
    154         if numCurrencies > 1:
    155             self.currencySelectionPanel.Show()
    156         else:
    157             currency = self.offer.offerPricings[0].currency
    158             self.SetSelectedCurrency(currency)
    159             self.ShowPriceLabelInProductContainer()
    160         isSingleItem = len(self.offer.productQuantities) == 1
    161         self.quantityEditBottom.SetOpacity(0.0 if isSingleItem else 1.0)
    162 
    163     def SetSelectedCurrency(self, currency):
    164         self.selectedCurrency = currency
    165         self.UpdateOfferAndBasePrice()
    166         self.UpdateButtons()
    167 
    168     def CreatePaymentPlatformSelectionPanel(self):
    169         self.paymentPlatformSelectionPanel = PaymentPlatformSelectionPanel(parent=self, align=uiconst.TOPLEFT, height=SELECTION_PANEL_HEIGHT, top=PRODUCTSCROLL_PANEL_HEIGHT - SELECTION_PANEL_HEIGHT, padding=(30, 0, 30, 0), width=CONTAINER_WIDTH, defaultValue=settings.user.ui.Get('NESStorePaymentPlatformSelected', None))
    170 
    171     def SwitchToGiftInputPanel(self):
    172         if self.isSwitchingPanels:
    173             return
    174         self.isSwitchingPanels = True
    175         self.purchaseState = STATE_GIFTINFO
    176         self.backButton.Show()
    177         self.buyAsGiftButton.Disable()
    178         self.buyButton.Disable()
    179         self.productContainer.Disable()
    180         self.ShowPriceLabelBottom()
    181         animations.FadeOut(self.buyButton, duration=PROGRESS_TRANSITION_TIME)
    182         animations.MoveOutLeft(self.buyAsGiftButton, self.buyButton.width + PADDING_BETWEEN_BUTTONS, PROGRESS_TRANSITION_TIME, callback=lambda : self.buyButton.SetOpacity(0.0))
    183         isOnlyOneItem = len(self.offer.productQuantities) <= 1
    184         if isOnlyOneItem:
    185             self.DisableQuantityEdits()
    186         else:
    187             animations.FadeTo(self.quantityEditBottom, startVal=self.quantityEditBottom.opacity, endVal=0.3, callback=self.DisableQuantityEdits())
    188         animations.FadeOut(self.buyAsGiftButton.label, duration=PROGRESS_TRANSITION_TIME, callback=self.SwitchGiftButtonState)
    189         animations.MoveOutLeft(self.productContainer, self.width, PROGRESS_TRANSITION_TIME)
    190         animations.MoveOutLeft(self.currencySelectionPanel, self.width, PROGRESS_TRANSITION_TIME)
    191         self.giftInputPanel.OnPanelActivated()
    192         animations.MoveOutLeft(self.giftInputPanel, self.width, PROGRESS_TRANSITION_TIME, sleep=True, callback=self.CompletePanelTransition)
    193         sm.ScatterEvent('OnGiftingPanelActivated')
    194 
    195     def HideGiftingPanel(self):
    196         animations.MoveOutLeft(self.giftInputPanel, self.width, PROGRESS_TRANSITION_TIME, sleep=True, callback=lambda : self.CompletePanelTransition(self.giftInputPanel))
    197 
    198     def CompletePanelTransition(self, panel_to_hide = None):
    199         self.isSwitchingPanels = False
    200         if panel_to_hide:
    201             panel_to_hide.Hide()
    202 
    203     def SwitchGiftButtonState(self):
    204         if self.purchaseState == STATE_GIFTINFO:
    205             self.buyAsGiftButton.SetText(localization.GetByLabel('UI/VirtualGoodsStore/Buttons/BuyGift'))
    206             self.buyAsGiftButton.func = self.OnBuyAsGiftBtn
    207         else:
    208             self.buyAsGiftButton.SetText(localization.GetByLabel('UI/VirtualGoodsStore/Buttons/BuyAsGift'))
    209             self.buyAsGiftButton.func = self.SwitchToGiftInputPanel
    210         animations.FadeIn(self.buyAsGiftButton.label, duration=0.5, callback=self.buyAsGiftButton.Enable)
    211 
    212     def ConstructBottomContainer(self):
    213         bottomContainer = Container(name='bottomContainer', parent=self, align=uiconst.TOBOTTOM, height=BOTTOM_CONTAINER_HEIGHT, padding=(30, 10, 30, 30))
    214         self.priceLabelBottom = PriceTagLarge(parent=bottomContainer, align=uiconst.CENTERLEFT, currency=self.selectedCurrency, price=self.offerPrice, basePrice=self.basePrice, showBasePrice=False, opacity=0.0, height=BOTTOM_CONTAINER_HEIGHT, fontClass=Label, fontsize=27)
    215         actionsContainer = ContainerAutoSize(name='actionsContainer', parent=bottomContainer, align=uiconst.CENTERRIGHT, height=BUY_BUTTON_HEIGHT)
    216         self.buyButton = PurchaseButton(name='buyButton', parent=actionsContainer, align=uiconst.TORIGHT, width=BUY_BUTTON_WIDTH, height=BUY_BUTTON_HEIGHT)
    217         self.buyAsGiftButton = PurchaseButton(name='buyAsGiftButton', parent=actionsContainer, align=uiconst.TORIGHT, width=BUY_BUTTON_WIDTH, height=BUY_BUTTON_HEIGHT, text=localization.GetByLabel('UI/VirtualGoodsStore/Buttons/BuyAsGift'), func=self.SwitchToGiftInputPanel, left=PADDING_BETWEEN_BUTTONS)
    218         self._UpdateGiftButtonState()
    219         self.quantityEditBottom = SingleLineEditInteger(parent=actionsContainer, minValue=QUANTITY_MIN, maxValue=QUANTITY_MAX, fontsize=18, fontStyle=STYLE_HEADER, bold=True, width=56, height=24, top=0, align=uiconst.TORIGHT, left=TEXT_PADDING, bgColor=Color.GRAY7, arrowIconColor=(0.0, 0.0, 0.0, 1.0), arrowIconGlowColor=(0.2, 0.2, 0.2, 1.0), arrowIconClass=Sprite, arrowIconBlendMode=trinity.TR2_SBM_BLEND, arrowUseThemeColor=False, caretColor=(0.0, 0.0, 0.0, 0.75), selectColor=(0.0, 0.0, 0.0, 0.25), fontcolor=(0.0, 0.0, 0.0, 1.0), OnChange=self.OnQuantityChange, maxLength=2, hint=localization.GetByLabel('UI/Common/Quantity'), state=uiconst.UI_NORMAL)
    220         if self.offer.singlePurchase:
    221             self.quantityEditBottom.Disable()
    222         self.quantityEditBottom.underlay.Hide()
    223 
    224     def OnCurrencySelected(self):
    225         self.UpdateOfferAndBasePrice()
    226         self.HideCurrencySelectionPanel()
    227         if self.selectedCurrency in [OFFER_CURRENCY_PLEX, OFFER_CURRENCY_GEM]:
    228             self.purchaseState = STATE_CONFIRMPAYMENTMETHOD
    229             self.OnBuyForPLEXClick()
    230         elif self.selectedCurrency == OFFER_CURRENCY_YUAN:
    231             self.purchaseState = STATE_SELECTPAYMENTPLATFORM
    232             self.ShowPaymentPlatformSelectionPanel()
    233         self.ShowPriceLabelBottom()
    234         self.UpdateButtons()
    235         isSingleItem = len(self.offer.productQuantities) == 1
    236         self.quantityEditBottom.SetOpacity(0.0 if isSingleItem else 1.0)
    237 
    238     def UpdateOfferAndBasePrice(self):
    239         self.offerPrice, self.basePrice = get_offer_price_and_base_price_in_currency(self.offer, self.selectedCurrency)
    240         self._UpdateGiftButtonState()
    241 
    242     def ShowPriceLabelBottom(self):
    243         self.UpdatePriceLabel()
    244         self.priceLabelInProductContainer.SetOpacity(0.0)
    245         animations.FadeTo(self.priceLabelBottom, self.priceLabelBottom.opacity, 1.0, duration=0.6)
    246 
    247     def ShowPriceLabelInProductContainer(self):
    248         self.UpdatePriceLabel()
    249         self.priceLabelBottom.SetOpacity(0.0)
    250         animations.FadeTo(self.priceLabelInProductContainer, self.priceLabelInProductContainer.opacity, 1.0, duration=0.6)
    251 
    252     def ShowPaymentPlatformSelectionPanel(self):
    253         self.paymentPlatformSelectionPanel.left = 0
    254         animations.MorphScalar(self.paymentPlatformSelectionPanel, 'left', CONTAINER_WIDTH, duration=PROGRESS_TRANSITION_TIME)
    255         self.paymentPlatformSelectionPanel.opacity = 1.0
    256         self.paymentPlatformSelectionPanel.Show()
    257 
    258     def HideCurrencySelectionPanel(self):
    259         animations.MorphScalar(self.currencySelectionPanel, 'left', self.currencySelectionPanel.left, -CONTAINER_WIDTH, duration=PROGRESS_TRANSITION_TIME)
    260         animations.FadeOut(self.currencySelectionPanel, duration=PROGRESS_TRANSITION_TIME)
    261 
    262     def OnPaymentPlatformSelected(self):
    263         paymentMethod = self.paymentPlatformSelectionPanel.GetSelectedPaymentMethod()
    264         settings.user.ui.Set('NESStorePaymentPlatformSelected', paymentMethod)
    265         self.kiringPaymentInitiationCallback(paymentMethod, self.selectedCurrency, self.offerPrice, self.offer.goodsID, self.GetQuantity(), self.offer.id)
    266 
    267     def UpdateButtons(self):
    268         if self.purchaseState == STATE_SELECTPAYMENTPLATFORM:
    269             self.buyAsGiftButton.Hide()
    270             self.DisableQuantityEdits()
    271             self.buyButton.SetOpacity(1.0)
    272         self.backButton.display = self.purchaseState in (STATE_GIFTINFO, STATE_SELECTPAYMENTPLATFORM)
    273         self._UpdateGiftButtonState()
    274         func, text = self._GetButtonFuncTextAndColor()
    275         if self.buyButton:
    276             self.buyButton.func = func
    277             self.buyButton.SetText(text)
    278 
    279     def _GetButtonFuncTextAndColor(self):
    280         if self.purchaseState == STATE_SELECTCURRENCY:
    281             isPlexSelected = self.selectedCurrency == OFFER_CURRENCY_PLEX
    282             if isPlexSelected and self.plexBalance < self.offerPrice * self.quantity:
    283                 shouldUsePlex = self.fastCheckoutService.should_use_plex()
    284                 func = self.buyAurumFunc if shouldUsePlex else self._BuyAurum
    285                 text = localization.GetByLabel('UI/VirtualGoodsStore/BuyAurOnline')
    286             else:
    287                 func = self.OnCurrencySelected
    288                 if self.offerPrice == 0:
    289                     text = localization.GetByLabel('UI/FastCheckout/AurumSavingsLabel')
    290                 else:
    291                     text = localization.GetByLabel('UI/VirtualGoodsStore/OfferDetailBuyNowButton')
    292         elif self.purchaseState == STATE_SELECTPAYMENTPLATFORM:
    293             func = self.OnPaymentPlatformSelected
    294             text = localization.GetByLabel('UI/DynamicItem/Continue')
    295         else:
    296             func = None
    297             text = ''
    298         return (func, text)
    299 
    300     def DisableGiftButton(self):
    301         self.buyAsGiftButton.func = None
    302         self.buyAsGiftButton.SetOpacity(0.5)
    303         self.buyAsGiftButton.SetHint(localization.GetByLabel('UI/VirtualGoodsStore/LoginRequiredForGiftingHint'))
    304 
    305     def GetQuantityEditValue(self):
    306         if len(self.productElements) == 1:
    307             return self.productElements[0].GetQuantityEditValue()
    308         return self.quantityEditBottom.GetValue()
    309 
    310     def SetQuantityEditValue(self, quantity):
    311         self.quantityEditBottom.SetValue(quantity, docallback=False)
    312         for productElement in self.productElements:
    313             productElement.SetQuantityEditValue(quantity)
    314 
    315     def DisableQuantityEdits(self):
    316         self.quantityEditBottom.Disable()
    317         for productElement in self.productElements:
    318             productElement.DisableQuantityEdit()
    319 
    320     def OnQuantityChange(self, newQuantity):
    321         try:
    322             quantity = max(QUANTITY_MIN, min(int(newQuantity), QUANTITY_MAX))
    323         except ValueError:
    324             quantity = QUANTITY_MIN
    325 
    326         if self.quantity != quantity:
    327             self.quantity = quantity
    328             self.currencySelectionPanel.SetQuantity(self.quantity)
    329             self.UpdatePriceLabel()
    330             self.UpdateButtons()
    331             self.SetQuantityEditValue(self.quantity)
    332 
    333     def UpdatePriceLabel(self):
    334         newOfferPrice = self.offerPrice * self.quantity
    335         newOfferBasePrice = self.basePrice * self.quantity
    336         self.priceLabelBottom.UpdatePrice(newOfferPrice, newOfferBasePrice, self.selectedCurrency)
    337         self.priceLabelInProductContainer.UpdatePrice(newOfferPrice, newOfferBasePrice, self.selectedCurrency)
    338 
    339     def GetQuantity(self):
    340         return self.quantity
    341 
    342     def _BuyAurum(self):
    343         self.audioService.SendUIEvent('store_aur')
    344         if self.fastCheckoutService.is_china_funnel():
    345             uiController = self.vgsService.GetUiController()
    346             uiController.CloseOffer()
    347             uiController.view.storeContainer.SelectCategoryByCategoryTag(CATEGORYTAG_PLEX)
    348         else:
    349             sm.GetService('viewState').GetView(ViewState.VirtualGoodsStore)._LogBuyPlex('DetailButton')
    350             uicore.cmd.CmdBuyPlex(logContext=FROM_NES_PRODUCT)
    351 
    352     def _BuyGem(self):
    353         self.vgsService.GetUiController().CloseOffer()
    354         self.audioService.SendUIEvent('store_aur')
    355         self.vgsService.GetUiController().view.storeContainer.SelectCategoryByCategoryTag(CATEGORYTAG_GEM)
    356 
    357     def OnBuyForPLEXClick(self, *args):
    358         logger.debug('OnBuyClick %s' % (self.offer,))
    359         self.audioService.SendUIEvent('store_buy')
    360         self.buyButton.Disable()
    361         self.buyOfferCallback(self.offer, currency=self.selectedCurrency, quantity=self.GetQuantityEditValue())
    362 
    363     def OnBuyAsGiftBtn(self):
    364         giftingInfo = self.giftInputPanel.get_gifting_information()
    365         if not giftingInfo:
    366             return
    367         sm.ScatterEvent('OnGiftingPurchasePressed')
    368         self.buyAsGiftButton.Disable()
    369         self.audioService.SendUIEvent('store_buy')
    370         self.SetSelectedCurrency(self.currencySelectionPanel.GetSelectedCurrency())
    371         if self.selectedCurrency == OFFER_CURRENCY_YUAN:
    372             self._OnBuyAsGiftBtnYuanSelected()
    373         else:
    374             self.buyOfferCallback(self.offer, self.selectedCurrency, quantity=self.GetQuantityEditValue(), toCharacterID=giftingInfo.toCharacterID, message=giftingInfo.message)
    375 
    376     def _OnBuyAsGiftBtnYuanSelected(self):
    377         self.purchaseState = STATE_SELECTPAYMENTPLATFORM
    378         self.HideGiftingPanel()
    379         self.ShowPaymentPlatformSelectionPanel()
    380         self.buyButton.Enable()
    381         animations.FadeIn(self.buyButton, duration=PROGRESS_TRANSITION_TIME)
    382         self.UpdateButtons()
    383 
    384     def UpdateValues(self):
    385         self.plexBalance = get_repository().get_balance()
    386         self.UpdateButtons()