cloneStateWindow.py (13772B)
1 #Embedded file name: C:\BuildAgent\work\20d73f1b24eed06e\eve\release\V24.01\eve\client\script\ui\shared\cloneGrade\cloneStateWindow.py 2 import carbonui.text.styles 3 import trinity 4 import threadutils 5 from eve.client.script.ui.shared.cloneGrade.util import upgrade_clone_action 6 from eveexceptions.exceptionEater import ExceptionEater 7 import localization 8 import eveicon 9 from eve.client.script.ui import eveColor 10 import carbonui 11 import eveui 12 from carbonui.control.window import Window 13 from carbonui.decorative.selectionIndicatorLine import SelectionIndicatorLine 14 from carbonui.window.underlay import WindowUnderlay 15 from carbonui.primitives.sprite import Sprite, StreamingVideoSprite 16 from carbonui.primitives.container import Container 17 from carbonui.primitives.containerAutoSize import ContainerAutoSize 18 from carbonui.control.scrollContainer import ScrollContainer 19 from carbonui.primitives.stretchspritehorizontal import StretchSpriteHorizontal 20 from carbonui.primitives.frame import Frame 21 from eve.client.script.ui.control.infoIcon import InfoGlyphIcon, CheckMarkGlyphIcon, ExclamationMarkGlyphIcon 22 from eve.client.script.ui.shared.cloneGrade.upgradeButton import UpgradeIconButton 23 from eve.client.script.ui.shared.cloneGrade import ORIGIN_LAPSENOTIFYWINDOW 24 from eve.common.lib.vgsConst import CATEGORYTAG_GAMETIME 25 26 def open_upgrade_window(origin = None, reason = None): 27 CloneStateWindow.CloseIfOpen() 28 window = CloneStateWindow.Open(origin=origin, reason=reason, omega=True, show_upgrade_buttons=True, headline_label='UI/CloneState/UpgradeToday', body_header_label='UI/CloneState/OmegaBenefits', body_header_icon_class=InfoGlyphIcon, body_header_color=carbonui.TextColor.HIGHLIGHT, bullet_points=[{'icon': 'res:/UI/Texture/classes/cloneGrade/benefits/allShipsAndModules.png', 29 'label': 'UI/CloneState/PilotAllUniqueShips'}, 30 {'icon': 'res:/UI/Texture/classes/cloneGrade/benefits/trainSkillsFast.png', 31 'label': 'UI/CloneState/BenefitFasterTraining'}, 32 {'icon': 'res:/UI/Texture/classes/cloneGrade/benefits/allSkills.png', 33 'label': 'UI/CloneState/UnlimitedTraining'}, 34 {'icon': 'res:/UI/Texture/classes/cloneGrade/benefits/SKINR.png', 35 'label': 'UI/CloneState/SequenceOmegaShips'}, 36 {'icon': 'res:/UI/Texture/classes/cloneGrade/benefits/wallet.png', 37 'label': 'UI/CloneState/EarnOmegaRewards'}, 38 {'icon': 'res:/UI/Texture/classes/cloneGrade/benefits/PlanetaryIndustry.png', 39 'label': 'UI/CloneState/PlanetaryIndustry'}, 40 {'icon': 'res:/UI/Texture/classes/cloneGrade/benefits/Opportunities.png', 41 'label': 'UI/CloneState/UnlockAgentMissions'}]) 42 window.ShowDialog(modal=True, closeWhenClicked=True) 43 44 45 def open_omega_state_window(): 46 CloneStateWindow.CloseIfOpen() 47 CloneStateWindow.Open(omega=True, show_upgrade_buttons=False, headline_label='UI/CloneState/CloneStateOmega', body_header_label='UI/CloneState/YouHaveAll', body_header_icon_class=CheckMarkGlyphIcon, body_header_color=carbonui.TextColor.SUCCESS, bullet_points=[{'icon': 'res:/UI/Texture/classes/cloneGrade/benefits/allShipsAndModules.png', 48 'label': 'UI/CloneState/PilotAllUniqueShips'}, 49 {'icon': 'res:/UI/Texture/classes/cloneGrade/benefits/trainSkillsFast.png', 50 'label': 'UI/CloneState/BenefitFasterTraining'}, 51 {'icon': 'res:/UI/Texture/classes/cloneGrade/benefits/allSkills.png', 52 'label': 'UI/CloneState/UnlimitedTraining'}, 53 {'icon': 'res:/UI/Texture/classes/cloneGrade/benefits/SKINR.png', 54 'label': 'UI/CloneState/SequenceOmegaShips'}, 55 {'icon': 'res:/UI/Texture/classes/cloneGrade/benefits/wallet.png', 56 'label': 'UI/CloneState/EarnOmegaRewards'}, 57 {'icon': 'res:/UI/Texture/classes/cloneGrade/benefits/PlanetaryIndustry.png', 58 'label': 'UI/CloneState/PlanetaryIndustry'}, 59 {'icon': 'res:/UI/Texture/classes/cloneGrade/benefits/Opportunities.png', 60 'label': 'UI/CloneState/UnlockAgentMissions'}]) 61 62 63 def open_alpha_state_window(): 64 CloneStateWindow.CloseIfOpen() 65 window = CloneStateWindow.Open(origin=ORIGIN_LAPSENOTIFYWINDOW, omega=False, show_upgrade_buttons=True, headline_label='UI/CloneState/CloneStateAlpha', body_header_label='UI/CloneState/LapseWindow/Downgrade', body_header_icon_class=ExclamationMarkGlyphIcon, body_header_color=carbonui.TextColor.WARNING, bullet_points=[{'icon': 'res:/UI/Texture/classes/cloneGrade/benefits/allSkills.png', 66 'label': 'UI/CloneState/SkillRestrictions', 67 'sub_points': ['UI/CloneState/LostOmegaSkillAccess', 'UI/CloneState/SlowerSkillTraining', 'UI/CloneState/SkillQueuePaused']}, 68 {'icon': 'res:/UI/Texture/classes/cloneGrade/benefits/SKINR.png', 69 'label': 'UI/CloneState/SequencingRestricted', 70 'sub_points': ['UI/CloneState/NoSequenceForOmegaShips']}, 71 {'icon': 'res:/UI/Texture/classes/cloneGrade/benefits/wallet.png', 72 'label': 'UI/CloneState/ReducedRewards', 73 'sub_points': ['UI/CloneState/LostRewardAccess']}, 74 {'icon': 'res:/UI/Texture/classes/cloneGrade/benefits/PlanetaryIndustry.png', 75 'label': 'UI/CloneState/PlanetaryAccessLost', 76 'sub_points': ['UI/CloneState/UnableToExport']}, 77 {'icon': 'res:/UI/Texture/classes/cloneGrade/benefits/Opportunities.png', 78 'label': 'UI/CloneState/AgentMissionsRestricted', 79 'sub_points': ['UI/CloneState/AgentMissionsCapped']}]) 80 81 82 class CloneStateSelectionIndicatorLine(SelectionIndicatorLine): 83 default_color = eveColor.OMEGA_YELLOW 84 85 86 class CloneStateWindowUnderlay(WindowUnderlay): 87 default_clipChildren = True 88 89 def ConstructLayout(self): 90 super(CloneStateWindowUnderlay, self).ConstructLayout() 91 self.video = StreamingVideoSprite(parent=self, videoPath='res:/video/shared/SplashBGLoop.webm', videoLoop=True, align=carbonui.Align.CENTERTOP, width=640, height=360, top=-35, color=eveColor.Color(*eveColor.OMEGA_YELLOW).SetSaturation(0.5).GetRGBA(), opacity=0, spriteEffect=trinity.TR2_SFX_COPY, blendMode=trinity.TR2_SBM_ADD) 92 eveui.fade_in(self.video, end_value=0.6, duration=2) 93 self.background_image = Sprite(name='bgTexture', parent=self, align=carbonui.Align.CENTERTOP, width=540, height=729, texturePath='res:/UI/Texture/Classes/CloneGrade/background.png') 94 95 def ConstructAccentLine(self): 96 self.headerAccentLine = CloneStateSelectionIndicatorLine(parent=self, align=carbonui.Align.TOTOP_NOPUSH, weight=self.ACCENT_LINE_THICKNESS) 97 98 def OnColorThemeChanged(self): 99 pass 100 101 102 class CloneStateWindow(Window): 103 default_windowID = 'clone_state_window' 104 default_isCollapseable = False 105 default_isMinimizable = False 106 default_isLightBackgroundConfigurable = False 107 default_isStackable = False 108 default_isLockable = False 109 default_isOverlayable = False 110 default_extend_content_into_header = True 111 default_width = 540 112 default_height = 729 113 default_minSize = (default_width, default_height) 114 default_maxSize = (default_width, default_height) 115 hasWindowIcon = False 116 117 def ApplyAttributes(self, attributes): 118 if not attributes.show_upgrade_buttons: 119 attributes['analyticID'] = None 120 elif attributes.omega: 121 attributes['analyticID'] = 'omega_upgrade_window' 122 else: 123 attributes['analyticID'] = 'omega_lapsed_window' 124 Window.ApplyAttributes(self, attributes) 125 self.MakeUnResizeable() 126 self._origin = attributes.origin 127 self._reason = attributes.reason 128 self._construct_top(attributes.omega, attributes.headline_label) 129 if attributes.show_upgrade_buttons: 130 self._construct_upgrade_buttons(len(attributes.bullet_points), attributes.omega) 131 self._log_window_opened() 132 self._construct_body(attributes.body_header_label, attributes.body_header_color, attributes.body_header_icon_class, attributes.bullet_points) 133 134 def Prepare_Background_(self): 135 self.sr.underlay = CloneStateWindowUnderlay(parent=self, padding=1) 136 137 def _construct_top(self, omega, headline_label): 138 icon_container = Container(parent=self.content, pickState=carbonui.PickState.OFF, align=carbonui.Align.CENTERTOP, top=60, width=128, height=128) 139 if omega: 140 Sprite(parent=icon_container, align=carbonui.Align.CENTER, texturePath='res:/UI/Texture/Classes/CloneGrade/omega_hex_icon_128.png', outputMode=carbonui.uiconst.OUTPUT_COLOR_AND_GLOW, glowBrightness=0.3, height=51, width=46) 141 Sprite(parent=icon_container, align=carbonui.Align.CENTER, texturePath='res:/UI/Texture/Classes/CloneGrade/omega_hex_bg_128.png', outputMode=carbonui.uiconst.OUTPUT_COLOR_AND_GLOW, height=94, width=110) 142 else: 143 Sprite(parent=icon_container, align=carbonui.Align.CENTER, texturePath='res:/UI/Texture/Classes/CloneGrade/Alpha_128.png', outputMode=carbonui.uiconst.OUTPUT_COLOR_AND_GLOW, glowBrightness=0.3, height=128, width=128) 144 carbonui.text.styles.TextHeadline(parent=self.content, align=carbonui.Align.TOTOP, textAlign=carbonui.TextAlign.CENTER, color=carbonui.TextColor.HIGHLIGHT, bold=True, top=183, outputMode=carbonui.uiconst.OUTPUT_COLOR_AND_GLOW, glowBrightness=0.5, text=localization.GetByLabel(headline_label)) 145 146 def _construct_body(self, body_header_label, body_header_color, body_header_icon_class, bullet_points): 147 wrapper = Container(parent=self.content, align=carbonui.Align.TOALL, padding=(35, 60, 35, 35)) 148 Frame(bgParent=wrapper, texturePath='res:/UI/Texture/classes/Button/background_cut_bottom_left_right.png', cornerSize=9, color=(0, 0, 0, 0.85)) 149 title_container = ContainerAutoSize(parent=wrapper, align=carbonui.Align.CENTERTOP, alignMode=carbonui.Align.CENTERLEFT, height=32, top=-16) 150 StretchSpriteHorizontal(bgParent=title_container, texturePath='res:/UI/Texture/Classes/CloneGrade/omegaHilite.png', leftEdgeSize=12, rightEdgeSize=12, color=(0, 0, 0)) 151 icon_container = Container(parent=title_container, align=carbonui.Align.CENTERLEFT, height=32, width=32, left=6) 152 body_header_icon_class(parent=icon_container, align=carbonui.Align.CENTER, pickState=carbonui.PickState.OFF) 153 carbonui.text.styles.TextBody(parent=title_container, align=carbonui.Align.CENTERLEFT, text=localization.GetByLabel(body_header_label), color=body_header_color, left=36, padRight=16) 154 bullet_points_container = ScrollContainer(parent=wrapper, align=carbonui.Align.TOALL, padding=32) 155 _, text_height = carbonui.text.styles.TextBody.MeasureTextSize(' ') 156 _, sub_point_text_height = carbonui.text.styles.TextDetail.MeasureTextSize(' ') 157 for index, bullet_point in enumerate(bullet_points): 158 sub_points = bullet_point.get('sub_points', []) 159 icon_size = 24 if sub_points else 32 160 padding = 8 if sub_points else 10 161 container = ContainerAutoSize(parent=bullet_points_container, align=carbonui.Align.TOTOP, alignMode=carbonui.Align.TOTOP, padTop=padding, padBottom=padding, opacity=0) 162 eveui.fade_in(container, duration=0.5, time_offset=index * 0.2) 163 text_container = ContainerAutoSize(parent=container, align=carbonui.Align.TOTOP, alignMode=carbonui.Align.TOTOP) 164 Sprite(parent=text_container, align=carbonui.Align.CENTERLEFT, width=icon_size, height=icon_size, texturePath=bullet_point['icon']) 165 carbonui.text.styles.TextBody(parent=text_container, align=carbonui.Align.TOTOP, text=localization.GetByLabel(bullet_point['label']), color=carbonui.TextColor.HIGHLIGHT, padLeft=icon_size + 8) 166 for sub_point in sub_points: 167 bullet_point_container = ContainerAutoSize(parent=container, align=carbonui.Align.TOTOP, alignMode=carbonui.Align.TOTOP, padLeft=icon_size + 10) 168 Sprite(parent=bullet_point_container, align=carbonui.Align.TOPLEFT, width=2, height=2, top=sub_point_text_height / 2 - 1, texturePath='res:/UI/Texture/Shared/smallDot.png', color=carbonui.TextColor.NORMAL) 169 carbonui.text.styles.TextDetail(parent=bullet_point_container, align=carbonui.Align.TOTOP, text=localization.GetByLabel(sub_point), padLeft=6) 170 171 def _construct_upgrade_buttons(self, num_bulletpoints, omega): 172 container = Container(parent=self.content, align=carbonui.Align.TOBOTTOM_NOPUSH, height=40, top=15, opacity=0) 173 eveui.fade_in(container, duration=num_bulletpoints * 0.2, time_offset=0.5) 174 left = Container(parent=container, align=carbonui.Align.TOLEFT_PROP, width=0.5) 175 right = Container(parent=container, align=carbonui.Align.TOALL) 176 store_button = UpgradeIconButton(parent=left, align=carbonui.Align.CENTERRIGHT, height=40, left=4, text=localization.GetByLabel('UI/CloneState/UpgradeInStore'), icon='res:/UI/Texture/Icons/79_64_11.png', iconSize=(16, 16), onClick=self._upgrade_in_store, analyticID='upgrade_omega_secure' if omega else 'upgrade_omega_lapsed_secure') 177 plex_button = UpgradeIconButton(parent=right, align=carbonui.Align.CENTERLEFT, height=40, left=4, text=localization.GetByLabel('UI/CloneState/UpgradeWithPLEX'), icon=eveicon.plex, iconSize=(16, 16), onClick=self._upgrade_with_plex, analyticID='upgrade_omega_nes' if omega else 'upgrade_omega_lapsed_nes') 178 width = max(store_button.width, plex_button.width) + 4 179 store_button.width = width 180 plex_button.width = width 181 182 def _upgrade_in_store(self, *args, **kwargs): 183 upgrade_clone_action(self._origin, self._reason) 184 self.Close() 185 186 def _upgrade_with_plex(self, *args, **kwargs): 187 sm.GetService('vgsService').OpenStore(categoryTag=CATEGORYTAG_GAMETIME) 188 self.Close() 189 190 @threadutils.threaded 191 def _log_window_opened(self): 192 with ExceptionEater('eventLog'): 193 sm.ProxySvc('eventLog').LogClientEvent('trial', ['origin', 'reason'], 'ShowCloneUpgradeWindow', self._origin, self._reason)