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

button.py (4027B)


      1 #Embedded file name: C:\BuildAgent\work\20d73f1b24eed06e\eve\release\V24.01\eve\client\script\ui\shared\vgs\button.py
      2 import numbers
      3 import localization
      4 import log
      5 import uthread
      6 from carbonui import const as uiconst
      7 from eve.client.script.ui.control.eveLabel import EveHeaderMedium, EveHeaderSmall
      8 from eve.client.script.ui.plex.textures import PLEX_12_SOLID_WHITE, PLEX_20_SOLID_WHITE
      9 from eve.client.script.ui.shared.vgs.buttonCore import ButtonCore
     10 from eve.client.script.ui.shared.vgs.const import COLOR_PLEX, COLOR_ISK
     11 from eve.client.script.ui.shared.vgs.label import VgsButtonLabelMedium
     12 
     13 class VgsBuyButton(ButtonCore):
     14     default_color = COLOR_PLEX
     15     default_padding = (14, 4, 14, 4)
     16     default_labelClass = VgsButtonLabelMedium
     17 
     18 
     19 class BuyButtonAurCore(ButtonCore):
     20     default_color = COLOR_PLEX
     21     default_state = uiconst.UI_HIDDEN
     22 
     23     def ApplyAttributes(self, attributes):
     24         if attributes.get('onClick', None) is None:
     25             attributes.onClick = self.OpenOfferWindow
     26         super(BuyButtonAurCore, self).ApplyAttributes(attributes)
     27         self.offers = None
     28         self.types = attributes.get('types', None)
     29         if callable(self.types):
     30             self.types = self.types()
     31         if isinstance(self.types, numbers.Number):
     32             self.types = [self.types]
     33         if self.types is not None:
     34             uthread.new(self.FindOffersAndReveal)
     35 
     36     def FindOffersAndReveal(self):
     37         try:
     38             store = sm.GetService('vgsService').GetStore()
     39             self.offers = store.SearchOffersByTypeIDs(self.types)
     40             if self.offers:
     41                 self.AnimShow()
     42         except Exception as e:
     43             if len(e.args) >= 1 and e.args[0] == 'tokenMissing':
     44                 log.LogInfo('Failed to search the NES for offers due to missing token')
     45             else:
     46                 log.LogException('Failed to search the NES for offers')
     47 
     48     def OpenOfferWindow(self):
     49         sm.GetService('vgsService').OpenStore(typeIds=self.types)
     50 
     51 
     52 class BuyButtonAur(BuyButtonAurCore):
     53     default_contentSpacing = 4
     54     default_padding = (4, 4, 5, 3)
     55     default_iconSize = (16, 16)
     56     default_labelClass = EveHeaderMedium
     57     default_labelShadow = True
     58     default_labelTop = 1
     59     default_text = localization.GetByLabel('UI/SkillQueue/MultiTrainingOverlay/BuyNow')
     60     default_texturePath = PLEX_20_SOLID_WHITE
     61 
     62 
     63 class BuyButtonAurSmall(BuyButtonAurCore):
     64     default_contentSpacing = 3
     65     default_padding = (3, 2, 6, 1)
     66     default_iconSize = (12, 12)
     67     default_labelClass = EveHeaderSmall
     68     default_labelShadow = True
     69     default_labelTop = 0
     70     default_text = localization.GetByLabel('UI/Skins/BuyWithAur')
     71     default_texturePath = PLEX_12_SOLID_WHITE
     72 
     73 
     74 class BuyButtonIskCore(ButtonCore):
     75     default_name = 'BuyButtonIskCore'
     76     default_color = COLOR_ISK
     77 
     78     def ApplyAttributes(self, attributes):
     79         if attributes.get('onClick', None) is None:
     80             attributes.onClick = self.OpenMarketWindow
     81         super(BuyButtonIskCore, self).ApplyAttributes(attributes)
     82         self.typeID = attributes.get('typeID', None)
     83 
     84     def OpenMarketWindow(self):
     85         sm.GetService('marketutils').ShowMarketDetails(self.typeID, None)
     86 
     87 
     88 class BuyButtonIsk(BuyButtonIskCore):
     89     default_name = 'BuyButtonIsk'
     90     default_contentSpacing = 4
     91     default_padding = (4, 4, 5, 3)
     92     default_iconSize = (16, 16)
     93     default_labelClass = EveHeaderMedium
     94     default_labelShadow = True
     95     default_labelTop = 1
     96     default_text = localization.GetByLabel('UI/VirtualGoodsStore/Buttons/ViewInMarket')
     97     default_texturePath = 'res:/UI/Texture/Vgs/isk_16.png'
     98 
     99 
    100 class BuyButtonIskSmall(BuyButtonIskCore):
    101     default_name = 'BuyButtonIskSmall'
    102     default_contentSpacing = 3
    103     default_padding = (3, 2, 6, 1)
    104     default_iconSize = (12, 12)
    105     default_labelClass = EveHeaderSmall
    106     default_labelShadow = True
    107     default_labelTop = 0
    108     default_text = localization.GetByLabel('UI/Skins/BuyWithIsk')
    109     default_texturePath = 'res:/UI/Texture/classes/skins/isk_12.png'