fwEnlistmentWnd.py (25998B)
1 #Embedded file name: C:\BuildAgent\work\20d73f1b24eed06e\eve\release\V24.01\eve\client\script\ui\shared\factionalWarfare\enlistmentFlow\fwEnlistmentWnd.py 2 from eve.client.script.ui import eveColor 3 import signals 4 import uthread2 5 from carbon.common.script.sys.serviceConst import ROLE_PROGRAMMER 6 from carbonui import TextColor 7 from carbonui.text.styles import TextBody 8 from carbonui.text.custom import TextCustom 9 from carbonui.control.window import Window 10 from carbonui.primitives.container import Container 11 import carbonui.const as uiconst 12 from carbonui.primitives.containerAutoSize import ContainerAutoSize 13 from carbonui.primitives.layoutGrid import LayoutGrid 14 from carbonui.primitives.sprite import Sprite 15 from carbonui.uianimations import animations 16 import eve.client.script.ui.shared.factionalWarfare.enlistmentFlow.enlistmentUtil as enlistmentUtil 17 from eve.client.script.ui.shared.factionalWarfare.enlistmentFlow.backgroundDeco import BackgroundDeco 18 from eve.client.script.ui.shared.factionalWarfare.enlistmentFlow.enlistmentConst import SELECTED_PIRATES, SELECTED_EMPIRE, SELECTED_PAGE_FRONT, SELECTED_PAGE_FACTIONPICKER, NODE_SIZE, BG_TEXTURE_PATH_BY_SIDE, INFO_MAX_WIDTH 19 from eve.client.script.ui.shared.factionalWarfare.enlistmentFlow.factionBanner import FactionBanner 20 from eve.client.script.ui.shared.factionalWarfare.enlistmentFlow.factionCircle import EnlistmentCircleView, EnlistmentCenterCont 21 from eve.client.script.ui.shared.factionalWarfare.enlistmentFlow.backBtn import BackBtnFront 22 from eve.client.script.ui.shared.factionalWarfare.enlistmentFlow.frontPageCont import EnlistmentFrontPageCont 23 from eve.client.script.ui.shared.factionalWarfare.enlistmentFlow.infoPicker import InfoPickerCont 24 from eve.common.script.util.facwarCommon import GetPirateFWFactions, IsPirateFWFaction 25 from eveexceptions import ExceptionEater 26 from jobboard.client import get_job_board_service 27 import eve.common.lib.appConst as appConst 28 from localization import GetByLabel 29 FACTION_CIRCLE_SIZE = 370 30 OUTER_CIRCLE_CONT_WIDTH = 640 31 INNER_CIRCLE_OFFSET = 60 32 INNER_CIRCLE_SIZE_BIG = 650 33 CIRCLE_OFFSET_PAGE2 = 500 34 35 class EnlistmentController(object): 36 37 def __init__(self): 38 self.pageSelected = SELECTED_PAGE_FRONT 39 self.insurgencySideSelected = 0 40 self.selectedFactionID = None 41 self.hoveredFactionID = None 42 self.isMovingCircle = False 43 self.on_mouse_enter = signals.Signal('EnlistmentController_on_mouse_enter') 44 self.on_mouse_exit = signals.Signal('EnlistmentController_on_mouse_exit') 45 self.on_node_clicked = signals.Signal('EnlistmentController_on_click') 46 self.on_back_mouse_enter = signals.Signal('EnlistmentController_on_back_mouse_enter') 47 self.on_back_mouse_exit = signals.Signal('EnlistmentController_on_back_mouse_exit') 48 self.on_empire_pirates_clicked = signals.Signal('EnlistmentController_on_empire_pirates_clicked') 49 self.on_insurgency_side_mouse_enter = signals.Signal('EnlistmentController_on_insurgency_side_mouse_enter') 50 self.on_insurgency_side_mouse_exit = signals.Signal('EnlistmentController_on_insurgency_side_mouse_exit') 51 self.on_page_selected_updated = signals.Signal('EnlistmentController_on_page_selected_updated') 52 self.trigger_page_update = signals.Signal('EnlistmentController_trigger_page_update') 53 54 def ClearSignals(self): 55 self.on_mouse_enter.clear() 56 self.on_mouse_exit.clear() 57 self.on_node_clicked.clear() 58 59 def SelectInsurgencySide(self, insurgencySide): 60 self.pageSelected = SELECTED_PAGE_FACTIONPICKER 61 self.insurgencySideSelected = insurgencySide 62 63 def SetHoverdFactionID(self, factionID): 64 self.hoveredFactionID = factionID 65 66 def ResetSelectedHoveredFactionID(self): 67 self.selectedFactionID = None 68 self.hoveredFactionID = None 69 70 def SetFrontPageSelected(self, notify = True): 71 self.pageSelected = SELECTED_PAGE_FRONT 72 if notify: 73 self.on_page_selected_updated() 74 75 def SelectInsurgencySideFromFactionID(self, factionID): 76 if IsPirateFWFaction(factionID): 77 self.SelectInsurgencySide(SELECTED_PIRATES) 78 return 79 self.SelectInsurgencySide(SELECTED_EMPIRE) 80 81 def GetTrackedFactionID(self): 82 provider = get_job_board_service().get_provider(enlistmentUtil.JOB_PROVIDER) 83 if not provider.is_enabled: 84 return None 85 trackedJobs = provider.get_tracked_jobs() 86 if trackedJobs: 87 return trackedJobs[0].faction_id 88 89 90 class FwEnlistmentWnd(Window): 91 default_width = 1280 92 default_height = 720 93 default_windowID = 'fwEnlistmentWnd' 94 default_iconNum = 'res:/ui/Texture/WindowIcons/factionalwarfare.png' 95 default_captionLabelPath = 'UI/FactionWarfare/FwEnlistmentWnd' 96 default_minSize = (1280, 720) 97 default_fixedWidth = 1280 98 default_fixedHeight = 720 99 default_isStackable = False 100 hasWindowIcon = False 101 default_extend_content_into_header = True 102 103 def DebugReload(self, *args): 104 self.Reload(self) 105 106 def ApplyAttributes(self, attributes): 107 super(FwEnlistmentWnd, self).ApplyAttributes(attributes) 108 self.header.show_caption = False 109 self.panel = FwEnlistmentPanel(parent=self.content) 110 uthread2.StartTasklet(self.panel.UpdateWnd) 111 self.ConnectSignals() 112 113 def Close(self, *args, **kwds): 114 with ExceptionEater('Close: FwEnlistmentWnd'): 115 self.DisconnectSignals() 116 super(FwEnlistmentWnd, self).Close(*args, **kwds) 117 118 def ConnectSignals(self): 119 self.on_end_scale.connect(self.OnEndScale) 120 self.on_start_scale.connect(self.OnStartScale) 121 122 def DisconnectSignals(self): 123 self.on_end_scale.disconnect(self.OnEndScale) 124 self.on_start_scale.disconnect(self.OnStartScale) 125 126 def OnStartScale(self, wnd): 127 self.panel.OnStartScale() 128 129 def OnEndScale(self, wnd): 130 self.panel.OnEndScale() 131 132 133 class FwEnlistmentPanel(Container): 134 default_name = 'fwEnlistmentPanel' 135 default_align = uiconst.TOALL 136 137 def ApplyAttributes(self, attributes): 138 super(FwEnlistmentPanel, self).ApplyAttributes(attributes) 139 self.circleView = None 140 self.ConnectSignals() 141 self.contentCont = Container(name='contentCont', parent=self, clipChildren=True) 142 self.ConstructCircle() 143 self.ConstructBackground() 144 self.ContructRightCont() 145 146 def ConnectSignals(self): 147 self.enlistmentController = EnlistmentController() 148 self.enlistmentController.on_mouse_enter.connect(self.OnFactionMouseEnter) 149 self.enlistmentController.on_mouse_exit.connect(self.OnFactionMouseExit) 150 self.enlistmentController.on_back_mouse_enter.connect(self.OnBackMouseEnter) 151 self.enlistmentController.on_back_mouse_exit.connect(self.OnBackMouseExit) 152 self.enlistmentController.on_node_clicked.connect(self.OnNodeClicked) 153 self.enlistmentController.on_empire_pirates_clicked.connect(self.OnEmpirePiratesClicked) 154 self.enlistmentController.on_page_selected_updated.connect(self.OnPageSelectedUpdated) 155 self.enlistmentController.trigger_page_update.connect(self.PageUpdateTriggered) 156 self.enlistmentController.on_insurgency_side_mouse_enter.connect(self.OnInsurgencySideMouseEnter) 157 self.enlistmentController.on_insurgency_side_mouse_exit.connect(self.OnInsurgencySideMouseExit) 158 159 def UpdateWnd(self): 160 self.UpdateCircle() 161 if not self.enlistmentController.selectedFactionID: 162 factionIDToShow = session.warfactionid or self.enlistmentController.GetTrackedFactionID() 163 if factionIDToShow: 164 self.SelectFaction(factionIDToShow, animate=False) 165 self.enlistmentController.SelectInsurgencySideFromFactionID(factionIDToShow) 166 self.LoadNodes() 167 self.UpdatePages(animate=False) 168 169 def ConstructBackground(self): 170 self.bgCont = Container(name='bgCont', parent=self, align=uiconst.TOALL, clipChildren=True) 171 self.decoBgCont = Container(parent=self.bgCont, name='decoBgCont') 172 self.bgSpriteFrontpage = Sprite(name='bgSpriteFrontpage', parent=self.decoBgCont, align=uiconst.CENTER, pos=(0, 0, 1280, 720), opacity=0, state=uiconst.UI_DISABLED) 173 self.bgSpritePage1 = Sprite(name='bgSpritePage1', parent=self.decoBgCont, align=uiconst.CENTER, pos=(0, 0, 1280, 720), opacity=0, state=uiconst.UI_DISABLED) 174 self.bgSprite = Sprite(name='bgSprite', parent=self.bgCont, align=uiconst.CENTER, pos=(0, 0, 1280, 720), state=uiconst.UI_DISABLED) 175 176 def ConstructCircle(self): 177 self.outerCircleCont = Container(name='outerCircleCont', parent=self.contentCont, align=uiconst.TOLEFT, width=OUTER_CIRCLE_CONT_WIDTH) 178 self.circleCont = Container(name='circleCont', parent=self.outerCircleCont, align=uiconst.CENTER, pos=(INNER_CIRCLE_OFFSET, 179 0, 180 INNER_CIRCLE_SIZE_BIG, 181 INNER_CIRCLE_SIZE_BIG)) 182 self.backBtnFrontPage = BackBtnFront(parent=self.outerCircleCont, align=uiconst.CENTERLEFT, pos=(0, 183 0, 184 NODE_SIZE, 185 NODE_SIZE), idx=0, enlistmentController=self.enlistmentController) 186 self.ConstructFrontPage() 187 self.factionContentCont = Container(name='factionContentCont', parent=self.circleCont) 188 self.enlistmentCenterCont = EnlistmentCenterCont(parent=self.factionContentCont, enlistmentController=self.enlistmentController) 189 self.circleView = EnlistmentCircleView(parent=self.factionContentCont, width=720, height=self.height, state=uiconst.UI_NORMAL, enlistmentController=self.enlistmentController) 190 self.circleView.innerCircles.opacity = 0 191 self.circleView.fill.outputMode = uiconst.OUTPUT_COLOR 192 self.bgDeco = BackgroundDeco(parent=self.circleCont, align=uiconst.CENTER) 193 194 def LoadEmpireFactions(self): 195 factionIDs = [appConst.factionAmarrEmpire, 196 appConst.factionCaldariState, 197 appConst.factionMinmatarRepublic, 198 appConst.factionGallenteFederation] 199 self.circleView.LoadNodes(factionIDs) 200 self.page1.UpdateHeaderAndText(GetByLabel('UI/FactionWarfare/Enlistment/FactionalWarfareHeader'), GetByLabel('UI/FactionWarfare/Enlistment/FactionalWarfareDescription')) 201 self.enlistmentCenterCont.LoadCenterText(GetByLabel('UI/FactionWarfare/Enlistment/ClickOnEmpireFaction')) 202 self.enlistmentCenterCont.LoadCenterIcon('res:/ui/Texture/classes/frontlines/factionalwarfare_icon.png') 203 204 def LoadPirateFactions(self): 205 factionIDs = GetPirateFWFactions() 206 self.circleView.LoadNodes(factionIDs) 207 self.page1.UpdateHeaderAndText(GetByLabel('UI/FactionWarfare/Enlistment/PiratesHeader'), GetByLabel('UI/FactionWarfare/Enlistment/PiratesDescription')) 208 self.enlistmentCenterCont.LoadCenterText(GetByLabel('UI/FactionWarfare/Enlistment/ClickOnPirateFaction')) 209 self.enlistmentCenterCont.LoadCenterIcon('res:/UI/Texture/eveicon/theatres_of_war/pirates_64px.png') 210 211 def OnFactionMouseEnter(self, factionID): 212 self.enlistmentController.SetHoverdFactionID(factionID) 213 self.UpdateDecoColor() 214 self.circleView.UpdateFaction() 215 self.page1.UpdateFaction(factionID) 216 self.enlistmentCenterCont.ShowFaction(factionID) 217 self.UpdateBackgroundSprites(True) 218 219 def OnFactionMouseExit(self, factionID): 220 self.enlistmentController.SetHoverdFactionID(None) 221 self.UpdateDecoColor() 222 self.circleView.UpdateFaction() 223 self.page1.UpdateFaction(None) 224 self.page2.UpdateFaction(None) 225 self.enlistmentCenterCont.ShowFaction(None) 226 self.UpdateBackgroundSprites(True) 227 228 def UpdateDecoColor(self): 229 factionID = self.enlistmentController.selectedFactionID or self.enlistmentController.hoveredFactionID 230 decoColor = enlistmentUtil.GetFactionColor(factionID) or eveColor.CRYO_BLUE 231 self.bgDeco.ColorSprites(decoColor) 232 return decoColor 233 234 def OnBackMouseEnter(self): 235 if self.enlistmentController.selectedFactionID and not self.enlistmentController.isMovingCircle: 236 self.UpdateLeft(offset=20, duration=0.1) 237 238 def OnBackMouseExit(self): 239 if self.enlistmentController.selectedFactionID and not self.enlistmentController.isMovingCircle: 240 self.UpdateLeft(offset=0.0, duration=0.1) 241 242 def OnNodeClicked(self, factionID): 243 self.SelectFaction(factionID) 244 245 def SelectFaction(self, factionID, animate = True): 246 if self.enlistmentController.selectedFactionID == factionID: 247 self.enlistmentController.selectedFactionID = None 248 self.enlistmentCenterCont.ShowFaction(None) 249 else: 250 self.enlistmentController.selectedFactionID = factionID 251 self.enlistmentCenterCont.ShowFaction(factionID) 252 self.UpdatePages(animate=animate) 253 254 def ConstructFrontPage(self): 255 self.frontPage = EnlistmentFrontPageCont(parent=self.circleCont, align=uiconst.TOALL, enlistmentController=self.enlistmentController) 256 self.frontPage.Hide() 257 258 def ContructRightCont(self): 259 self.rightCont = Container(name='rightCont', parent=self.contentCont, align=uiconst.TOALL) 260 self.page1 = EnlistmentPage1(parent=self.rightCont, align=uiconst.TOALL, padLeft=180) 261 self.page2 = EnlistmentPage2(parent=self.rightCont, align=uiconst.TOALL, padLeft=0) 262 self.page2.Hide() 263 264 def UpdateLeft(self, animate = True, offset = 0.0, duration = enlistmentUtil.ANIM_DURATION): 265 factionID = self.enlistmentController.selectedFactionID 266 newCircleLeft = -CIRCLE_OFFSET_PAGE2 if factionID else 0 267 newCircleLeft = newCircleLeft + offset 268 self.enlistmentController.hoveredFactionID = None 269 if animate: 270 self.enlistmentController.isMovingCircle = True 271 animations.MorphScalar(self.outerCircleCont, 'left', self.outerCircleCont.left, newCircleLeft, duration=duration, callback=self.OnMovingFinished) 272 else: 273 self.outerCircleCont.left = newCircleLeft 274 self.enlistmentController.isMovingCircle = False 275 276 def OnMovingFinished(self): 277 self.enlistmentController.isMovingCircle = False 278 self.circleView.MovingFinished() 279 self.UpdateDecoColor() 280 281 def PageUpdateTriggered(self, animate = False): 282 self.UpdatePages(animate) 283 284 def UpdatePages(self, animate = True): 285 if self.enlistmentController.pageSelected == SELECTED_PAGE_FRONT: 286 return self.UpdatePagesFrontVisible(animate) 287 self.UpdatePagesFactionsVisible(animate) 288 289 def UpdatePagesFrontVisible(self, animate): 290 self.bgDeco.SetMainCircleSize(True, animate) 291 self.frontPage.Show() 292 self.backBtnFrontPage.Hide() 293 self.backBtnFrontPage.opacity = 0.0 294 w, _ = self.GetAbsoluteSize() 295 newCircleContWidth = w 296 newCircleLeft = -INNER_CIRCLE_OFFSET 297 self.bgSpriteFrontpage.Show() 298 if animate: 299 animations.FadeOut(self.rightCont, callback=self.rightCont.Hide) 300 animations.FadeOut(self.factionContentCont, callback=self.factionContentCont.Hide) 301 animations.FadeIn(self.frontPage, duration=0.5, timeOffset=0.25) 302 self.enlistmentController.isMovingCircle = True 303 animations.MorphScalar(self.outerCircleCont, 'left', self.outerCircleCont.left, newCircleLeft) 304 animations.MorphScalar(self.outerCircleCont, 'width', self.outerCircleCont.width, newCircleContWidth, callback=self.OnMovingFinished) 305 else: 306 self.rightCont.Hide() 307 self.factionContentCont.Hide() 308 self.factionContentCont.opacity = 0.0 309 self.outerCircleCont.width = newCircleContWidth 310 self.outerCircleCont.left = newCircleLeft 311 self.frontPage.opacity = 1.0 312 self.enlistmentController.isMovingCircle = False 313 314 def UpdatePagesFactionsVisible(self, animate): 315 self.factionContentCont.Show() 316 self.backBtnFrontPage.Show() 317 self.bgSpriteFrontpage.Hide() 318 newCircleContWidth = OUTER_CIRCLE_CONT_WIDTH 319 self.rightCont.Show() 320 self.rightCont.opacity = 1.0 321 if animate: 322 animations.FadeIn(self.factionContentCont, duration=0.5, timeOffset=0.25) 323 animations.FadeIn(self.backBtnFrontPage, duration=0.5, timeOffset=0.75) 324 animations.MorphScalar(self.outerCircleCont, 'width', self.outerCircleCont.width, newCircleContWidth) 325 animations.FadeOut(self.frontPage, callback=self.frontPage.Hide) 326 else: 327 self.factionContentCont.opacity = 1.0 328 self.backBtnFrontPage.opacity = 1.0 329 self.outerCircleCont.width = newCircleContWidth 330 self.frontPage.Hide() 331 self.frontPage.opacity = 0.0 332 self.bgDeco.SetMainCircleSize(False, animate) 333 if animate: 334 self.bgDeco.Animate() 335 self.UpdateLeft(animate) 336 factionID = self.enlistmentController.selectedFactionID 337 factionIdSet = bool(factionID) 338 self.page1.ChangeDisplay(showPage=not factionIdSet, animate=animate) 339 self.page1.UpdateFaction(factionID) 340 self.page2.ChangeDisplay(showPage=factionIdSet, animate=animate) 341 self.page2.UpdateFaction(factionID) 342 self.UpdateBackgroundSprites(animate) 343 self.circleView.UpdateFaction(animate) 344 self.UpdateDecoColor() 345 346 def OnStartScale(self): 347 animations.FadeOut(self.outerCircleCont, duration=1.0) 348 349 def OnEndScale(self): 350 animations.FadeIn(self.outerCircleCont) 351 self.UpdateCircle() 352 353 def UpdateCircle(self): 354 if self.circleView: 355 self.circleView.width = self.circleView.height = FACTION_CIRCLE_SIZE + self.circleView.GetNodeSize() 356 self.circleView.UpdateCircle() 357 if self.enlistmentController.pageSelected == SELECTED_PAGE_FRONT: 358 w, _ = self.GetAbsoluteSize() 359 circleContWidth = w 360 else: 361 circleContWidth = OUTER_CIRCLE_CONT_WIDTH 362 self.outerCircleCont.width = circleContWidth 363 364 def UpdateBackgroundSprites(self, animate): 365 self.UpdateFactionBg(animate) 366 self.UpdateMapBg(animate) 367 368 def UpdateFactionBg(self, animate): 369 factionID = self.enlistmentController.selectedFactionID 370 texturePath = enlistmentUtil.GetBgTexturePath(factionID) 371 self._UpdateBg(bool(factionID), self.bgSprite, texturePath, animate) 372 373 def _UpdateBg(self, show, sprite, texturePath, animate, fullOpacity = 1.0): 374 if animate: 375 if show: 376 self._SetBgBackground(sprite, texturePath) 377 sprite.texturePath = texturePath 378 animations.FadeIn(sprite, endVal=fullOpacity, duration=1.0) 379 else: 380 animations.FadeOut(sprite, duration=0.5, callback=lambda *args: self._SetBgBackground(sprite, texturePath)) 381 else: 382 self._SetBgBackground(sprite, texturePath) 383 if show: 384 sprite.opacity = fullOpacity 385 else: 386 sprite.opacity = 0.0 387 388 def _SetBgBackground(self, sprite, texturePath): 389 sprite.texturePath = texturePath 390 391 def UpdateMapBg(self, animate): 392 factionID = self.enlistmentController.hoveredFactionID 393 texturePath = enlistmentUtil.GetMapBgTexturePath(factionID) 394 self._UpdateBg(bool(factionID), self.bgSpritePage1, texturePath, animate, fullOpacity=enlistmentUtil.BG_MAP_OPACITY) 395 396 def OnEmpirePiratesClicked(self): 397 self.bgDeco.Animate(True) 398 self.LoadNodes() 399 self.UpdateSection(animate=True) 400 self.UpdatePages(animate=True) 401 402 def LoadNodes(self): 403 if self.enlistmentController.insurgencySideSelected == SELECTED_PIRATES: 404 self.LoadPirateFactions() 405 else: 406 self.LoadEmpireFactions() 407 408 def OnPageSelectedUpdated(self): 409 self.UpdateSection(animate=True) 410 411 def UpdateSection(self, animate = False): 412 currentSelection = self.enlistmentController.pageSelected 413 if currentSelection == SELECTED_PAGE_FRONT: 414 if animate: 415 self.factionContentCont.Hide() 416 self.frontPage.Show() 417 else: 418 self.factionContentCont.Hide() 419 self.frontPage.Show() 420 elif currentSelection == SELECTED_PAGE_FACTIONPICKER: 421 self.frontPage.Hide() 422 self.factionContentCont.Show() 423 424 def GoBackToFrontPage(self, *args): 425 self.enlistmentController.ResetSelectedHoveredFactionID() 426 self.enlistmentController.pageSelected = SELECTED_PAGE_FRONT 427 self.UpdateFactionBg(animate=False) 428 self.UpdateSection() 429 430 def Close(self): 431 with ExceptionEater('Close: FwEnlistmentPanel'): 432 self.enlistmentController.ClearSignals() 433 self.enlistmentController = None 434 super(FwEnlistmentPanel, self).Close() 435 436 def OnInsurgencySideMouseEnter(self, insurgencySideID): 437 texturePath = BG_TEXTURE_PATH_BY_SIDE.get(insurgencySideID, '') 438 self._UpdateBg(True, self.bgSpriteFrontpage, texturePath, True) 439 440 def OnInsurgencySideMouseExit(self, insurgencySideID): 441 self._UpdateBg(False, self.bgSpriteFrontpage, '', True) 442 443 444 class EnlistmentPage1(Container): 445 default_name = 'EnlistmentPage1' 446 447 def ApplyAttributes(self, attributes): 448 super(EnlistmentPage1, self).ApplyAttributes(attributes) 449 self.textCont = ContainerAutoSize(name='textCont', parent=self, align=uiconst.CENTERLEFT) 450 grid = LayoutGrid(parent=self.textCont, align=uiconst.TOPLEFT, columns=1) 451 self.headerLabel = TextCustom(name='headerLabel', parent=grid, text='', align=uiconst.TOPLEFT, fontsize=34) 452 self.descLabel = TextBody(name='descLabel', parent=grid, text='', align=uiconst.TOPLEFT, maxWidth=360, color=TextColor.NORMAL) 453 factionContParent = Container(parent=self, align=uiconst.TOBOTTOM_PROP, height=0.6) 454 self.factionCont = FactionInfoCont(parent=factionContParent) 455 456 def UpdateHeaderAndText(self, headerText, descText): 457 self.headerLabel.text = headerText 458 self.descLabel.text = descText 459 460 def UpdateFaction(self, factionID): 461 if factionID: 462 self.textCont.Hide() 463 self.factionCont.LoadFaction(factionID) 464 self.factionCont.Show() 465 else: 466 self.textCont.Show() 467 self.factionCont.Hide() 468 469 def ChangeDisplay(self, showPage, animate = True): 470 if animate: 471 if showPage: 472 self.Show() 473 animations.FadeIn(self) 474 endVal = TextColor.NORMAL[3] 475 animations.FadeIn(self.descLabel, endVal=endVal, duration=1.0, timeOffset=0.1) 476 else: 477 animations.FadeOut(self, callback=self.Hide) 478 animations.FadeOut(self.descLabel) 479 elif showPage: 480 self.Show() 481 else: 482 self.Hide() 483 484 485 class EnlistmentPage2(Container): 486 default_name = 'EnlistmentPage2' 487 default_clipChildren = True 488 489 def ApplyAttributes(self, attributes): 490 super(EnlistmentPage2, self).ApplyAttributes(attributes) 491 self.ConstructFactionBanner() 492 self.ConstructInfoCont() 493 494 def ConstructInfoCont(self): 495 factionContParent = Container(parent=self, align=uiconst.TOBOTTOM_PROP, height=0.6) 496 self.infoCont = FactionInfoCont(parent=factionContParent) 497 self.infoPickerCont = InfoPickerCont() 498 self.infoCont.AddCell(self.infoPickerCont) 499 500 def ConstructFactionBanner(self): 501 self.factionBanner = FactionBanner(parent=self, align=uiconst.TORIGHT, opacity=0.0) 502 503 def UpdateFaction(self, factionID): 504 if factionID: 505 self.infoCont.Show() 506 self.factionBanner.Show() 507 self.factionBanner.LoadFactionID(factionID) 508 self.infoCont.LoadFaction(factionID) 509 self.infoPickerCont.UpdateFaction(factionID) 510 else: 511 self.infoCont.Hide() 512 self.factionBanner.Hide() 513 self.infoPickerCont.UpdateFaction(None) 514 515 def ChangeDisplay(self, showPage, animate = True): 516 wasVisible = self.display 517 if animate: 518 if showPage: 519 self.Show() 520 animations.FadeIn(self) 521 animations.MorphScalar(self.factionBanner, 'left', -self.factionBanner.width, 0) 522 animations.FadeIn(self.factionBanner, duration=2.0) 523 if not wasVisible: 524 self.infoCont.AnimateIn() 525 animations.FadeTo(self.infoPickerCont, duration=2.0) 526 else: 527 animations.FadeOut(self, callback=self.Hide) 528 self.factionBanner.opacity = 0.0 529 elif showPage: 530 self.Show() 531 self.factionBanner.left = 0 532 self.factionBanner.opacity = 1.0 533 else: 534 self.Hide() 535 self.factionBanner.opacity = 0.0 536 537 538 class FactionInfoCont(LayoutGrid): 539 default_columns = 1 540 align = uiconst.TOPLEFT 541 542 def ApplyAttributes(self, attributes): 543 super(FactionInfoCont, self).ApplyAttributes(attributes) 544 Container(name='spacer', parent=self, pos=(0, 545 0, 546 INFO_MAX_WIDTH, 547 0), align=uiconst.TOPLEFT) 548 self.factionNameLabel = TextCustom(name='factionNameLabel', parent=self, fontsize=56, align=uiconst.TOPLEFT, uppercase=True, bold=True, maxWidth=450) 549 self.factionMottoLabel = TextCustom(name='factionNameLabel', parent=self, fontsize=24, align=uiconst.TOPLEFT, uppercase=True) 550 551 def LoadFaction(self, factionID): 552 self.factionNameLabel.text = cfg.eveowners.Get(factionID).name 553 mottoPath = enlistmentUtil.mottoPathByFactionID.get(factionID, '') 554 self.factionMottoLabel.text = GetByLabel(mottoPath) 555 556 def AnimateIn(self): 557 animations.MorphScalar(self.factionNameLabel, 'left', 190, 0) 558 animations.MorphScalar(self.factionMottoLabel, 'left', 190, 0)