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

homeContentGroupPage.py (7973B)


      1 #Embedded file name: C:\BuildAgent\work\20d73f1b24eed06e\eve\release\V24.01\eve\client\script\ui\shared\agencyNew\ui\contentGroupPages\homeContentGroupPage.py
      2 import os
      3 import blue
      4 from carbonui import uiconst
      5 from carbonui.control.carousel import Carousel
      6 from carbonui.primitives.container import Container
      7 from carbonui.uianimations import animations
      8 from eve.client.script.ui.shared.agencyNew.contentGroups import contentGroupConst
      9 from eve.client.script.ui.shared.agencyNew.contentGroups.contentGroupConst import NEW_FEATURE_CONTENT_GROUP_OFFSET
     10 from eve.client.script.ui.shared.agencyNew.contentGroups.dynamicContentGroup import DynamicContentGroup
     11 from eve.client.script.ui.shared.agencyNew.ui.contentGroupCards import contentGroupCardConstants
     12 from eve.client.script.ui.shared.agencyNew.ui.contentGroupCards.horizontalContentGroupCard import HorizontalContentGroupCard
     13 from eve.client.script.ui.shared.agencyNew.ui.contentGroupCards.verticalContentGroupCard import VerticalContentGroupCard
     14 from eve.client.script.ui.shared.agencyNew.ui.contentGroupPages.baseContentGroupPage import BaseContentGroupPage
     15 from newFeatures.newFeatureNotify import GetAvailableNewFeatures
     16 PAD_VALUE = 20
     17 CARD1_WIDTH = contentGroupCardConstants.HORIZONTAL_CARD_WIDTH
     18 CARD1_HEIGHT = 98
     19 CARD2_WIDTH = 632
     20 CARD2_HEIGHT = 132
     21 CARD3_WIDTH = CARD2_WIDTH
     22 CARD3_HEIGHT = 300
     23 CARD4_WIDTH = 220
     24 CARD4_HEIGHT = CARD3_HEIGHT
     25 CARD5_WIDTH = CARD2_WIDTH - CARD4_WIDTH - PAD_VALUE
     26 CARD5_HEIGHT = CARD3_HEIGHT
     27 CARD6_WIDTH = CARD5_WIDTH
     28 CARD6_HEIGHT = (CARD3_HEIGHT - PAD_VALUE) / 2
     29 
     30 class HomeContentGroupPage(BaseContentGroupPage):
     31     default_name = 'HomeContentGroupPage'
     32     contentGroupID = contentGroupConst.contentGroupHome
     33     default_height = 460
     34     default_alignMode = uiconst.TOLEFT
     35 
     36     def ConstructLayout(self):
     37         self.leftContainer = Container(name='leftContainer', parent=self, align=uiconst.TOLEFT, width=CARD1_WIDTH)
     38         self.rightContainer = Container(name='rightContainer', parent=self, align=uiconst.TOLEFT, width=CARD2_WIDTH, padLeft=PAD_VALUE)
     39         self.topRightContainer = Container(name='topRightContainer', parent=self.rightContainer, align=uiconst.TOTOP, height=CARD3_HEIGHT)
     40         self.bottomRightContainer = Container(name='bottomRightContainer', parent=self.rightContainer, align=uiconst.TOTOP, height=CARD2_HEIGHT, padTop=PAD_VALUE)
     41 
     42     def ConstructContentGroupCards(self):
     43         for contentGroupID in (contentGroupConst.contentGroupMissions,
     44          contentGroupConst.contentGroupEncounters,
     45          contentGroupConst.contentGroupExploration,
     46          contentGroupConst.contentGroupResourceHarvesting):
     47             self._ConstructHomeContentGroupCard(HorizontalHomeContentGroupCard, contentGroupID, self.leftContainer)
     48 
     49         self._ConstructHomeContentGroupCard(VerticalHomeContentGroupCard, contentGroupConst.contentGroupHelp, self.bottomRightContainer, name='HelpSectionCard')
     50         self.carousel = Carousel(parent=self.topRightContainer, align=uiconst.TOTOP, height=CARD3_HEIGHT, interval=8, scrollSpeed=1.0)
     51         self.ConstructDynamicContentGroupCards()
     52         self._ConstructHomeContentGroupCard(VerticalHomeContentGroupCard, contentGroupConst.contentGroupHomefrontSites, self.carousel, name='HomefrontCarouselCard', align=uiconst.TOLEFT, padBottom=0, texturePath='res:/UI/Texture/Classes/Agency/navigationCards/carousel_homefront_operations.png')
     53         self._ConstructHomeContentGroupCard(VerticalHomeContentGroupCard, contentGroupConst.contentGroupMissionAgentsHeraldry, self.carousel, name='HeraldryCarouselCard', align=uiconst.TOLEFT, padBottom=0, texturePath='res:/UI/Texture/Classes/Agency/navigationCards/carousel_AgentsHeraldry.png')
     54         self._ConstructHomeContentGroupCard(VerticalHomeContentGroupCard, contentGroupConst.contentGroupCorp, self.carousel, name='CorpCarouselCard', align=uiconst.TOLEFT, padBottom=0)
     55         self.carousel.InitializeButtons()
     56 
     57     def _ConstructHomeContentGroupCard(self, cls, contentGroupID, parent, name = None, contentGroup = None, align = uiconst.TOTOP, padBottom = PAD_VALUE, texturePath = None):
     58         if not contentGroup:
     59             contentGroup = self.contentGroup.GetContentGroup(contentGroupID)
     60         cardContainer = cls(name=name if name else cls.default_name, parent=parent, contentGroup=contentGroup, contentGroupID=contentGroupID, align=align, padBottom=padBottom, texturePath=texturePath)
     61         self.cards.append(cardContainer)
     62 
     63     def ConstructDynamicContentGroupCards(self):
     64         featuresToHighlight = [ x for x in GetAvailableNewFeatures() if x.GetCallToActionMethod() and x.availableToAgency ]
     65         for feature in featuresToHighlight:
     66             contentGroupID = NEW_FEATURE_CONTENT_GROUP_OFFSET + feature.featureID
     67 
     68             def GetCallToActionCmd(f):
     69                 if f.GetCallToActionMethod():
     70                     return f.ExecuteCallToAction
     71 
     72             texturePath = feature.GetAgencyTexturePath()
     73             dynamicGroup = DynamicContentGroup(contentGroupID, groupName=feature.GetName(), groupDesc=feature.GetDescription(), texturePath=texturePath, callback=GetCallToActionCmd(feature), opensInAgency=feature.CallToActionOpensInAgency())
     74             self._ConstructHomeContentGroupCard(VerticalHomeContentGroupCard, contentGroupID, self.carousel, contentGroup=dynamicGroup, align=uiconst.TOLEFT, padBottom=0)
     75 
     76 
     77 class HorizontalHomeContentGroupCard(HorizontalContentGroupCard):
     78     default_name = 'HorizontalHomeContentGroupCard'
     79     default_width = CARD1_WIDTH
     80     default_height = CARD1_HEIGHT
     81     descriptionWidth = 170
     82 
     83     def ConstructDescriptionCont(self):
     84         super(HorizontalHomeContentGroupCard, self).ConstructDescriptionCont()
     85         self.descriptionCont.opacity = 0.0
     86         self.descriptionBG.opacity = 0.0
     87 
     88     def OnMouseEnter(self, *args):
     89         super(HorizontalHomeContentGroupCard, self).OnMouseEnter(*args)
     90         animations.FadeTo(self.descriptionCont, self.descriptionCont.opacity, 1.0, duration=0.3)
     91         animations.FadeTo(self.descriptionBG, self.descriptionBG.opacity, 0.5, duration=0.3)
     92 
     93     def OnMouseExit(self, *args):
     94         super(HorizontalHomeContentGroupCard, self).OnMouseExit(*args)
     95         animations.FadeTo(self.descriptionCont, self.descriptionCont.opacity, 0.0, duration=0.2)
     96         animations.FadeTo(self.descriptionBG, self.descriptionBG.opacity, 0.0, duration=0.2)
     97 
     98 
     99 class VerticalHomeContentGroupCard(VerticalContentGroupCard):
    100     default_name = 'VerticalHomeContentGroupCard'
    101     default_width = CARD2_WIDTH
    102     default_height = CARD2_HEIGHT
    103     descriptionHeight = 60
    104 
    105     def ConstructDescriptionCont(self):
    106         super(VerticalHomeContentGroupCard, self).ConstructDescriptionCont()
    107         self.descriptionCont.opacity = 0.0
    108         self.descriptionBG.opacity = 0.0
    109 
    110     def OnMouseEnter(self, *args):
    111         super(VerticalHomeContentGroupCard, self).OnMouseEnter(*args)
    112         animations.FadeTo(self.descriptionCont, self.descriptionCont.opacity, 1.0, duration=0.3)
    113         animations.FadeTo(self.descriptionBG, self.descriptionBG.opacity, 0.5, duration=0.3)
    114 
    115     def OnMouseExit(self, *args):
    116         super(VerticalHomeContentGroupCard, self).OnMouseExit(*args)
    117         animations.FadeTo(self.descriptionCont, self.descriptionCont.opacity, 0.0, duration=0.2)
    118         animations.FadeTo(self.descriptionBG, self.descriptionBG.opacity, 0.0, duration=0.2)
    119 
    120 
    121 class ContentGroupCard3(VerticalHomeContentGroupCard):
    122     default_width = CARD3_WIDTH
    123     default_height = CARD3_HEIGHT
    124     bgScalingCenter = (0.5, 0.2)
    125 
    126 
    127 class ContentGroupCard4(VerticalHomeContentGroupCard):
    128     default_width = CARD4_WIDTH
    129     default_height = CARD4_HEIGHT
    130     bgScalingCenter = (0.5, 0.5)
    131 
    132 
    133 class ContentGroupCard5(VerticalHomeContentGroupCard):
    134     default_width = CARD5_WIDTH
    135     default_height = CARD5_HEIGHT
    136     bgScalingCenter = (0.5, 0.2)
    137 
    138 
    139 class ContentGroupCard6(HorizontalHomeContentGroupCard):
    140     default_width = CARD6_WIDTH
    141     default_height = CARD6_HEIGHT
    142     bgScalingCenter = (0.5, 0.2)