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

indication_message_location.py (3685B)


      1 #Embedded file name: C:\BuildAgent\work\20d73f1b24eed06e\eve\release\V24.01\eve\client\script\ui\inflight\shipHud\action_indication\indication_message_location.py
      2 import carbonui
      3 import carbonui.text.custom
      4 import carbonui.text.styles
      5 import uthread2
      6 from carbon.client.script.environment.audioService import GetAudioService
      7 from carbonui import Align, TextColor, TextAlign, uiconst
      8 from carbonui.primitives.containerAutoSize import ContainerAutoSize
      9 from carbonui.text.const import FontSizePreset
     10 from carbonui.uianimations import animations
     11 from carbonui.uiconst import OutputMode
     12 from eve.client.script.ui.inflight.shipHud.action_indication.indication_message_base import IndicationMessageBase
     13 from eveui import CurveType
     14 
     15 class IndicationMessageLocation(IndicationMessageBase):
     16     default_alignMode = Align.TOTOP
     17 
     18     def __init__(self, **kwargs):
     19         super(IndicationMessageLocation, self).__init__(**kwargs)
     20         self.appear_thread = None
     21 
     22     def construct_layout(self):
     23         self.construct_title()
     24         self.construct_caption()
     25         self.construct_text()
     26 
     27     def construct_title(self):
     28         self.title = carbonui.text.styles.TextBody(name='indication_title', parent=self, color=TextColor.SECONDARY, align=Align.TOTOP, textAlign=TextAlign.CENTER, outputMode=OutputMode.COLOR_AND_GLOW, glowBrightness=0.0)
     29 
     30     def construct_caption(self):
     31         self.caption = carbonui.text.custom.TextCustom(name='indication_caption', parent=self, color=TextColor.HIGHLIGHT, align=Align.TOTOP, textAlign=TextAlign.CENTER, outputMode=OutputMode.COLOR_AND_GLOW, glowBrightness=0.0, uppercase=True, fontsize=FontSizePreset.DISPLAY, letterspace=3)
     32 
     33     def construct_text(self):
     34         self.text_label_cont = ContainerAutoSize(parent=self, align=Align.TOTOP, opacity=0.0)
     35         self.text_label = carbonui.text.styles.TextHeader(parent=self.text_label_cont, name='indication_text', text='', align=Align.TOTOP, color=TextColor.SECONDARY, textAlign=TextAlign.CENTER)
     36 
     37     def _apply_indication_data(self, indication_data):
     38         self.title.text = indication_data.title
     39         self.caption.fontPath = indication_data.caption_font_path
     40         self.caption.text = indication_data.caption
     41         self.text_label.text = indication_data.text
     42 
     43     def appear(self):
     44         if self.appear_thread:
     45             self.appear_thread.kill()
     46         self.appear_thread = uthread2.start_tasklet(self.anim_appear)
     47 
     48     def disappear(self):
     49         if self.appear_thread:
     50             self.appear_thread.kill()
     51         animations.FadeOut(self, duration=0.3)
     52 
     53     def anim_appear(self):
     54         GetAudioService().SendUIEvent('location_banner_play')
     55         animations.FadeIn(self, duration=0.3)
     56         animations.FadeTo(self.caption, 0.0, TextColor.HIGHLIGHT.opacity, duration=1.0)
     57         animations.MorphScalar(self.caption, 'glowBrightness', 2.0, 0.0, duration=2.0, curveType=CurveType.wave)
     58         animations.FadeTo(self.title, 0.0, TextColor.SECONDARY.opacity, duration=1.0, timeOffset=1.0)
     59         text = self.text_label.text
     60         self.text_label.text = ''
     61         uthread2.sleep(2.0)
     62         if text:
     63             self._anim_appear_text_label(text)
     64         self.appear_thread = None
     65 
     66     def _anim_appear_text_label(self, text):
     67         animations.FadeTo(self.text_label_cont, 0.0, 1.0, duration=0.6)
     68         tag_open = False
     69         for i, char in enumerate(text):
     70             if char == '<':
     71                 tag_open = True
     72             elif char == '>':
     73                 tag_open = False
     74             self.text_label.text += char
     75             if not tag_open:
     76                 GetAudioService().SendUIEvent('location_banner_data_clicks_play')
     77                 uthread2.sleep(0.05)