geography_panel.py (4914B)
1 #Embedded file name: C:\BuildAgent\work\20d73f1b24eed06e\eve\release\V24.01\eve\client\script\ui\shared\theatersOfWar\campaigns\panels\geography_panel.py 2 import uthread2 3 from carbonui import Align, TextColor, PickState 4 from carbonui.control.scrollContainer import ScrollContainer 5 from carbonui.primitives.container import Container 6 from carbonui.primitives.containerAutoSize import ContainerAutoSize 7 from carbonui.primitives.line import Line 8 from carbonui.text.custom import TextCustom 9 from carbonui.text.styles import TextHeadline, TextBody 10 from carbonui.uianimations import animations 11 from eve.client.script.ui.shared.mapView.mapView import MapView 12 from eve.client.script.ui.shared.mapView.mapViewConst import MAPVIEW_GEOGRAPHY_ID 13 from eve.client.script.ui.shared.theatersOfWar.campaigns.panels import panel_const 14 from eve.client.script.ui.shared.theatersOfWar.campaigns.panels.base_scrolling_page import BaseScrollingPage 15 16 class CampaignGeography(BaseScrollingPage): 17 default_name = 'campaignGeography' 18 default_align = Align.TOTOP 19 20 def ApplyAttributes(self, attributes): 21 super(CampaignGeography, self).ApplyAttributes(attributes) 22 self.campaignPanelController = attributes.campaignPanelController 23 self.mapView = None 24 self._construct_ui() 25 26 def _construct_ui(self): 27 self.text_cont = ScrollContainer(name='geography_cont', parent=self, align=Align.TOLEFT, pos=(96, 0, 432, 0), padTop=96, padBottom=24) 28 self.title_label = TextHeadline(name='title_label', parent=self.text_cont, align=Align.TOTOP) 29 self.header_label = TextBody(name='header_label', parent=self.text_cont, align=Align.TOTOP) 30 self.subheader_label = TextBody(name='subheader_label', parent=self.text_cont, align=Align.TOTOP, color=TextColor.DISABLED) 31 Line(parent=self.text_cont, opacity=0.1, align=Align.TOTOP, padding=(0, 16, 0, 16)) 32 self.section_cont = ContainerAutoSize(name='section_cont', parent=self.text_cont, align=Align.TOTOP) 33 self.map_cont = Container(name='map_cont', parent=self, align=Align.TOTOP, height=self.height) 34 35 def load_ui(self): 36 campaign_controller = self.campaignPanelController.selected_campaign_controller 37 self.title_label.SetText(campaign_controller.text.map_title_text) 38 font_family = campaign_controller.font_family 39 font_color = campaign_controller.theme_pack.accent 40 self.header_label.fontFamily = font_family 41 self.header_label.SetRGBA(*font_color) 42 self.header_label.SetText(campaign_controller.text.map_header_text) 43 self.subheader_label.SetText(campaign_controller.text.map_subheader_text) 44 self.section_cont.Flush() 45 for x in xrange(1, 10): 46 t, p = campaign_controller.text.get_map_section_texts(x) 47 if t is None or p is None: 48 break 49 section_title_label = TextCustom(name='section_title_label', parent=self.text_cont, align=Align.TOTOP, fontFamily=font_family, text='%s %s' % (u'\u2022', t), color=font_color, padTop=32) 50 section_paragraph_label = TextBody(name='section_paragraph_label', parent=self.text_cont, align=Align.TOTOP, text=p, pickState=PickState.ON) 51 52 def _load_map(self): 53 if self.mapView and not self.mapView.destroyed: 54 return 55 campaign_controller = self.campaignPanelController.selected_campaign_controller 56 self.map_cont.Flush() 57 map_focus_entity_id = campaign_controller.map_focus_entity_id 58 self.mapView = MapViewGeography(parent=self.map_cont, isFullScreen=False, mapViewID=MAPVIEW_GEOGRAPHY_ID, pickState=PickState.OFF, interestID=map_focus_entity_id) 59 self.mapView.sceneContainer.SetAlign(Align.TOTOP) 60 self.mapView.sceneContainer.height = self.height 61 62 def change_page(self, new_page_id, old_page_id, animate = True): 63 new_page_id = new_page_id or panel_const.PANEL_ID_OVERVIEW 64 if new_page_id == panel_const.PANEL_ID_GEOGRAPHY: 65 self._load_map() 66 uthread2.call_after_wallclocktime_delay(self._show_map, 1.0) 67 else: 68 self.map_cont.Hide() 69 animations.FadeOut(self.map_cont, callback=self.map_cont.Hide) 70 if self.mapView: 71 self.mapView.sceneContainer.scene.display = False 72 73 def _show_map(self): 74 if self.campaignPanelController.selected_campaign_page_id != panel_const.PANEL_ID_GEOGRAPHY: 75 return 76 self.map_cont.Show() 77 animations.FadeIn(self.map_cont) 78 if self.mapView: 79 self.mapView.sceneContainer.height = self.height 80 self.mapView.sceneContainer.scene.display = True 81 82 def _on_size_changed(self, width, height): 83 self.map_cont.height = height 84 if self.mapView: 85 self.mapView.sceneContainer.height = self.height 86 87 88 class MapViewGeography(MapView): 89 90 def IsAbstractModeActive(self): 91 return False