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

vgsShipSkinBanner.py (4258B)


      1 #Embedded file name: C:\BuildAgent\work\20d73f1b24eed06e\eve\release\V24.01\eve\client\script\ui\view\aurumstore\vgsShipSkinBanner.py
      2 import logging
      3 from carbonui import Align, fontconst, uiconst
      4 from carbonui.control.carousel import Carousel
      5 from carbonui.loggers.buttonLogger import log_button_clicked
      6 from carbonui.primitives.container import Container
      7 from carbonui.primitives.sprite import Sprite
      8 from carbonui.primitives.transform import Transform
      9 from carbonui.uianimations import animations
     10 from eve.client.script.ui import eveColor
     11 from eve.client.script.ui.control.eveLabel import Label
     12 from eve.client.script.ui.cosmetics.ship.shipSKINRWindow import ShipSKINRWindow
     13 from eve.client.script.ui.shared.skins.uiutil import OPEN_SKINR_BUTTON_NES_BANNER_ANALYTIC_ID
     14 from eve.client.script.ui.view.aurumstore import vgsUiConst
     15 from eve.client.script.ui.view.aurumstore.vgsOffer import Ribbon
     16 from localization import GetByLabel
     17 CAROUSEL_TEXTURES = ['res:/UI/Texture/Vgs/SKINR/carousel/Astero.png',
     18  'res:/UI/Texture/Vgs/SKINR/carousel/Barghest.png',
     19  'res:/UI/Texture/Vgs/SKINR/carousel/Gila.png',
     20  'res:/UI/Texture/Vgs/SKINR/carousel/Ishtar.png',
     21  'res:/UI/Texture/Vgs/SKINR/carousel/Kiki.png',
     22  'res:/UI/Texture/Vgs/SKINR/carousel/Mackinaw.png',
     23  'res:/UI/Texture/Vgs/SKINR/carousel/Redeemer.png',
     24  'res:/UI/Texture/Vgs/SKINR/carousel/Vargur.png']
     25 TEXT_AREA_HEIGHT = 48
     26 logger = logging.getLogger(__name__)
     27 
     28 class ShipSkinBanner(Container):
     29     default_width = vgsUiConst.CONTENT_PADDING + vgsUiConst.OFFER_IMAGE_SIZE * 2
     30     default_height = vgsUiConst.OFFER_IMAGE_SIZE
     31     default_state = uiconst.UI_NORMAL
     32 
     33     def __init__(self, *args, **kwargs):
     34         self.analyticID = OPEN_SKINR_BUTTON_NES_BANNER_ANALYTIC_ID
     35         super(ShipSkinBanner, self).__init__(*args, **kwargs)
     36         self.construct_layout()
     37 
     38     def construct_layout(self):
     39         self.construct_description()
     40         self.construct_carousel()
     41         Ribbon(name='ribbon', parent=self, align=Align.TOPLEFT, text=GetByLabel('UI/VirtualGoodsStore/SKINR/Ribbon'), texture_path='res:/UI/Texture/Vgs/SKINR/ribbon.png', padding=(-10, -10, 0, 0))
     42         self.transform = Transform(name='transform', parent=self, align=Align.TOALL, scalingCenter=(0.5, 0.5), bgColor=(0.0, 1.0, 0.0, 0.5))
     43         Sprite(name='background', parent=self.transform, align=Align.TOALL, state=uiconst.UI_DISABLED, texturePath='res:/UI/Texture/Vgs/SKINR/background.png')
     44 
     45     def construct_description(self):
     46         self.description_container = Container(name='description_container', parent=self, align=Align.TOBOTTOM_NOPUSH, height=TEXT_AREA_HEIGHT, state=uiconst.UI_DISABLED, bgColor=vgsUiConst.OFFER_TEXT_BOX_COLOR)
     47         Label(name='description_label', parent=self.description_container, align=Align.TOTOP, text=GetByLabel('UI/VirtualGoodsStore/SKINR/Description'), fontsize=vgsUiConst.VGS_FONTSIZE_OFFER, padding=(vgsUiConst.OFFER_INFO_PADDING,
     48          2,
     49          vgsUiConst.OFFER_INFO_PADDING,
     50          -2), fontStyle=fontconst.STYLE_HEADER, uppercase=True, lineSpacing=-0.15, color=eveColor.WHITE)
     51 
     52     def construct_carousel(self):
     53         carousel = ShipSkinCarousel(name='carousel', parent=self, align=uiconst.CENTER, state=uiconst.UI_DISABLED, pos=(0,
     54          0,
     55          self.default_width,
     56          self.default_height))
     57 
     58     def OnMouseEnter(self, *args):
     59         animations.Tr2DScaleTo(self.transform, startScale=self.transform.scale, endScale=(1.02, 1.02), duration=0.2)
     60 
     61     def OnMouseExit(self, *args):
     62         animations.Tr2DScaleTo(self.transform, self.transform.scale, endScale=(1.0, 1.0), duration=0.2)
     63 
     64     def OnClick(self, *args):
     65         logger.info('Emitting analyticID: %s', self.analyticID)
     66         log_button_clicked(self)
     67         sm.GetService('vgsService').ToggleStore()
     68         ShipSKINRWindow.open_on_paragon_hub()
     69 
     70 
     71 class ShipSkinCarousel(Carousel):
     72 
     73     def __init__(self, *args, **kwargs):
     74         super(ShipSkinCarousel, self).__init__(*args, **kwargs)
     75         for texture_path in CAROUSEL_TEXTURES:
     76             Sprite(parent=self, align=uiconst.TOLEFT, texturePath=texture_path, pos=(0,
     77              0,
     78              self.width,
     79              self.height))
     80 
     81         self.InitializeButtons()
     82         self.buttonContainer.top = 48
     83         self.hide_control_buttons()