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

mapCompass.py (2742B)


      1 #Embedded file name: C:\BuildAgent\work\20d73f1b24eed06e\eve\release\V24.01\eve\client\script\ui\shared\mapView\mapCompass.py
      2 import math
      3 from carbonui import uiconst
      4 from carbonui.primitives.container import Container
      5 from carbonui.primitives.transform import Transform
      6 from carbonui.uianimations import animations
      7 from eve.client.script.ui.control.themeColored import SpriteThemeColored
      8 COMPASS_DIRECTIONS_COLOR = (1, 1, 1, 1)
      9 COMPASS_SWEEP_COLOR = (1, 1, 1, 1)
     10 OFFSET_Y = 120
     11 OFFSET_Y_COMPACT = 60
     12 
     13 class MapCompass(Container):
     14     default_name = 'MapCompass'
     15     default_state = uiconst.UI_NORMAL
     16 
     17     def ApplyAttributes(self, attributes):
     18         Container.ApplyAttributes(self, attributes)
     19         self.onClickCallback = attributes.onClickCallback
     20         self.compassTransform = Transform(name='compass_transform', parent=self, width=self.width - 4, height=self.height - 4, align=uiconst.CENTER, opacity=1.0)
     21         self.frameContainer = Container(name='compass_transform', parent=self, width=self.width, height=self.height, align=uiconst.CENTER)
     22         self.ConstructDirectionIndicationSprites()
     23         self.ConstructBackground()
     24 
     25     def ConstructBackground(self):
     26         SpriteThemeColored(name='compass_underlay', bgParent=self.frameContainer, texturePath='res:/UI/Texture/classes/MapView/MapCompass/bgCircle.png', colorType=uiconst.COLORTYPE_UIBASECONTRAST, opacity=0.5)
     27 
     28     def ConstructDirectionIndicationSprites(self):
     29         SpriteThemeColored(name='north', parent=self.compassTransform, align=uiconst.CENTERTOP, colorType=uiconst.COLORTYPE_UIHILIGHTGLOW, texturePath='res:/UI/Texture/classes/MapView/MapCompass/northArrow.png', pos=(0, 0, 10, 10))
     30         SpriteThemeColored(name='west', parent=self.compassTransform, align=uiconst.CENTERLEFT, texturePath='res:/UI/Texture/classes/MapView/MapCompass/dash.png', pos=(0, 0, 10, 10))
     31         SpriteThemeColored(name='south', parent=self.compassTransform, align=uiconst.CENTERBOTTOM, texturePath='res:/UI/Texture/classes/MapView/MapCompass/dash.png', pos=(0, 0, 10, 10), rotation=math.pi / 2)
     32         SpriteThemeColored(name='east', parent=self.compassTransform, align=uiconst.CENTERRIGHT, texturePath='res:/UI/Texture/classes/MapView/MapCompass/dash.png', pos=(0, 0, 10, 10))
     33 
     34     def Update(self, yaw):
     35         self.compassTransform.rotation = -yaw
     36 
     37     def OnMouseEnter(self, *args):
     38         animations.FadeTo(self, self.opacity, 1.5, duration=0.15)
     39 
     40     def OnMouseExit(self, *args):
     41         animations.FadeTo(self, self.opacity, 1.0, duration=0.3)
     42 
     43     def OnClick(self, *args):
     44         self.onClickCallback()
     45 
     46     def update_compact_mode(self, is_compact):
     47         if is_compact:
     48             self.top = OFFSET_Y_COMPACT
     49         else:
     50             self.top = OFFSET_Y