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

surveyBanner.py (1747B)


      1 #Embedded file name: C:\BuildAgent\work\20d73f1b24eed06e\eve\release\V24.01\eve\client\script\ui\login\charSelection\surveyBanner.py
      2 from carbonui.primitives.container import Container
      3 import carbonui.const as uiconst
      4 from carbonui.primitives.sprite import Sprite
      5 from carbonui.uianimations import animations
      6 from surveys import GetSurveyByID
      7 from carbonui.uicore import uicore
      8 FEATURE_BAR_INNER_HEIGHT = 90
      9 BANNER_WIDTH = 550
     10 IDLE_OPACITY = 0.8
     11 DOWN_OPACITY = 1.2
     12 
     13 class SurveyBanner(Container):
     14     default_state = uiconst.UI_NORMAL
     15     default_opacity = IDLE_OPACITY
     16 
     17     def ApplyAttributes(self, attributes):
     18         Container.ApplyAttributes(self, attributes)
     19         self.surveyID = attributes.surveyID
     20         survey = GetSurveyByID(self.surveyID)
     21         self.bannerSprite = Sprite(name='bannerSprite', parent=self, align=uiconst.CENTER, pos=(0,
     22          0,
     23          BANNER_WIDTH,
     24          FEATURE_BAR_INNER_HEIGHT), state=uiconst.UI_DISABLED, texturePath=survey.GetBannerTexturePath())
     25 
     26     def OnClick(self):
     27         sm.GetService('survey').AccessSurvey()
     28 
     29     def OnMouseEnter(self, *args):
     30         animations.FadeTo(self, self.opacity, 1.0, duration=0.1)
     31 
     32     def OnMouseExit(self, *args):
     33         animations.FadeTo(self, self.opacity, IDLE_OPACITY, duration=0.1)
     34 
     35     def OnMouseDown(self, *args):
     36         animations.FadeTo(self, self.opacity, DOWN_OPACITY, duration=0.1)
     37         self.bannerSprite.top = 1
     38 
     39     def OnMouseUp(self, *args):
     40         self.bannerSprite.top = 0
     41         currentMouseOver = uicore.uilib.mouseOver
     42         animations.StopAnimation(self, 'opacity')
     43         if currentMouseOver == self or not currentMouseOver.IsUnder(self):
     44             self.opacity = 1.0
     45         else:
     46             self.opacity = IDLE_OPACITY