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

activeTargetIndicator.py (6565B)


      1 #Embedded file name: C:\BuildAgent\work\20d73f1b24eed06e\eve\release\V24.01\eve\client\script\ui\inflight\bracketsAndTargets\activeTargetIndicator.py
      2 import math
      3 import trinity
      4 import localization
      5 from carbonui import uiconst
      6 from carbonui.primitives.container import Container
      7 from carbonui.primitives.fill import Fill
      8 from carbonui.primitives.sprite import Sprite
      9 from carbonui.uicore import uicore
     10 from eve.client.script.ui.control import eveLabel
     11 SHOWLABELS_NEVER = 0
     12 SHOWLABELS_ONMOUSEENTER = 1
     13 SHOWLABELS_ALWAYS = 2
     14 TARGETTING_UI_UPDATE_RATE = 50
     15 LABELMARGIN = 6
     16 
     17 class ActiveTargetIndicator(Container):
     18     default_width = 120
     19     default_height = 120
     20     default_align = uiconst.CENTER
     21     default_state = uiconst.UI_DISABLED
     22 
     23     def ApplyAttributes(self, attributes):
     24         Container.ApplyAttributes(self, attributes)
     25         self.rotatingArrows = Sprite(parent=self, name='rotatingArrows', pos=(0, 0, 120, 120), state=uiconst.UI_PICKCHILDREN, texturePath='res:/UI/Texture/classes/Target/spinCorners.png', color=(1.0, 1.0, 1.0, 0.2), align=uiconst.CENTER)
     26         self.selectedTargetCircle = Sprite(parent=self, name='selectedTargetCircle', pos=(0, 0, 80, 80), state=uiconst.UI_PICKCHILDREN, texturePath='res:/UI/Texture/classes/Target/selectedTargetedItem.png', color=(1.0, 1.0, 1.0, 0.15), align=uiconst.CENTER)
     27         self.RotateArrows()
     28 
     29     def RotateArrows(self, *args):
     30         uicore.animations.Tr2DRotateTo(self.rotatingArrows, duration=3.5, loops=uiconst.ANIM_REPEAT, startAngle=6.283185307179586, endAngle=0.0, curveType=uiconst.ANIM_LINEAR)
     31         uicore.animations.FadeTo(self.rotatingArrows, startVal=0.2, endVal=0.5, duration=3.0, loops=uiconst.ANIM_REPEAT, curveType=uiconst.ANIM_WAVE)
     32 
     33 
     34 class TargetLine(Fill):
     35     default_state = uiconst.UI_DISABLED
     36     default_color = (1.0, 1.0, 1.0, 1.0)
     37     default_align = uiconst.RELATIVE
     38 
     39 
     40 class TargetedIndicator(Container):
     41     default_width = 94
     42     default_height = 94
     43     default_align = uiconst.CENTER
     44     default_state = uiconst.UI_DISABLED
     45 
     46     def ApplyAttributes(self, attributes):
     47         Container.ApplyAttributes(self, attributes)
     48         self.targetingIndicatorsEnabled = True
     49         self.circle = Sprite(parent=self, name='circle', pos=(0, 0, 96, 96), state=uiconst.UI_DISABLED, texturePath='res:/UI/Texture/classes/Target/outerCircle.png', color=(1.0, 1.0, 1.0, 0.1), align=uiconst.CENTER)
     50         self.lines = lines = Container(parent=self, name='lines', pos=(0, 0, 1, 1), align=uiconst.CENTER)
     51         self.lines.opacity = 0.1
     52         linetop = TargetLine(parent=lines, name='linetop', pos=(0, -1216, 1, 1172))
     53         self.lines.linetop = linetop
     54         lineleft = TargetLine(parent=lines, name='lineleft', pos=(-1616, -1, 1572, 1))
     55         self.lines.lineleft = lineleft
     56         lineright = TargetLine(parent=lines, name='lineright', pos=(46, -1, 1600, 1))
     57         self.lines.lineright = lineright
     58         linebottom = TargetLine(parent=lines, name='linebottom', pos=(0, 46, 1, 1200))
     59         self.lines.linebottom = linebottom
     60         self.leftTimer = Sprite(parent=self, name='leftTimer', pos=(0, 0, 76, 76), state=uiconst.UI_PICKCHILDREN, texturePath='res:/UI/Texture/classes/Target/timerLeft.png', textureSecondaryPath='res:/UI/Texture/classes/Target/timerLeft.png', color=(1.0, 1.0, 1.0, 0.4), align=uiconst.CENTER, blendMode=1, spriteEffect=trinity.TR2_SFX_MODULATE)
     61         self.leftTimer.display = False
     62         self.rightTimer = Sprite(parent=self, name='rightTimer', pos=(0, 0, 76, 76), state=uiconst.UI_PICKCHILDREN, texturePath='res:/UI/Texture/classes/Target/timerRight.png', textureSecondaryPath='res:/UI/Texture/classes/Target/timerRight.png', color=(1.0, 1.0, 1.0, 0.4), align=uiconst.CENTER, blendMode=1, spriteEffect=trinity.TR2_SFX_MODULATE)
     63         self.rightTimer.display = False
     64         self.targetingArrows = Sprite(parent=self, name='targetingArrows', pos=(0, 0, 120, 120), state=uiconst.UI_PICKCHILDREN, texturePath='res:/UI/Texture/classes/Target/spinCorners.png', color=(1.0, 1.0, 1.0, 0.6), align=uiconst.CENTER)
     65         self.targetingArrows.rotation = math.pi / 4
     66         self.targetingArrows.display = False
     67         t = eveLabel.EveLabelSmall(text='', parent=self, top=64, align=uiconst.CENTERTOP, state=uiconst.UI_DISABLED)
     68         self.lockingText = t
     69 
     70     def ShowTargetingIndicators(self, *args):
     71         self.targetingIndicatorsEnabled = True
     72         self.targetingArrows.display = True
     73         uicore.animations.MorphScalar(self.targetingArrows, 'width', startVal=120.0, endVal=0.0, duration=0.33, loops=uiconst.ANIM_REPEAT, curveType=uiconst.ANIM_LINEAR)
     74         uicore.animations.MorphScalar(self.targetingArrows, 'height', startVal=120.0, endVal=0.0, duration=0.33, loops=uiconst.ANIM_REPEAT, curveType=uiconst.ANIM_LINEAR)
     75         uicore.animations.MorphScalar(self.targetingArrows, 'opacity', startVal=0.1, endVal=1.0, duration=0.33, loops=uiconst.ANIM_REPEAT, curveType=uiconst.ANIM_LINEAR)
     76 
     77     def HideTargetingIndicators(self, *args):
     78         self.targetingIndicatorsEnabled = False
     79         self.targetingArrows.display = False
     80         self.targetingArrows.StopAnimations()
     81         self.KillTimerAnimation()
     82 
     83     def ChangeLineOpacity(self, faded = True, *args):
     84         if faded:
     85             self.lines.opacity = 0.1
     86             self.circle.SetAlpha(0.2)
     87         else:
     88             self.lines.opacity = 0.2
     89             self.circle.SetAlpha(0.5)
     90 
     91     def BlinkArrowsAndText(self):
     92         curvePoints = ([0, 0],
     93          [0.49, 0.0],
     94          [0.5, 0.4],
     95          [0.99, 0.4])
     96         uicore.animations.MorphScalar(self.leftTimer, 'opacity', duration=0.1, curveType=curvePoints, loops=uiconst.ANIM_REPEAT)
     97         uicore.animations.MorphScalar(self.rightTimer, 'opacity', duration=0.1, curveType=curvePoints, loops=uiconst.ANIM_REPEAT)
     98         curvePoints = ([0, 0],
     99          [0.49, 0.0],
    100          [0.5, 1.0],
    101          [0.99, 1.0])
    102         self.lockingText.text = localization.GetByLabel('UI/Inflight/Brackets/TargetLocked')
    103         uicore.animations.MorphScalar(self.lockingText, 'opacity', duration=0.1, curveType=curvePoints, loops=uiconst.ANIM_REPEAT)
    104 
    105     def KillTimerAnimation(self, *args):
    106         leftTimer = self.leftTimer
    107         rightTimer = self.rightTimer
    108         leftTimer.StopAnimations()
    109         rightTimer.StopAnimations()
    110         self.lockingText.StopAnimations()
    111         leftTimer.display = False
    112         rightTimer.display = False
    113         self.lockingText.display = False
    114         self.lockingText.text = ''
    115 
    116     def IsTargetingIndicatorsEnabled(self, *args):
    117         return self.targetingIndicatorsEnabled