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

alert_animations.py (4859B)


      1 #Embedded file name: C:\BuildAgent\work\20d73f1b24eed06e\eve\release\V24.01\packages\dynamicresources\client\ui\alert_animations.py
      2 import locks
      3 import trinity
      4 from carbonui import uiconst
      5 from carbonui.primitives.sprite import Sprite
      6 from carbonui.primitives.transform import Transform
      7 from carbonui.uianimations import animations
      8 from carbonui.util.color import Color
      9 from uthread2 import StartTasklet
     10 
     11 class TimerDissapearAnimation(Transform):
     12     CIRCLE_TEXTURE_PATH = 'res:/UI/Texture/circle_with_border_blurred.png'
     13     MASK_TEXTURE_PATH = 'res:/UI/Texture/circle_with_border_inverted.png'
     14     default_endRadius = 50
     15     default_width = 258
     16     default_height = 258
     17     default_gaugeLineWidth = 20
     18     default_scalingCenter = (0.5, 0.5)
     19     default_scaleUpDuration = 0.25
     20     default_scaleOutDuration = 0.5
     21 
     22     def ApplyAttributes(self, attributes):
     23         Transform.ApplyAttributes(self, attributes)
     24         self.endRadius = attributes.get('endRadius', self.default_endRadius)
     25         self.gaugeLineWidth = attributes.get('gaugeLineWidth', self.default_gaugeLineWidth)
     26         self.scaleUpDuration = attributes.get('scaleUpDuration', self.default_scaleUpDuration)
     27         self.scaleOutDuration = attributes.get('scaleOutDuration', self.default_scaleOutDuration)
     28         self.transitionLock = attributes.get('transitionLock')
     29         StartTasklet(self.ConstructLayout)
     30 
     31     def ConstructLayout(self):
     32         with locks.TempLock(self.transitionLock):
     33             self.sprite = Sprite(parent=self, align=uiconst.CENTER, width=self.endRadius * 2 + self.gaugeLineWidth / 2, height=self.endRadius * 2 + self.gaugeLineWidth / 2, texturePath=self.CIRCLE_TEXTURE_PATH, textureSecondaryPath=self.MASK_TEXTURE_PATH, spriteEffect=trinity.TR2_SFX_MODULATE, idx=0, opacity=0.7)
     34             self.sprite.scalingCenterSecondary = (0.5, 0.5)
     35             self.sprite.scaleSecondary = (4, 4)
     36             animations.Tr2DScaleTo(self, startScale=(0, 0), endScale=(1, 1), duration=self.scaleUpDuration)
     37             animations.MorphVector2(self.sprite, 'scaleSecondary', startVal=(4, 4), endVal=(1.0, 1.0), loops=1, curveType=uiconst.ANIM_LINEAR, duration=self.scaleOutDuration, sleep=True)
     38             self.sprite.display = False
     39 
     40 
     41 class TimerAppearAnimation(Transform):
     42     CIRCLE_TEXTURE_PATH = 'res:/UI/Texture/circle_with_border_blurred.png'
     43     MASK_TEXTURE_PATH = 'res:/UI/Texture/circle_with_border_inverted.png'
     44     default_startRadius = 5
     45     default_endRadius = 50
     46     default_width = 258
     47     default_height = 258
     48     default_gaugeLineWidth = 20
     49     default_dashCount = 6
     50     default_scalingCenter = (0.5, 0.5)
     51     default_timerColor = Color.GRAY
     52     default_dashSizeFactor = 8.0
     53     default_gaugeFillDuration = 1
     54     default_scaleUpDuration = 0.25
     55     default_gaugeFadeInDuration = 1
     56     default_scaleOutDuration = 0.5
     57 
     58     def ApplyAttributes(self, attributes):
     59         Transform.ApplyAttributes(self, attributes)
     60         self.startRadius = attributes.get('startRadius', self.default_startRadius)
     61         self.endRadius = attributes.get('endRadius', self.default_endRadius)
     62         self.gaugeLineWidth = attributes.get('gaugeLineWidth', self.default_gaugeLineWidth)
     63         self.dashCount = attributes.get('dashCount', self.default_dashCount)
     64         self.timerColor = attributes.get('timerColor', self.default_timerColor)
     65         self.dashSizeFactor = attributes.get('dashSizeFactor', self.default_dashSizeFactor)
     66         self.gaugeFillDuration = attributes.get('gaugeFillDuration', self.default_gaugeFillDuration)
     67         self.scaleUpDuration = attributes.get('scaleUpDuration', self.default_scaleUpDuration)
     68         self.gaugeFadeInDuration = attributes.get('gaugeFadeInDuration', self.default_gaugeFadeInDuration)
     69         self.scaleOutDuration = attributes.get('scaleOutDuration', self.default_scaleOutDuration)
     70         self.transitionLock = attributes.get('transitionLock')
     71         StartTasklet(self.ConstructLayout)
     72 
     73     def ConstructLayout(self):
     74         with locks.TempLock(self.transitionLock):
     75             self.sprite = Sprite(parent=self, align=uiconst.CENTER, width=self.endRadius * 2 + self.gaugeLineWidth / 2, height=self.endRadius * 2 + self.gaugeLineWidth / 2, texturePath=self.CIRCLE_TEXTURE_PATH, textureSecondaryPath=self.MASK_TEXTURE_PATH, spriteEffect=trinity.TR2_SFX_MODULATE, idx=0, opacity=0.7)
     76             self.sprite.scalingCenterSecondary = (0.5, 0.5)
     77             self.sprite.scaleSecondary = (4, 4)
     78             self.BeginAnimations()
     79 
     80     def BeginAnimations(self):
     81         animations.Tr2DScaleTo(self, startScale=(0, 0), endScale=(1, 1), duration=self.scaleUpDuration)
     82 
     83         def hide_sprite():
     84             self.sprite.display = False
     85 
     86         animations.MorphVector2(self.sprite, 'scaleSecondary', startVal=(4, 4), endVal=(1.0, 1.0), loops=1, curveType=uiconst.ANIM_LINEAR, duration=self.scaleOutDuration, callback=hide_sprite)