dronesWarpWarning.py (3236B)
1 #Embedded file name: C:\BuildAgent\work\20d73f1b24eed06e\eve\release\V24.01\eve\client\script\ui\inflight\drones\dronesWarpWarning.py 2 import math 3 import localization 4 from carbonui import uiconst 5 from carbonui.control.button import Button 6 from carbonui.primitives.container import Container 7 from carbonui.primitives.containerAutoSize import ContainerAutoSize 8 from carbonui.primitives.frame import Frame 9 from carbonui.primitives.sprite import Sprite 10 from clientsettings.setting import CharSettingBool 11 from carbonui.uianimations import animations 12 from eve.client.script.ui import eveColor 13 from eve.client.script.ui.control.eveLabel import EveLabelMedium 14 from eve.client.script.ui.inflight.drones.dronesUtil import stop_and_recall_drones 15 warp_warning_enabled_setting = CharSettingBool('drone_warp_warning_enabled', True) 16 17 class WarpWarning(ContainerAutoSize): 18 default_alignMode = uiconst.TOTOP 19 default_opacity = 0.0 20 21 def __init__(self, **kwargs): 22 super(WarpWarning, self).__init__(**kwargs) 23 self.constructed = False 24 self.is_active = False 25 self.whiteout = None 26 27 def layout(self): 28 self.whiteout = Container(parent=self, align=uiconst.TOALL, bgColor=(1.0, 1.0, 1.0), opacity=0.5) 29 Frame(bgParent=self, texturePath='res:/UI/Texture/Shared/DarkStyle/panel1Corner_Solid.png', rotation=math.pi, cornerSize=9, color=eveColor.WARNING_ORANGE, opacity=0.15) 30 Sprite(name='cornerSprite', parent=self, align=uiconst.TOPLEFT, state=uiconst.UI_DISABLED, texturePath='res:/UI/Texture/Shared/DarkStyle/cornerTriSmall.png', width=5, height=5, color=eveColor.WARNING_ORANGE, opacity=0.5) 31 warning_icon = Sprite(name='warningIcon', parent=self, align=uiconst.TOPLEFT, state=uiconst.UI_DISABLED, width=32, height=32, left=10, top=8, texturePath='res:/UI/Texture/classes/agency/iconExclamation.png', color=eveColor.WARNING_ORANGE) 32 animations.FadeTo(warning_icon, startVal=0.5, endVal=1.5, duration=0.7, loops=-1, curveType=uiconst.ANIM_WAVE) 33 EveLabelMedium(name='warningLabel', parent=self, align=uiconst.TOTOP, padding=(52, 8, 8, 8), text=localization.GetByLabel('UI/Drones/WarpWarningMessage'), color=eveColor.WARNING_ORANGE) 34 button_row_cont = ContainerAutoSize(parent=self, align=uiconst.TOTOP, padding=(52, 0, 8, 8)) 35 Button(parent=button_row_cont, align=uiconst.TOPLEFT, label=localization.GetByLabel('UI/Drones/StopAndRecall'), func=stop_and_recall_drones, args=()) 36 self.constructed = True 37 38 def FadeIn(self): 39 if not self.constructed: 40 self.layout() 41 if self.is_active: 42 return 43 self.is_active = True 44 sm.GetService('audio').SendUIEvent('ui_warning_abandoning_drones') 45 self.Show() 46 animations.StopAllAnimations(self) 47 animations.FadeIn(self, duration=0.3) 48 animations.FadeTo(self.whiteout, startVal=0.0, endVal=1.0, duration=0.3, timeOffset=0.1, curveType=uiconst.ANIM_WAVE) 49 50 def FadeOut(self): 51 if not self.constructed: 52 return 53 self.is_active = False 54 animations.StopAllAnimations(self.whiteout) 55 animations.FadeOut(self.whiteout, duration=0.1) 56 animations.FadeOut(self, duration=0.3, callback=self.Hide)