icon.py (2324B)
1 #Embedded file name: C:\BuildAgent\work\20d73f1b24eed06e\eve\release\V24.01\packages\achievement_system\client\ui\window\card\components\icon.py 2 import threadutils 3 from carbonui import Align, SpriteEffect, uiconst 4 from carbonui.primitives.container import Container 5 from carbonui.primitives.sprite import Sprite 6 from carbonui.util.color import Color 7 8 class AchievementIcon(Container): 9 default_width = 128 10 default_height = 128 11 OUTER_ICON_SIZE = 128 12 INNER_ICON_SIZE = 80 13 CENTER_ICON_SIZE = 32 14 15 def __init__(self, controller, *args, **kwargs): 16 super(AchievementIcon, self).__init__(*args, **kwargs) 17 self.controller = controller 18 self.construct_layout() 19 self.update() 20 21 def construct_layout(self): 22 self.center_icon = Sprite(name='center_icon', parent=self, align=Align.CENTER, state=uiconst.UI_DISABLED, outputMode=uiconst.OUTPUT_COLOR_AND_GLOW, pos=(0, 23 0, 24 self.CENTER_ICON_SIZE, 25 self.CENTER_ICON_SIZE)) 26 self.inner_icon = Sprite(name='inner_icon', parent=self, align=Align.CENTER, state=uiconst.UI_DISABLED, pos=(0, 27 0, 28 self.INNER_ICON_SIZE, 29 self.INNER_ICON_SIZE)) 30 self.outer_icon = Sprite(name='outer_icon', parent=self, align=Align.CENTER, state=uiconst.UI_DISABLED, spriteEffect=SpriteEffect.MODULATE, pos=(0, 31 0, 32 self.OUTER_ICON_SIZE, 33 self.OUTER_ICON_SIZE)) 34 35 @threadutils.highlander_threaded 36 def update(self): 37 outer_frame, outer_mask, inner_frame = self.controller.icon_frame_textures 38 self.center_icon.texturePath = self.controller.icon 39 self.inner_icon.texturePath = inner_frame 40 self.outer_icon.texturePath = outer_frame 41 self.outer_icon.SetSecondaryTexturePath(outer_mask) 42 if self.controller.is_completed: 43 self.center_icon.opacity = 1.0 44 self.center_icon.glowBrightness = 0.3 45 self.outer_icon.color = Color.HextoRGBA('#FF6B8B7D') 46 else: 47 self.center_icon.opacity = 0.75 48 self.center_icon.glowBrightness = 0.0 49 self.outer_icon.color = Color.HextoRGBA('#FF6B7F8B') 50 51 52 class AchievementIconSmall(AchievementIcon): 53 default_width = 64 54 default_height = 64 55 OUTER_ICON_SIZE = 64 56 INNER_ICON_SIZE = 40 57 CENTER_ICON_SIZE = 16