briefing_panel.py (5513B)
1 #Embedded file name: C:\BuildAgent\work\20d73f1b24eed06e\eve\release\V24.01\eve\client\script\ui\shared\theatersOfWar\campaigns\panels\briefing_panel.py 2 import logging 3 from campaigns.client.settings import campaign_animate_background 4 from carbonui import Align, TextColor, PickState 5 from carbonui.control.scrollContainer import ScrollContainer 6 from carbonui.primitives.container import Container 7 from carbonui.primitives.line import Line 8 from carbonui.primitives.sprite import Sprite 9 from carbonui.text.const import FontSizePreset 10 from carbonui.text.custom import TextCustom 11 from carbonui.text.styles import TextHeadline, TextBody 12 from eve.client.script.ui.shared.theatersOfWar.campaigns.panels.base_scrolling_page import BaseScrollingPage 13 from eve.client.script.ui.shared.theatersOfWar.campaigns.panels.static_background import StaticBackground 14 from eveexceptions import ExceptionEater 15 logger = logging.getLogger(__name__) 16 17 class CampaignBriefing(BaseScrollingPage): 18 default_name = 'campaignBriefing' 19 default_align = Align.TOTOP 20 21 def ApplyAttributes(self, attributes): 22 super(CampaignBriefing, self).ApplyAttributes(attributes) 23 self.campaignPanelController = attributes.campaignPanelController 24 self._construct_ui() 25 self.connect_signals() 26 27 def connect_signals(self): 28 campaign_animate_background.on_change.connect(self.on_animation_setting_changed) 29 30 def disconnect_signals(self): 31 campaign_animate_background.on_change.disconnect(self.on_animation_setting_changed) 32 33 def _construct_ui(self): 34 self.text_cont = ScrollContainer(name='briefing_cont', parent=self, align=Align.TOLEFT, pos=(96, 0, 720, 0), padTop=64, padRight=48, padBottom=24) 35 self._construct_header() 36 self._construct_body_text() 37 self._construct_campaign_bg() 38 39 def _construct_header(self): 40 self.header_label = TextHeadline(name='header_label', parent=self.text_cont, text='', align=Align.TOTOP, top=16) 41 self.from_name_label = TextCustom(name='from_name_label', parent=self.text_cont, text='', align=Align.TOTOP, top=16, fontsize=FontSizePreset.HEADER) 42 self.from_title_label = TextBody(name='from_title_label', parent=self.text_cont, text='', align=Align.TOTOP, color=TextColor.SECONDARY) 43 Line(parent=self.text_cont, align=Align.TOTOP, padding=(0, 24, 0, 24)) 44 45 def _construct_body_text(self): 46 self.main_label = TextBody(name='main_label', parent=self.text_cont, align=Align.TOTOP, color=TextColor.SECONDARY, pickState=PickState.ON) 47 self.success_header_label = TextCustom(name='success_header_label', parent=self.text_cont, align=Align.TOTOP, top=16, fontsize=FontSizePreset.HEADER) 48 self.success_label = TextBody(name='success_label', parent=self.text_cont, align=Align.TOTOP, color=TextColor.SECONDARY, pickState=PickState.ON) 49 self.failure_header_label = TextCustom(name='failure_header_label', parent=self.text_cont, align=Align.TOTOP, top=16, fontsize=FontSizePreset.HEADER) 50 self.failure_label = TextBody(parent=self.text_cont, align=Align.TOTOP, color=TextColor.SECONDARY, pickState=PickState.ON) 51 self.final_words_label = TextBody(parent=self.text_cont, text='', align=Align.TOTOP, bold=True, top=16) 52 53 def _construct_campaign_bg(self): 54 self.bg_cont = Container(name='bg_cont', parent=self) 55 self.static_background_cont = StaticBackground(name='static_background_cont', parent=self.bg_cont) 56 self.campaign_ambient_bg = Sprite(parent=self, align=Align.TOALL, display=False, pickState=PickState.OFF) 57 58 def on_animation_setting_changed(self, newValue): 59 self._load_campaign_bg() 60 61 def load_ui(self): 62 campaign_controller = self.campaignPanelController.selected_campaign_controller 63 self.header_label.text = campaign_controller.text.briefing_header_text 64 font_family = campaign_controller.font_family 65 font_color = campaign_controller.theme_pack.accent 66 self.from_name_label.fontFamily = font_family 67 self.from_name_label.SetRGBA(*font_color) 68 self.from_name_label.text = campaign_controller.text.presenting_character_name 69 self.from_title_label.text = campaign_controller.text.presenting_character_subtitle_text 70 self.main_label.text = campaign_controller.text.briefing_goal_description_text 71 self.success_header_label.text = campaign_controller.text.briefing_success_header_text 72 self.success_header_label.SetRGBA(*font_color) 73 self.success_header_label.fontFamily = font_family 74 self.failure_header_label.text = campaign_controller.text.briefing_failure_header_text 75 self.failure_header_label.SetRGBA(*font_color) 76 self.failure_header_label.fontFamily = font_family 77 self.success_label.text = campaign_controller.text.briefing_success_description_text 78 self.failure_label.text = campaign_controller.text.briefing_failure_description_text 79 self.final_words_label.text = campaign_controller.text.briefing_final_words_text 80 self._load_campaign_bg() 81 82 def _load_campaign_bg(self): 83 campaign_controller = self.campaignPanelController.selected_campaign_controller 84 self.static_background_cont.load_ui(campaign_controller) 85 self.campaign_ambient_bg.texturePath = campaign_controller.textures.ambient_background 86 87 def Close(self): 88 super(CampaignBriefing, self).Close() 89 with ExceptionEater('Closing CampaignBriefing'): 90 self.disconnect_signals()