def ApplyAttributes(self, attributes): Container.ApplyAttributes(self, attributes) sm.RegisterNotify(self) self.jobData = attributes.jobData self.videoThread = None self.iconCont = Container(name='iconCont', parent=self, align=CENTER, state=uiconst.UI_NORMAL, width=64, height=64) self.errorFrame = ErrorFrame(parent=self, align=uiconst.CENTER, pos=(0, 0, 64, 64), state=uiconst.UI_HIDDEN) self.qtyLabel = EveLabelLargeBold(parent=self, align=CENTER, top=42) FrameThemeColored(name='bgVignette', parent=self, texturePath='res:/UI/Texture/Classes/Industry/Output/bgVignette.png', cornerSize=30) self.videoCont = Container(name='videoCont', parent=self, align=uiconst.CENTER, width=324, height=199) self.previewContFill = FillThemeColored(parent=self) self.previewCont = PreviewContainer(parent=self, align=uiconst.TOALL, state=uiconst.UI_HIDDEN) self.leftProbabilityGradient = GradientSprite(name='leftProbabilityGradient', parent=self, align=uiconst.CENTERLEFT, state=uiconst.UI_HIDDEN, pos=(0, 0, 160, 64), rgbData=((0, (1.0, 1.0, 1.0)),), alphaData=((0.0, 0.5), (1.0, 0.0))) self.rightProbabilityGradient = GradientSprite(name='rightProbabilityGradient', parent=self, align=uiconst.CENTERRIGHT, state=uiconst.UI_HIDDEN, pos=(0, 0, 160, 64), rgbData=((0, (1.0, 1.0, 1.0)),), alphaData=((0.0, 0.0), (1.0, 0.5))) self.previewCont.navigation.LoadTooltipPanel = self.LoadIconContTooltipPanel self.previewCont.navigation.GetTooltipDelay = self.GetIconContTooltipDelay self.previewCont.navigation.GetMenu = self.GetMenu self.iconCont.LoadTooltipPanel = self.LoadIconContTooltipPanel self.iconCont.GetTooltipDelay = self.GetIconContTooltipDelay self.iconCont.OnMouseEnter = self.OnIconContMouseEnter self.iconCont.OnMouseExit = self.OnIconContMouseExit self.iconCont.OnClick = self.OnIconContClick self.iconCont.GetMenu = self.GetMenu self.iconCont.GetDragData = self.GetIconContDragData self.iconCont.isDragObject = True self.techIcon = Sprite(name='techIcon', parent=self.iconCont, width=16, height=16) self.icon = Icon(parent=self.iconCont, align=CENTER, state=uiconst.UI_DISABLED) self.bgCont = Container(name='bgCont', parent=self, align=uiconst.CENTER, width=201, height=192) self.bg = Sprite(bgParent=self.bgCont, texturePath='res:/UI/Texture/Classes/Industry/Output/itemBg.png') self.itemPattern = Sprite(bgParent=self.bgCont, texturePath='res:/UI/Texture/Classes/Industry/Output/itemBgColor.png') self.UpdateState() self.AnimEntry()
def ApplyAttributes(self, attributes): Window.ApplyAttributes(self, attributes) self.taskMap = {} self.controller = None self.buttonCont = Container(parent=self.sr.main, name='buttonbar', align=uiconst.TOTOP, height=24, clipChildren=True) GradientSprite(bgParent=self.buttonCont, rotation=-math.pi / 2, rgbData=[(0, (1.0, 1.0, 1.3))], alphaData=[(0.6, 0.0), (1.0, 0.05)]) self.clockCont = Container(parent=self.sr.main, name='clockbar', align=uiconst.TOTOP, height=24, clipChildren=True) GradientSprite(bgParent=self.buttonCont, rotation=-math.pi / 2, rgbData=[(0, (1.0, 1.0, 1.3))], alphaData=[(0.6, 0.0), (1.0, 0.05)]) self.lastUpdateTime = gametime.GetWallclockTime() self.lastResetTime = gametime.GetWallclockTime() self.currentTimeLabel = eveLabel.EveLabelMedium(parent=self.clockCont, text='', left=8) self.lastUpdateTimeLabel = eveLabel.EveLabelMedium( parent=self.clockCont, text='', left=158) self.lastResetTimeLabel = eveLabel.EveLabelMedium( parent=self.clockCont, text='', left=258) self.leftCont = DragResizeCont( name='leftCont', parent=self.sr.main, align=uiconst.TOLEFT_PROP, settingsID='BehaviorDebugWindowLeftContent', minSize=0.2, maxSize=0.8, defaultSize=0.5) GradientSprite(bgParent=self.leftCont, rotation=0, rgbData=[(0, (1.0, 1.0, 1.3))], alphaData=[(0.8, 0.0), (1.0, 0.05)]) self.mainScroll = ScrollContainer(name='behaviortree', parent=self.leftCont.mainCont, align=uiconst.TOALL, padding=(4, 4, 4, 4)) self.blackboardScroll = ScrollContainer(name='blackboards', parent=self.sr.main, padding=(4, 4, 4, 4)) GradientSprite(bgParent=self.blackboardScroll, rotation=0, rgbData=[(0, (1.0, 1.0, 1.3))], alphaData=[(0.8, 0.0), (1.0, 0.05)]) self.timeUpdateTimer = AutoTimer(1000, self._TimeUpdater)
def _animate_reward(self): self.animated_gradient_background = GradientSprite( name='animated_gradient_background', parent=self.reward_container, align=uiconst.TOALL, rgbData=ANIMATED_GRADIENT_BACKGROUND_RGD_DATA, alphaData=ANIMATED_GRADIENT_BACKGROUND_ALPHA_DATA, opacity=ANIMATED_GRADIENT_BACKGROUND_OPACITY) animations.MorphScalar(self.reward_container, 'width', endVal=self.width, duration=ANIMATED_GRADIENT_BACKGROUND_DURATION, timeOffset=ANIMATED_GRADIENT_BACKGROUND_OFFSET, callback=self._show_reward)
def ApplyAttributes(self, attributes): Container.ApplyAttributes(self, attributes) self.offer = attributes.offer if self.offer: self.CreateInfoBox(attributes.upperText, attributes.lowerText, attributes.upperSize or VGS_FONTSIZE_OFFER, attributes.lowerSize or VGS_FONTSIZE_OFFER) self.imageLayer = Transform(name='imageLayer', parent=self, align=uiconst.TOALL, scalingCenter=(0.5, 0.5), bgColor=OFFER_BACKGROUND_COLOR) if self.offer is not None and self.offer.label is not None: Ribbon(parent=self.imageLayer, align=uiconst.TOPLEFT, label=self.offer.label, state=uiconst.UI_DISABLED, idx=0, isBig=False) if self.offer: self.lazySprite = LazyUrlSprite(parent=self.imageLayer, align=uiconst.TOALL, imageUrl=self.offer.imageUrl) GradientSprite(name='OfferGradient', align=uiconst.TOALL, bgParent=self.imageLayer, rgbData=((1.0, OFFER_RADIAL_SHADOW), ), alphaData=((0.0, 0.0), (1.0, 1.0)), radial=True, idx=0)
def ApplyAttributes(self, attributes): Container.ApplyAttributes(self, attributes) callback = attributes.callback submit = attributes.submit self.oldJobData = None self.jobData = attributes.jobData self.jobsSummary = JobsSummary(parent=self, align=uiconst.CENTERLEFT, left=10) self.activitySelectionButtons = ActivitySelectionButtons( parent=self, align=uiconst.CENTER, callback=callback, width=248, height=38) self.submitBtn = SubmitButton(parent=self, align=uiconst.CENTERRIGHT, fixedheight=30, fixedwidth=125, left=7) GradientSprite(bgParent=self, rotation=-math.pi / 2, rgbData=[(0, (0.3, 0.3, 0.3))], alphaData=[(0, 0.3), (1.0, 0.05)]) FrameUnderlay(bgParent=self, colorType=uiconst.COLORTYPE_UIBASECONTRAST) self.UpdateState()
def AnimFlash(self, color): width = 500 flashCont = Container(parent=self, idx=0, align=uiconst.TOPLEFT, width=width, height=self.height) flashGradient = GradientSprite(bgParent=flashCont, rgbData=[(0, color[:3])], alphaData=[(0, 0.0), (0.9, 0.4), (1.0, 0.0)]) arrows = Sprite( parent=flashCont, align=uiconst.CENTERLEFT, texturePath='res:/UI/Texture/Classes/Industry/CenterBar/arrows.png', pos=(0, 0, 375, self.height), color=color, opacity=0.15, tileX=True) duration = self.width / 600.0 uicore.animations.MorphScalar(flashCont, 'left', -width, self.width + width, duration=duration, curveType=uiconst.ANIM_LINEAR) uicore.animations.FadeTo(flashCont, 0.0, 1.0, duration=duration, callback=flashCont.Close, curveType=uiconst.ANIM_WAVE)
def Layout(self): gaugeCont = Container(parent=self, align=uiconst.TOTOP, height=32) Frame(parent=gaugeCont, texturePath='res:/UI/Texture/classes/skilltrading/frame.png', cornerSize=3, opacity=0.5) self.gaugeBG = GradientSprite(bgParent=gaugeCont, align=uiconst.TOALL, rgbData=[(0.0, (1.0, 1.0, 1.0))], alphaData=[(0.0, 0.0), (0.4, 0.9), (0.6, 0.9), (1.0, 0.0)], opacity=0.1) self.extractButton = ExtractButton(parent=gaugeCont, align=uiconst.TOALL, controller=self.controller) self.gauge = Gauge(parent=gaugeCont, align=uiconst.TOTOP, state=uiconst.UI_DISABLED, height=30, gaugeHeight=30, top=1, color=COLOR_MODIFIED, backgroundColor=(1.0, 1.0, 0.0, 0.0)) self.noProgressHint = EveHeaderMedium( parent=gaugeCont, align=uiconst.CENTER, width=self.width, bold=True, text=localization.GetByLabel('UI/SkillTrading/DropToExtractHint'), opacity=0.5) self.amountLabel = ExtractorBarAmountLabel( parent=self, align=uiconst.TOTOP, top=2, goal=self.controller.SKILL_POINT_GOAL)
def Layout(self): self.ghostClip = Container(name='ghostClip', parent=self.clipCont, clipChildren=True) self.mainCont.SetParent(self.ghostClip) self.ghostCont = ContainerAutoSize(parent=self.clipCont, align=uiconst.TOPLEFT, alignMode=uiconst.TOPLEFT, clipChildren=True) self.ghostList = FlowContainer(parent=self.ghostCont, align=uiconst.TOPLEFT, width=ENTRY_EXPANDED_WIDTH, contentSpacing=(0, 4), idx=0) self.ghostShadow = GradientSprite(parent=self.ghostClip, align=uiconst.TOPLEFT, state=uiconst.UI_DISABLED, height=12, width=ENTRY_EXPANDED_WIDTH, rgbData=[(0, (0.0, 0.0, 0.0))], alphaData=[(0, 0.0), (0.8, 0.6), (1, 1.0)], rotation=math.pi / 2, opacity=0.0, idx=0) def AutoSizeCallback(): height = self.ghostList.height self.mainCont.padTop = -height self.ghostClip.padTop = height self.ghostCont.callback = AutoSizeCallback
def ApplyAttributes(self, attributes): Window.ApplyAttributes(self, attributes) sm.RegisterNotify(self) self.streamBtn = None self.topCont = ContainerAutoSize(name='topCont', parent=self.sr.main, align=uiconst.TOTOP, padding=(10, 10, 10, 0)) self.loginCont = Container(name='loginCont', parent=self.sr.main, align=uiconst.TOTOP, height=120, padding=5) self.settingsCont = ContainerAutoSize(name='settingsCont', parent=self.sr.main, align=uiconst.TOTOP, padding=5) self.ConstructTopCont() self.ConstructLoginCont() self.ConstructSettingsCont() self.ConstructBottomButtons() self.bottomGradient = GradientSprite(bgParent=self.btnGroup, rotation=-pi / 2, rgbData=[(0, (0.3, 0.3, 0.3))], alphaData=[(0, 0.3), (0.9, 0.0)]) self.UpdateState() self.CheckEnableStreamBtn() if bool(session.role & ROLE_PROGRAMMER): self.debugLabel = Label(parent=self.topCont, align=uiconst.TOPLEFT, top=120)
def _add_gradient_reward_background(self, parent_container): return GradientSprite(name='gradient_reward_background', align=uiconst.TOTOP_NOPUSH, parent=parent_container, width=parent_container.width, height=parent_container.height, rgbData=REWARD_GRADIENT_RGB_DATA, alphaData=REWARD_GRADIENT_ALPHA_DATA)
def Prepare_Underlay_(self): self.sr.backgroundFrame = GradientSprite(bgParent=self, rotation=-math.pi / 2, rgbData=[(0, (1.0, 1.0, 1.0)) ], alphaData=[(0, 0.5), (0.3, 0.2), (0.6, 0.08)], opacity=0.0) Fill(bgParent=self, name='BackgroundColor', color=CATEGORY_COLOR)
def CreateBottomLayout(self, offer, aurumBalance): self.bottomContainer = Container(name='bottomContainer', parent=self.offerContainer, align=uiconst.TOTOP, clipChildren=True, height=BOTTOM_PANEL_HEIGHT) Fill(align=uiconst.TOALL, bgParent=self.bottomContainer, color=HEADER_BG_COLOR) GradientSprite(align=uiconst.TOALL, bgParent=self.bottomContainer, rgbData=((0.0, (0.0, 0.0, 0.0)), (1.0, (0.0, 0.0, 0.0))), alphaData=((0.0, 0.8), (0.2, 0.6), (0.6, 0.0)), rotation=math.pi * 0.4) self.purchaseDetailsPanel = PurchaseDetailsPanel( parent=self.bottomContainer, offer=offer, aurumBalance=aurumBalance, buyOfferCallback=self.vgsUiController.BuyOffer, previewCallback=self.OnPreviewType, state=uiconst.UI_PICKCHILDREN, width=CONTAINER_WIDTH) self.activeBottomPanel = self.purchaseDetailsPanel self.purchaseProgressPanel = PurchaseProgressPanel( parent=self.bottomContainer, width=CONTAINER_WIDTH) self.purchaseSuccessPanel = PurchaseResultPanel( parent=self.bottomContainer, closeOfferCallback=self.CloseOffer, iconForegroundTexturePath= 'res:/UI/Texture/vgs/purchase_success_fg.png', iconBackgroundTexturePath= 'res:/UI/Texture/vgs/purchase_success_bg.png', textTitle=localization.GetByLabel( 'UI/VirtualGoodsStore/Purchase/Completed'), audioEventName='store_purchase_success', width=CONTAINER_WIDTH) self.purchaseFailurePanel = PurchaseResultPanel( parent=self.bottomContainer, closeOfferCallback=self.CloseOffer, iconForegroundTexturePath= 'res:/UI/Texture/vgs/purchase_fail_fg.png', iconBackgroundTexturePath= 'res:/UI/Texture/vgs/purchase_fail_bg.png', textTitle=localization.GetByLabel( 'UI/VirtualGoodsStore/Purchase/Failed'), audioEventName='store_purchase_failure', width=CONTAINER_WIDTH) VgsLabelSmall( parent=self.purchaseFailurePanel, align=uiconst.TOTOP, text='<center>%s</center>' % localization.GetByLabel( 'UI/VirtualGoodsStore/Purchase/FailureReasonUnknown'), padding=(TEXT_PADDING, TEXT_PADDING, TEXT_PADDING, 0))
def ConstructSystemCostGradient(self, col, systemCostIndex): GradientSprite(name='systemCostGradient', align=uiconst.TOLEFT_PROP, state=uiconst.UI_DISABLED, parent=col, width=systemCostIndex, padding=0, rgbData=((0.0, industryUIConst.COLOR_SYSTEMCOSTINDEX[:3]), ), rotation=pi / 2, alphaData=((0.0, 1.0), (0.075, 1.0), (0.075001, 0.2), (0.8, 0.0)))
def SetSidebarContentMask(self): for container in (self.leftContainer, self.rightContainer): container.Flush() GradientSprite(name='OfferSlipGradient', align=uiconst.TOTOP, parent=container, rgbData=((0.0, BACKGROUND_COLOR[:3]), ), alphaData=((0.0, CONTENT_SLIP_UNDER_AREA_OPACITY), (0.5, 1.0), (1.0, 1.0)), height=self.topContainer.height + self.filterContainer.height + HEADER_PADDING, rotation=math.pi / 2)
def _create_finished_background_overlay(self): GradientSprite(name='finished_gradient_overlay', align=uiconst.TOALL, parent=self, rgbData=REWARD_BACKGROUND_OVERLAY_RGB_DATA, alphaData=REWARD_BACKGROUND_OVERLAY_ALPHA_DATA, radial=True) finished_fill_container = Container(name='finished_fill_container', parent=self, align=uiconst.TOALL) Fill(bgParent=finished_fill_container, color=REWARD_BACKGROUND_FILL_COLOR)
def ApplyAttributes(self, attributes): Window.ApplyAttributes(self, attributes) self.taskMap = {} self.controller = None self.buttonCont = Container(parent=self.sr.main, name='buttonbar', align=uiconst.TOTOP, height=24, clipChildren=True) GradientSprite(bgParent=self.buttonCont, rotation=-math.pi / 2, rgbData=[(0, (1.0, 1.0, 1.3))], alphaData=[(0.6, 0.0), (1.0, 0.05)]) self.CreateToolbar() self.leftCont = DragResizeCont( name='leftCont', parent=self.sr.main, align=uiconst.TOLEFT_PROP, settingsID='BehaviorDebugWindowLeftContent', minSize=0.2, maxSize=0.8, defaultSize=0.5) GradientSprite(bgParent=self.leftCont, rotation=0, rgbData=[(0, (1.0, 1.0, 1.3))], alphaData=[(0.8, 0.0), (1.0, 0.05)]) self.mainScroll = ScrollContainer(name='behaviortree', parent=self.leftCont.mainCont, align=uiconst.TOALL, padding=(4, 4, 4, 4)) self.blackboardScroll = ScrollContainer(name='blackboards', parent=self.sr.main, padding=(4, 4, 4, 4)) GradientSprite(bgParent=self.blackboardScroll, rotation=0, rgbData=[(0, (1.0, 1.0, 1.3))], alphaData=[(0.8, 0.0), (1.0, 0.05)])
def ConstuctLayout(self): self.leftCont = DragResizeCont(name='leftCont', parent=self.sr.main, align=uiconst.TOLEFT_PROP, settingsID='ControlCatalogWindowLeftCont') self.infoCont = ContainerAutoSize(name='infoCont', parent=self.sr.main, align=uiconst.TOTOP, padding=6) self.topCont = DragResizeCont(name='topCont', parent=self.sr.main, align=uiconst.TOTOP_PROP, settingsID='ControlCatalogWindowSampleCont', minSize=0.3, maxSize=0.9, defaultSize=0.5, clipChildren=True) tabCont = ContainerAutoSize(name='tabCont', parent=self.topCont.mainCont, align=uiconst.TOBOTTOM) self.mainButtonGroup = ButtonGroup(name='mainButtonGroup', parent=self.sr.main) self.editCont = Container(name='editCont', parent=self.sr.main) GradientSprite(bgParent=self.leftCont, rotation=0, rgbData=[(0, (1.0, 1.0, 1.3))], alphaData=[(0.8, 0.0), (1.0, 0.05)]) self.controlScroll = ScrollContainer(parent=self.leftCont) self.PopulateScroll() self.leftButtonGroup = ButtonGroup(name='leftButtonGroup', parent=self.leftCont, idx=0) self.ConstructLeftButtonGroup() self.classNameLabel = Label(parent=self.infoCont, align=uiconst.TOTOP, fontsize=15, bold=True) self.classDocLabel = EveLabelSmall(parent=self.infoCont, align=uiconst.TOTOP) GradientSprite(align=uiconst.TOTOP, parent=self.infoCont, rotation=-math.pi / 2, height=16, padding=(-4, -10, -4, 0), rgbData=[(0, (1.0, 1.0, 1.3))], alphaData=[(0.0, 0.0), (1.0, 0.03)]) GradientSprite(align=uiconst.TOTOP, parent=tabCont, state=uiconst.UI_DISABLED, rotation=math.pi / 2, height=16, padding=(-4, 0, -4, -10), rgbData=[(0, (1.0, 1.0, 1.3))], alphaData=[(0.0, 0.0), (1.0, 0.03)]) self.sampleNameLabel = EveLabelSmall(parent=tabCont, align=uiconst.TOTOP, padBottom=5) self.tabs = ToggleButtonGroup(parent=Container(parent=tabCont, align=uiconst.TOTOP, height=16), align=uiconst.CENTER, height=16, callback=self.OnTabSelected) sampleParent = Container(name='sampleParent', parent=self.topCont.mainCont, clipChildren=True) self.sampleCont = ContainerAutoSize(name='sampleCont', parent=sampleParent, align=uiconst.CENTER) self.codeEdit = EditPlainText(parent=self.editCont, align=uiconst.TOALL, fontcolor=(1, 1, 1, 1), ignoreTags=True) self.codeEdit.OnKeyDown = self.OnCodeEditKeyDown self.ConstructMainButtonGroup() uthread.new(self._SpyOnSampleCodeReloadThread)
def ApplyAttributes(self, attributes): PointerContainer.ApplyAttributes(self, attributes) self.data = attributes.data self.callback = attributes.callback self.minDisplayTime = attributes.Get('minDisplayTime', self.default_minDisplayTime) self.outsideBoundsTime = attributes.Get('outsideBoundsTime', self.default_outsideBoundsTime) self.updateLoopTimeMSec = attributes.Get('updateLoopTimeMSec', self.default_updateLoopTimeMSec) self._updateThread = None self.michelle = sm.GetService('michelle') self.sensorSuite = sm.GetService('sensorSuite') self.topContainer = Container(parent=self, height=20, align=uiconst.TOTOP) self.bottomContainer = Container(parent=self, align=uiconst.TOALL) self.contentContainer = Container(parent=self.bottomContainer, align=uiconst.TOALL, padLeft=16) Fill(bgParent=self.bottomContainer, color=(0, 0, 0, 0.4)) Line(parent=self.bottomContainer, align=uiconst.TOBOTTOM) leftPadContainer = Container(parent=self.topContainer, align=uiconst.TOLEFT, width=12) Line(parent=leftPadContainer, align=uiconst.TORIGHT) Line(parent=leftPadContainer, align=uiconst.TOBOTTOM) textContainer = Container(parent=self.topContainer, align=uiconst.TOLEFT, width=150) Fill(bgParent=textContainer, color=(0, 0, 0, 0.5)) Line(parent=textContainer, align=uiconst.TOTOP) Line(parent=textContainer, align=uiconst.TORIGHT) self.captionLabel = EveLabelMediumBold(parent=textContainer, text=self.GetCaptionText(), align=uiconst.CENTER) textContainer.width = self.captionLabel.textwidth + 16 rightPadContainer = Container(parent=self.topContainer, align=uiconst.TOALL) Line(parent=rightPadContainer, align=uiconst.TOBOTTOM) self.iconCont = Container(parent=self.contentContainer, pos=(8, 8, 32, 32), state=uiconst.UI_DISABLED, align=uiconst.TOPRIGHT) if self.default_iconTexturePath: self.CreateIconSpite() self.ownerIcon.SetTexturePath(self.default_iconTexturePath) self.ownerIcon.state = uiconst.UI_DISABLED topTextCont = ContainerAutoSize(top=8, name='topTextCont', parent=self.contentContainer, align=uiconst.TOTOP) self.mainLabel = EveCaptionMedium(name='mainLabel', parent=topTextCont, color=(0.235, 0.745, 0.765), text='', align=uiconst.TOTOP, singleline=True) self.mainLabel.SetRightAlphaFade(fadeEnd=250, maxFadeWidth=30) self.subLabel = EveLabelMediumBold(name='subLabel', parent=topTextCont, align=uiconst.TOTOP, text='', singleline=True) self.subLabel.SetRightAlphaFade(fadeEnd=250, maxFadeWidth=30) bottomTextCont = ContainerAutoSize(top=2, name='bottomTextCont', parent=self.contentContainer, align=uiconst.TOBOTTOM) self.dataLabel = EveLabelMediumBold(name='dataLabel', parent=bottomTextCont, align=uiconst.TOBOTTOM, text='') self.rangeLabel = EveLabelMediumBold(name='rangeLabel', parent=bottomTextCont, align=uiconst.TOBOTTOM, text='') self.buttonContainer = Container(parent=self.contentContainer, align=uiconst.BOTTOMRIGHT, heigh=32) GradientSprite(parent=self.bottomContainer, align=uiconst.TOALL, rotation=-pi / 2, rgbData=[(0, (0.25, 0.25, 0.25)), (0.3, (0.0, 0.0, 0.0))], alphaData=[(0, 0.5)], state=uiconst.UI_DISABLED) self.warpButton = Button(parent=self.contentContainer, top=8, left=88, icon='res:/UI/Texture/Icons/44_32_18.png', func=self.WarpToAction, hint=localization.GetByLabel('UI/Commands/WarpTo'), align=uiconst.BOTTOMRIGHT) self.bookmarkButton = Button(parent=self.contentContainer, top=8, left=48, icon='res:/UI/Texture/Icons/bookmark.png', func=self.BookmarkSite, hint=localization.GetByLabel('UI/Inflight/BookmarkLocation'), align=uiconst.BOTTOMRIGHT) self.probeScannerButton = Button(parent=self.contentContainer, top=8, left=4, icon='res:/UI/Texture/Icons/probe_scan.png', func=OpenProbeScanner, hint=localization.GetByLabel('UI/Inflight/Scanner/SensorOverlayProbeScanButtonHint'), align=uiconst.BOTTOMRIGHT) uicore.event.RegisterForTriuiEvents(uiconst.UI_MOUSEDOWN, self.OnGlobalMouseDown) self._updateThread = uthread.new(self.UpdateHint)
def ApplyAttributes(self, attributes): ReprocessingHeaderContainer.ApplyAttributes(self, attributes) self.percentage = attributes.percentage self.avgBonus = 0 self.state = uiconst.UI_NORMAL self.groupHilite = Fill(bgParent=self, color=(0.4, 0.4, 0.4, 0.1), opacity=0.0) self.getTypeAttribute = sm.GetService('clientDogmaStaticSvc').GetTypeAttribute self.getSkillLevel = sm.GetService('skills').MySkillLevel self.stationTax = attributes.tax self.stationEfficiency = attributes.efficiency rightCont = Container(parent=self, align=uiconst.TORIGHT, width=100) Sprite(parent=rightCont, width=24, height=24, ignoreSize=True, align=uiconst.TOLEFT, texturePath='res:/UI/Texture/Reprocessing/Reprocess.png') self.gaugeParent = Container(parent=rightCont, align=uiconst.TOALL, padding=(0, 5, 2, 4)) self.gaugeLabel = EveLabelSmallBold(parent=self.gaugeParent, align=uiconst.CENTER) Frame(parent=self.gaugeParent, color=(0.5, 0.5, 0.5, 0.05)) Fill(bgParent=self.gaugeParent, color=(0.0, 0.0, 0.0, 0.8)) self.reprocessingGauge = GradientSprite(parent=self.gaugeParent, align=uiconst.TOLEFT_PROP, rotation=-pi / 2, rgbData=[(0, COL_YELLOW)], alphaData=[(0, 0.6), (0.5, 0.4), (1.0, 0.6)]) self.UpdateGauge(self.percentage)
def ApplyAttributes(self, _self, attributes, *args): if self.bgElementFunc: _self._buttonEffect_bgElement = self.bgElementFunc( _self, attributes) else: _self._buttonEffect_bgElement = GradientSprite( name='hoverGradient', bgParent=_self, rotation=-math.pi / 2, rgbData=[(0, (1.0, 1.0, 1.0))], alphaData=[(0, 0.5), (0.3, 0.2), (0.6, 0.08)], idx=self.idx) _self._buttonEffect_bgElement.opacity = self.opacityIdle if not hasattr(_self, 'disabled'): setattr(_self, 'disabled', attributes.disabled or False) if self.isToggleButton: setattr(_self, 'isActive', attributes.isActive or False) if _self.isActive: _self._buttonEffect_bgElement.opacity = self.opacityMouseDown def SetActive(isActive): _self.isActive = isActive if _self.isActive: uicore.animations.FadeTo( _self._buttonEffect_bgElement, _self._buttonEffect_bgElement.opacity, self.opacityMouseDown, duration=0.1) else: uicore.animations.FadeTo( _self._buttonEffect_bgElement, _self._buttonEffect_bgElement.opacity, self.opacityIdle, duration=self.exitDuration) onActiveStateChange = getattr(_self, 'OnActiveStateChange', None) if onActiveStateChange is not None: onActiveStateChange() _self.SetActive = SetActive
def Layout(self): self.imageLayer = Transform(parent=self, align=uiconst.CENTER, scalingCenter=(0.5, 0.5), bgColor=self.BACKGROUND_COLOR) GradientSprite(align=uiconst.TOALL, bgParent=self.imageLayer, rgbData=((1.0, self.RADIAL_SHADOW),), alphaData=((0.0, 0.0), (1.0, 1.0)), radial=True, idx=0) if self.image: self.lazySprite = LazyUrlSprite(parent=self.imageLayer, align=uiconst.TOALL, imageUrl=self.offer.imageUrl, state=uiconst.UI_DISABLED) descriptionBox = ContainerAutoSize(parent=self, align=uiconst.TOBOTTOM, bgColor=self.TEXT_BOX_COLOR, clipChildren=True, idx=0) if self.price: AurPriceTag(parent=descriptionBox, align=uiconst.TOBOTTOM, amount=self.offer.price, baseAmount=self.offer.basePrice, padding=(self.PADDING_BIG, 0, self.PADDING_BIG, 10)) if self.description: self.DESCRIPTION_FONT_CLASS(parent=descriptionBox, align=uiconst.TOBOTTOM, text=self.offer.description, padding=(self.PADDING_BIG, 0, self.PADDING_BIG, 10)) self.TITLE_FONT_CLASS(parent=descriptionBox, align=uiconst.TOBOTTOM, text=self.offer.name, padding=(self.PADDING_BIG, 2, self.PADDING_BIG + 32, 2)) if self.offer.label is not None: self.RIBBON_TYPE(parent=self, align=self.RIBBON_ALIGN, label=self.offer.label, idx=0)
def ApplyAttributes(self, attributes): Container.ApplyAttributes(self, attributes) self.label = EveLabelSmall(text=attributes.text, parent=self, state=uiconst.UI_DISABLED, align=uiconst.CENTERLEFT, width=LABELWIDTH) self.edit = SinglelineEdit(name='passwordEdit', parent=self, maxLength=64, align=uiconst.TOLEFT, padLeft=LABELWIDTH, width=140, setvalue=attributes.value, OnReturn=attributes.OnReturn, OnChange=attributes.OnChange, OnSetFocus=attributes.OnSetFocus) self.incorrectFill = GradientSprite(bgParent=self.edit, opacity=0.0, rgbData=[(0, (0.55, 0.0, 0.0))], alphaData=[(0, 0.5), (0.949, 0.75), (0.95, 1.0), (1.0, 1.0)])
class SeasonReward(Container): default_padLeft = REWARD_CONTAINER_DEFAULT_PADDING default_padTop = REWARD_CONTAINER_DEFAULT_PADDING default_padRight = REWARD_CONTAINER_DEFAULT_PADDING default_padBottom = REWARD_CONTAINER_DEFAULT_PADDING default_align = uiconst.TOALL def ApplyAttributes(self, attributes): Container.ApplyAttributes(self, attributes) self.Hide() self.season_service = attributes.season_service self.width = min( self.width, REWARD_CONTAINER_WIDTH) - 2 * REWARD_CONTAINER_DEFAULT_PADDING self.finished_goals = [] self._create_reward_view() self._create_finished_background_overlay() self.show_finished_goals() def show_finished_goals(self): self.finished_goals += self.season_service.get_and_clear_recently_finished_goals( ).values() if self.display or not self.finished_goals: return self._display_reward(self.finished_goals.pop(0)) def _create_reward_view(self): self.reward_container = Container(name='reward_container', parent=self, align=uiconst.CENTER, width=self.parent.width, height=REWARD_CONTAINER_HEIGHT) self.reward_main_container = Container(name='reward_main_container', parent=self.reward_container, align=uiconst.TOALL) self._create_reward_header() self._create_reward_content_container() self._create_reward_content() self.reward_event_banner_container = Container( name='reward_event_banner_container', parent=self.reward_main_container, align=uiconst.CENTERTOP, width=self.width, height=REWARD_BANNER_HEIGHT, opacity=ANIMATED_DEFAULT_OPACITY, top=REWARD_BANNER_TOP) self.reward_event_banner = CurrentEventBanner( name='reward_event_banner', parent=self.reward_event_banner_container, banner_texture=self.season_service.get_season_background_no_logo(), align=uiconst.CENTER, opacity=REWARD_BACKGROUND_BANNER_OPACITY) self.reward_main_container.Hide() def _create_finished_background_overlay(self): GradientSprite(name='finished_gradient_overlay', align=uiconst.TOALL, parent=self, rgbData=REWARD_BACKGROUND_OVERLAY_RGB_DATA, alphaData=REWARD_BACKGROUND_OVERLAY_ALPHA_DATA, radial=True) finished_fill_container = Container(name='finished_fill_container', parent=self, align=uiconst.TOALL) Fill(bgParent=finished_fill_container, color=REWARD_BACKGROUND_FILL_COLOR) def _create_reward_header(self): self.reward_header_label_container = Container( name='reward_header_label_container', parent=self.reward_main_container, align=uiconst.TOTOP, width=self.width, height=REWARD_HEADER_LABEL_HEIGHT, opacity=ANIMATED_DEFAULT_OPACITY) EveCaptionLarge(name='reward_header_label', parent=self.reward_header_label_container, align=uiconst.CENTERTOP, text=get_reward_unlocked_header(), bold=True) self.reward_header_line = Sprite( name='reward_header_container_line', parent=self.reward_header_label_container, texturePath=SEASON_LINE_BREAK_GRADIENT, align=uiconst.BOTTOMLEFT, width=self.width, height=REWARD_ITEM_LABEL_LINE_HEIGHT, opacity=REWARD_ITEM_LABEL_LINE_OPACITY, useSizeFromTexture=False) def _create_reward_content_container(self): self.reward_content_container = Container( name='reward_content_container', parent=self.reward_main_container, align=uiconst.TOTOP, height=REWARD_CONTENT_HEIGHT) def _create_reward_content(self): self._create_item_reward_icon() self._create_reward_season_points() self._create_item_reward_label() self._create_reward_bottom_container() def _create_reward_season_points(self): self.reward_season_points_container = Container( name='reward_season_points_container', parent=self.reward_content_container, align=uiconst.TOTOP, height=REWARD_SEASON_POINTS_HEIGHT, opacity=ANIMATED_DEFAULT_OPACITY) self.reward_season_points_top_container = Container( name='reward_season_points_top_container', parent=self.reward_season_points_container, align=uiconst.TOTOP, height=REWARD_SEASON_POINTS_BACKGROUND_HEIGHT) reward_season_points_label_container = Container( name='reward_season_points_label_container', parent=self.reward_season_points_top_container, align=uiconst.TOTOP, height=REWARD_SEASON_POINT_LABEL_SIZE, padTop=REWARD_SEASON_TOP_PADDING) self.reward_points = SeasonPoints( name='reward_season_points_label', parent=reward_season_points_label_container, align=uiconst.CENTER, height=REWARD_SEASON_POINTS_HEIGHT, points=0, reward_label_class=REWARD_SEASON_POINTS_LABEL_CLASS, season_points_size=REWARD_SEASON_POINT_LABEL_SIZE) self.reward_season_points_background_container = None self._create_reward_season_points_background() def _create_reward_season_points_background(self): if self.reward_season_points_background_container: self.reward_season_points_background_container.Flush() self.reward_season_points_background_container.Close() self.reward_season_points_background_container = Container( name='reward_season_points_background_container', parent=self.reward_season_points_top_container, align=uiconst.CENTER, width=self.width, height=REWARD_SEASON_POINTS_BACKGROUND_HEIGHT) self.season_points_background = self._add_gradient_reward_background( self.reward_season_points_background_container) def _create_item_reward_icon(self): self.reward_item_icon_glow_container = Transform( name='reward_item_icon_glow_container', parent=self.reward_content_container, align=uiconst.CENTER, height=REWARD_ITEM_ICON_SIZE, width=REWARD_ITEM_ICON_SIZE, top=REWARD_ITEM_ICON_TOP_MARGIN, scalingCenter=REWARD_ITEM_ICON_SCALING_CENTER) self.reward_item_icon_glow_container.Hide() self.reward_item_icon_container = Container( name='reward_item_icon_container', parent=self.reward_item_icon_glow_container, align=uiconst.TOALL, padding=REWARD_ITEM_ICON_GLOW_PADDING) self.reward_item_icon_overlay_fill = Fill( parent=self.reward_item_icon_container, color=Color.WHITE, opacity=ANIMATED_ICON_OVERLAY_OPACITY) Fill(bgParent=self.reward_item_icon_container, color=REWARD_BACKGROUND_FILL_COLOR) def _create_item_reward_label(self): self.reward_item_label_container = Container( name='reward_item_label_container', parent=self.reward_content_container, align=uiconst.TOTOP, width=self.width, height=REWARD_ITEM_LABEL_HEIGHT, opacity=ANIMATED_DEFAULT_OPACITY) Sprite(name='reward_item_label_line', parent=self.reward_item_label_container, texturePath=SEASON_LINE_BREAK_GRADIENT, align=uiconst.TOBOTTOM, width=self.width - REWARD_ITEM_BACKGROUND_PADDING * 2, height=REWARD_ITEM_LABEL_LINE_HEIGHT, opacity=REWARD_ITEM_LABEL_LINE_OPACITY, useSizeFromTexture=False) self.reward_item_label = EveLabelLargeBold( name='reward_item_label', parent=self.reward_item_label_container, align=uiconst.CENTER, text='') self.reward_label_background_container = None self._create_reward_label_background() def _create_reward_label_background(self): if self.reward_label_background_container: self.reward_label_background_container.Flush() self.reward_label_background_container.Close() self.reward_label_background_container = Container( name='reward_label_background_container', parent=self.reward_item_label_container, align=uiconst.TOTOP, width=self.width, height=REWARD_ITEM_LABEL_HEIGHT) self.reward_label_background = self._add_gradient_reward_background( self.reward_label_background_container) def _create_reward_bottom_container(self): self.reward_bottom_container = Container( name='reward_bottom_container', parent=self.reward_content_container, align=uiconst.TOTOP, height=REWARD_BOTTOM_CONTAINER_HEIGHT) self.reward_note_label_container = Container( name='reward_note_label_container', parent=self.reward_bottom_container, align=uiconst.TOTOP, height=REWARD_NOTE_LABEL_HEIGHT, padLeft=REWARD_BOTTOM_CONTAINER_LABEL_SIDE_PAD, padRight=REWARD_BOTTOM_CONTAINER_LABEL_SIDE_PAD, padTop=REWARD_BOTTOM_CONTAINER_LABEL_PAD_TOP, opacity=ANIMATED_DEFAULT_OPACITY) EveLabelSmall(name='reward_note_label', parent=self.reward_note_label_container, align=uiconst.TOTOP, text=get_reward_unlocked_body()) self.reward_close_button_container = Container( name='reward_close_button_container', parent=self.reward_bottom_container, align=uiconst.TOTOP, height=REWARD_CONTINUE_BUTTON_HEIGHT, opacity=ANIMATED_DEFAULT_OPACITY) Button(name='reward_close_button', parent=self.reward_close_button_container, align=uiconst.CENTER, label=GetByLabel('UI/Generic/Close'), func=self._close_reward) Sprite(name='reward_bottom_container_line', parent=self.reward_bottom_container, texturePath=SEASON_LINE_BREAK_GRADIENT, align=uiconst.TOBOTTOM, width=self.width, height=REWARD_ITEM_LABEL_LINE_HEIGHT, opacity=REWARD_ITEM_LABEL_LINE_OPACITY, useSizeFromTexture=False) self.reward_bottom_background_container = None self._create_reward_bottom_background() def _create_reward_bottom_background(self): if self.reward_bottom_background_container: self.reward_bottom_background_container.Flush() self.reward_bottom_background_container.Close() self.reward_bottom_background_container = Container( name='reward_bottom_background_container', parent=self.reward_bottom_container, align=uiconst.CENTER, width=self.width, height=REWARD_BOTTOM_CONTAINER_HEIGHT) def _add_gradient_reward_background(self, parent_container): return GradientSprite(name='gradient_reward_background', align=uiconst.TOTOP_NOPUSH, parent=parent_container, width=parent_container.width, height=parent_container.height, rgbData=REWARD_GRADIENT_RGB_DATA, alphaData=REWARD_GRADIENT_ALPHA_DATA) def _close_reward(self, *args): if self.finished_goals: self.reward_main_container.Hide() self._show_next_reward() else: self._hide_rewards() def _show_next_reward(self): self.reward_content_container.Flush() self.animated_gradient_background.Close() self._create_reward_content() self._display_reward(self.finished_goals.pop(0)) def _play_reward_audio(self): sm.GetService('audio').SendUIEvent('scope_earn_rewards_play') def _hide_and_reset(self): self.Hide() self.opacity = 1.0 def _hide_rewards(self): animations.FadeOut(self, duration=REWARD_DISAPPEAR_ANIMATION_DURATION, callback=self._hide_and_reset) def _display_reward(self, reward): self.Show() self._update_reward_info(reward) self._animate_reward() self._play_reward_audio() def _update_reward_info(self, reward): reward_type = reward['reward_type_id'] reward_points = reward['points_required'] try: self.reward_item_icon = get_reward_icon_in_size( reward_type_id=reward_type, size=REWARD_ICON_TEXTURE_SIZE, name='reward_item_icon', parent=self.reward_item_icon_container, align=uiconst.TOALL) except Exception: self.reward_item_icon = None log.LogError( 'Failed to load Scope Network reward unlocked icon for item type %d' % reward_type) self.reward_item_label.text = evetypes.GetName(reward_type) self.reward_points.update_points(reward_points) def _animate_reward(self): self.animated_gradient_background = GradientSprite( name='animated_gradient_background', parent=self.reward_container, align=uiconst.TOALL, rgbData=ANIMATED_GRADIENT_BACKGROUND_RGD_DATA, alphaData=ANIMATED_GRADIENT_BACKGROUND_ALPHA_DATA, opacity=ANIMATED_GRADIENT_BACKGROUND_OPACITY) animations.MorphScalar(self.reward_container, 'width', endVal=self.width, duration=ANIMATED_GRADIENT_BACKGROUND_DURATION, timeOffset=ANIMATED_GRADIENT_BACKGROUND_OFFSET, callback=self._show_reward) def _show_reward(self): self.reward_main_container.Show() self._animate_reward_content() self._animate_icon() self._remove_animated_gradient_background() def _animate_reward_content(self): animations.FadeIn(self.reward_event_banner_container, duration=ANIMATED_DEFAULT_FADE_IN_DURATION) animations.FadeIn(self.reward_item_label_container, duration=ANIMATED_DEFAULT_FADE_IN_DURATION) animations.FadeIn(self.reward_header_label_container, duration=ANIMATED_DEFAULT_FADE_IN_DURATION) animations.FadeIn(self.reward_season_points_container, duration=ANIMATED_DEFAULT_FADE_IN_DURATION, callback=self._animate_bottom_container) def _animate_bottom_container(self): animations.FadeIn(self.reward_close_button_container, duration=ANIMATED_BOTTOM_CONTAINER_FADE_IN_DURATION) animations.FadeIn(self.reward_note_label_container, duration=ANIMATED_BOTTOM_CONTAINER_FADE_IN_DURATION) def _animate_icon(self): self.reward_item_icon_glow_container.width *= ANIMATED_ICON_SIZE_FACTOR self.reward_item_icon_glow_container.height *= ANIMATED_ICON_SIZE_FACTOR self.reward_item_icon_glow_container.Show() animations.MorphVector2(self.reward_item_icon_glow_container, 'scale', startVal=ANIMATED_ICON_SIZE_START_SCALE_SIZE, endVal=ANIMATED_ICON_SIZE_END_SCALE_SIZE, duration=ANIMATED_ICON_SIZE_DURATION) animations.MorphScalar(self.reward_item_icon_overlay_fill, 'opacity', startVal=ANIMATED_ICON_OVERLAY_OPACITY, endVal=ANIMATED_DEFAULT_OPACITY, duration=ANIMATED_ICON_OVERLAY_FILL_DURATION) self._animate_icon_glow() def _animate_icon_glow(self): animation_video_container = Container( parent=self.reward_item_icon_glow_container, name='animation_video_container', align=uiconst.CENTER, width=ICON_GLOW_ANIMATION_SIZE, height=ICON_GLOW_ANIMATION_SIZE) StreamingVideoSprite(bgParent=animation_video_container, name='animation_video', videoPath=ICON_GLOW_ANIMATION_VIDEO_PATH, videoLoop=True, spriteEffect=trinity.TR2_SFX_COPY) def _remove_animated_gradient_background(self): self.animated_gradient_background.Hide() def resize(self, width, height): default_width = REWARD_CONTAINER_WIDTH - 2 * REWARD_CONTAINER_DEFAULT_PADDING new_width = width - 2 * REWARD_CONTAINER_DEFAULT_PADDING self.width = min(new_width, default_width) self.height = height - 2 * REWARD_CONTAINER_DEFAULT_PADDING - TOP_PADDING self.width = min(new_width, default_width) self.reward_container.width = self.width self.reward_event_banner_container.width = self.width self.reward_event_banner.width = self.width self.reward_header_line.width = self.width self._create_reward_season_points_background() self._create_reward_label_background() self._create_reward_bottom_background() self.season_points_background.width = self.width self.reward_label_background.width = self.width
def ApplyAttributes(self, attributes): GradientSprite.ApplyAttributes(self, attributes) ColorThemeMixin.ApplyAttributes(self, attributes)
def _construct_progress(self, animate_progress = True): progress_bar_container = Container(name='progress_bar_container', parent=self, align=uiconst.CENTERLEFT, width=self.width, height=self.progress_bar_height) self.progress_container = Container(name='progress_container', parent=progress_bar_container, align=uiconst.TOTOP, width=self.width - REWARD_ICON_MARGIN, height=self.progress_bar_height - REWARD_ICON_MARGIN, padding=defaultPadding) self.progress_gradient_fill = GradientSprite(name='progress_gradient_fill', align=uiconst.CENTERLEFT, parent=self.progress_container, rgbData=((0.0, PROGRESS_BAR_COLOR_START), (1.0, PROGRESS_BAR_COLOR_END)), opacity=PROGRESS_BAR_OPACITY, width=0, height=self.progress_container.height) self._update_progress_bar(animate_progress)
def ApplyAttributes(self, attributes): self.onClick = attributes.get('onClick', None) color = attributes.pop('color', self.default_color) contentSpacing = attributes.pop('contentSpacing', self.default_contentSpacing) iconSize = attributes.pop('iconSize', self.default_iconSize) labelClass = attributes.pop('labelClass', self.default_labelClass) labelColor = attributes.pop('labelColor', self.default_labelColor) labelShadow = attributes.pop('labelShadow', self.default_labelShadow) labelShadowColor = attributes.pop('labelShadowColor', self.default_labelShadowColor) labelTop = attributes.pop('labelTop', self.default_labelTop) padding = attributes.pop('padding', self.default_padding) text = attributes.pop('text', self.default_text) texturePath = attributes.pop('texturePath', self.default_texturePath) iconWidth, iconHeight = iconSize padLeft, padTop, padRight, padBottom = padding super(ButtonCore, self).ApplyAttributes(attributes) Fill(bgParent=self, align=uiconst.TOALL, padding=(1, 1, 1, 1), color=color) GradientSprite(bgParent=self, align=uiconst.TOALL, rgbData=((0.0, (0.9, 0.9, 0.9)), (0.5, (0.2, 0.2, 0.2)), (1.0, (0.9, 0.9, 0.9))), alphaData=((0.0, 0.3), (1.0, 0.3)), rotation=-math.pi / 4) Fill(bgParent=self, align=uiconst.TOALL, color=color) if texturePath: iconCont = Container(parent=self, align=uiconst.TOPLEFT, padding=(padLeft, padTop, contentSpacing if text else padRight, padBottom), height=iconHeight, width=iconWidth) Sprite(parent=iconCont, align=uiconst.TOPLEFT, state=uiconst.UI_DISABLED, texturePath=texturePath, height=iconHeight, width=iconWidth) if text: if texturePath: left = padLeft + iconWidth labelPadding = (contentSpacing, padTop, padRight, padBottom) top = labelTop else: left = 0 labelPadding = padding top = 0 labelCont = ContainerAutoSize(parent=self, align=uiconst.TOPLEFT, alignMode=uiconst.TOPLEFT, left=left, top=top) labelClass(parent=labelCont, align=uiconst.TOPLEFT, padding=labelPadding, text=text, color=labelColor) if labelShadow: shadow = labelClass(parent=labelCont, align=uiconst.TOPLEFT, padding=labelPadding, text=text, color=labelShadowColor) shadow.renderObject.spriteEffect = trinity.TR2_SFX_BLUR Frame(parent=labelCont, align=uiconst.TOALL, texturePath='res:/UI/Texture/Vgs/radialShadow.png', cornerSize=8, color=labelShadowColor, opacity=labelShadowColor[3] * 0.5) self.SetSizeAutomatically()
class OutcomeItemContainer(Container): default_state = uiconst.UI_NORMAL default_clipChildren = True __notifyevents__ = ['OnIndustryViewExpandCollapse'] def ApplyAttributes(self, attributes): Container.ApplyAttributes(self, attributes) sm.RegisterNotify(self) self.jobData = attributes.jobData self.videoThread = None self.iconCont = Container(name='iconCont', parent=self, align=CENTER, state=uiconst.UI_NORMAL, width=64, height=64) self.errorFrame = ErrorFrame(parent=self, align=uiconst.CENTER, pos=(0, 0, 64, 64), state=uiconst.UI_HIDDEN) self.qtyLabel = EveLabelLargeBold(parent=self, align=CENTER, top=42) FrameThemeColored(name='bgVignette', parent=self, texturePath='res:/UI/Texture/Classes/Industry/Output/bgVignette.png', cornerSize=30) self.videoCont = Container(name='videoCont', parent=self, align=uiconst.CENTER, width=324, height=199) self.previewContFill = FillThemeColored(parent=self) self.previewCont = PreviewContainer(parent=self, align=uiconst.TOALL, state=uiconst.UI_HIDDEN) self.leftProbabilityGradient = GradientSprite(name='leftProbabilityGradient', parent=self, align=uiconst.CENTERLEFT, state=uiconst.UI_HIDDEN, pos=(0, 0, 160, 64), rgbData=((0, (1.0, 1.0, 1.0)),), alphaData=((0.0, 0.5), (1.0, 0.0))) self.rightProbabilityGradient = GradientSprite(name='rightProbabilityGradient', parent=self, align=uiconst.CENTERRIGHT, state=uiconst.UI_HIDDEN, pos=(0, 0, 160, 64), rgbData=((0, (1.0, 1.0, 1.0)),), alphaData=((0.0, 0.0), (1.0, 0.5))) self.previewCont.navigation.LoadTooltipPanel = self.LoadIconContTooltipPanel self.previewCont.navigation.GetTooltipDelay = self.GetIconContTooltipDelay self.previewCont.navigation.GetMenu = self.GetMenu self.iconCont.LoadTooltipPanel = self.LoadIconContTooltipPanel self.iconCont.GetTooltipDelay = self.GetIconContTooltipDelay self.iconCont.OnMouseEnter = self.OnIconContMouseEnter self.iconCont.OnMouseExit = self.OnIconContMouseExit self.iconCont.OnClick = self.OnIconContClick self.iconCont.GetMenu = self.GetMenu self.iconCont.GetDragData = self.GetIconContDragData self.iconCont.isDragObject = True self.techIcon = Sprite(name='techIcon', parent=self.iconCont, width=16, height=16) self.icon = Icon(parent=self.iconCont, align=CENTER, state=uiconst.UI_DISABLED) self.bgCont = Container(name='bgCont', parent=self, align=uiconst.CENTER, width=201, height=192) self.bg = Sprite(bgParent=self.bgCont, texturePath='res:/UI/Texture/Classes/Industry/Output/itemBg.png') self.itemPattern = Sprite(bgParent=self.bgCont, texturePath='res:/UI/Texture/Classes/Industry/Output/itemBgColor.png') self.UpdateState() self.AnimEntry() def OnIndustryViewExpandCollapse(self): if not self.previewCont or self.jobData and self.jobData.activityID != industry.MANUFACTURING: return isCollapsed = settings.user.ui.Get('industryWndIsViewCollapsed', False) if not isCollapsed: self.AnimFadeSceneContIn() else: self.previewCont.Hide() self.previewContFill.opacity = 1.0 def AnimFadeSceneContIn(self): self.previewCont.Hide() self.previewContFill.opacity = 1.0 blue.synchro.SleepWallclock(250) self.previewCont.Show() uicore.animations.FadeTo(self.previewContFill, 1.0, 0.0, duration=0.6) def OnNewJobData(self, jobData): self.jobData = jobData self.UpdateState() if self.jobData: self.jobData.on_updated.connect(self.UpdateState) self.AnimEntry() def UpdateState(self, *args): if not self.jobData: self.previewCont.Hide() return typeID = self.jobData.GetProductTypeID() if IsPreviewable(typeID) and self.jobData.activityID == industry.MANUFACTURING: self.previewCont.Show() self.iconCont.Hide() newModel = self.previewCont.PreviewType(typeID) if newModel: self.previewContFill.Show() self.previewContFill.opacity = 1.0 self.previewCont.AnimEntry(1.5, 0.0, 0.5, -0.3) self.previewCont.sceneContainer.scene.sunDirection = (-0.5, -1.0, -1.0) self.bg.Hide() self.qtyLabel.top = 86 self.leftProbabilityGradient.Hide() self.rightProbabilityGradient.Hide() else: self.iconCont.Show() self.previewCont.Hide() self.bg.Show() self.qtyLabel.top = 42 if self.jobData.activityID == industry.RESEARCH_MATERIAL: self.icon.LoadIcon('res:/UI/Texture/Classes/Industry/iconME.png') self.icon.width = self.icon.height = 17 self.techIcon.texturePath = None elif self.jobData.activityID == industry.RESEARCH_TIME: self.icon.LoadIcon('res:/UI/Texture/Classes/Industry/iconTE.png') self.techIcon.texturePath = None self.icon.width = self.icon.height = 16 else: isCopy = self.jobData.activityID in (industry.COPYING, industry.INVENTION) oldTypeID = self.icon.typeID self.icon.LoadIconByTypeID(typeID, ignoreSize=True, isCopy=isCopy) self.icon.width = self.icon.height = 64 texturePath, hint = GetTechLevelIconPathAndHint(typeID) self.techIcon.texturePath = texturePath self.techIcon.hint = hint if oldTypeID != typeID: uicore.animations.FadeTo(self.icon, 0.0, 1.0, duration=0.6) if self.jobData.activityID == industry.INVENTION: width = self.jobData.probability * 160 color = GetJobColor(self.jobData) for gradient in (self.leftProbabilityGradient, self.rightProbabilityGradient): gradient.Show() gradient.SetRGBA(*color) uicore.animations.MorphScalar(gradient, 'width', gradient.width, width, duration=0.6) else: self.leftProbabilityGradient.Hide() self.rightProbabilityGradient.Hide() if self.jobData and self.jobData.product: self.iconCont.opacity = 1.0 uicore.animations.FadeTo(self.bgCont, self.bgCont.opacity, 1.0, duration=0.3) self.errorFrame.Hide() else: self.iconCont.opacity = 0.0 uicore.animations.FadeTo(self.bgCont, 0.3, 1.0, duration=2.0, curveType=uiconst.ANIM_WAVE, loops=uiconst.ANIM_REPEAT) self.errorFrame.Show() self.UpdateOutputQty() self.StopVideo() if self.jobData.status == industry.STATUS_DELIVERED: self.PlayVideoDelivered() def PlayVideoDelivered(self): self.PlayVideo('res:/video/Industry/deliveredIntro.bk2', 'res:/video/Industry/deliveredOutro.bk2', industryUIConst.GetActivityColor(self.jobData.activityID)) def PlayVideoFailed(self): self.PlayVideo('res:/video/Industry/failedIntro.bk2', 'res:/video/Industry/failedOutro.bk2', industryUIConst.COLOR_NOTREADY) def StopVideo(self): if self.videoThread: self.videoThread.kill() self.videoCont.Flush() def PlayVideo(self, introPath, outroPath, color): self.videoThread = uthread.new(self._PlayVideo, introPath, outroPath, color) def _PlayVideo(self, introPath, outroPath, color): self.videoCont.Flush() videoSprite = VideoSprite(parent=self.videoCont, align=uiconst.TOALL, spriteEffect=trinity.TR2_SFX_COPY, videoPath=introPath, color=color) while not videoSprite.isFinished: blue.synchro.Yield() blue.synchro.SleepWallclock(3000) videoSprite.Close() videoSprite = VideoSprite(parent=self.videoCont, align=uiconst.TOALL, spriteEffect=trinity.TR2_SFX_COPY, videoPath=outroPath, color=color) while not videoSprite.isFinished: blue.synchro.Yield() uicore.animations.FadeOut(videoSprite, callback=videoSprite.Close) def GetMenu(self): abstractInfo = KeyVal(bpData=self.GetBpData()) return sm.GetService('menu').GetMenuFormItemIDTypeID(None, self.jobData.product.typeID, ignoreMarketDetails=False, abstractInfo=abstractInfo) def LoadIconContTooltipPanel(self, tooltipPanel, *args): if self.jobData.activityID in (industry.RESEARCH_TIME, industry.RESEARCH_MATERIAL): return self.tooltipPanel = OutcomeTooltipPanel(jobData=self.jobData, tooltipPanel=tooltipPanel) def GetIconContTooltipDelay(self): return TOOLTIP_DELAY_GAMEPLAY def GetIconContDragData(self, *args): typeID = self.jobData.GetProductTypeID() if not typeID: return if isinstance(self.jobData.product, industry.Blueprint): bpData = self.jobData.product.GetCopy() else: bpData = None return [KeyVal(__guid__='uicls.GenericDraggableForTypeID', typeID=typeID, label=cfg.invtypes.Get(typeID).name, bpData=bpData)] def UpdateOutputQty(self): if not self.jobData or not self.jobData.product: self.qtyLabel.text = '' return self.qtyLabel.text = self.jobData.GetProductAmountLabel() def AnimEntry(self): if not self.jobData: return uicore.animations.FadeTo(self.itemPattern, 0.0, 1.0, duration=0.6, timeOffset=1.35) uicore.animations.FadeTo(self.previewContFill, self.previewContFill.opacity, 0.0, duration=0.6, timeOffset=0, callback=self.previewContFill.Hide) def GetBpData(self): if not isinstance(self.jobData.product, industry.Blueprint): return None return self.jobData.product.GetCopy() def OnIconContClick(self, *args): if not self.jobData: return if self.jobData.activityID in (industry.RESEARCH_MATERIAL, industry.RESEARCH_TIME): return typeID = self.jobData.GetProductTypeID() if not typeID: return sm.GetService('info').ShowInfo(typeID, abstractinfo=KeyVal(bpData=self.GetBpData())) sm.GetService('audio').SendUIEvent('ind_click') def OnIconContMouseEnter(self, *args): uicore.animations.FadeTo(self.bg, self.bg.opacity, 1.5, duration=0.15) sm.GetService('audio').SendUIEvent('ind_mouseEnter') def OnIconContMouseExit(self, *args): uicore.animations.FadeTo(self.bg, self.bg.opacity, 1.0, duration=0.3)
def Layout(self): """ Setup UI controls for this window. """ self.HideHeader() self.MakeUnResizeable() self.container = ContainerAutoSize(parent=self.GetMainArea(), align=uiconst.TOTOP, alignMode=uiconst.TOTOP, state=uiconst.UI_PICKCHILDREN, callback=self.OnContainerResized) headerCont = ContainerAutoSize(parent=self.container, align=uiconst.TOTOP) EveCaptionMedium(parent=headerCont, align=uiconst.CENTERTOP, text=localization.GetByLabel('UI/TrialUpsell/Header'), padding=(0, 8, 0, 4)) LineUnderlay(parent=self.container, align=uiconst.TOTOP, padding=(2, 0, 2, 0)) bodyCont = ContainerAutoSize(parent=self.container, align=uiconst.TOTOP, alignMode=uiconst.TOTOP) mainCont = ContainerAutoSize(parent=bodyCont, align=uiconst.TOTOP, alignMode=uiconst.TOTOP) GradientSprite(bgParent=bodyCont, rgbData=[(0, (0.138, 0.138, 0.08)), (0.6, (0.06, 0.06, 0.06)), (1.0, (0.1, 0.1, 0.1))], alphaData=[(0.0, 0.8), (1.0, 0.2)], alphaInterp=GradientConst.INTERP_LINEAR, colorInterp=GradientConst.INTERP_LINEAR, rotation=-math.pi / 2, padding=(2, 0, 2, 2)) EveLabelLarge(parent=mainCont, align=uiconst.TOTOP, text=localization.GetByLabel('UI/TrialUpsell/Greeting'), padding=(160, 18, 20, 8)) EveLabelLarge(parent=mainCont, align=uiconst.TOTOP, text=self.message or localization.GetByLabel('UI/TrialUpsell/DefaultBody'), padding=(160, 0, 20, 8)) EveLabelLarge(parent=mainCont, align=uiconst.TOTOP, text=localization.GetByLabel('UI/TrialUpsell/Footer'), padding=(160, 0, 20, 16)) trialDays = sm.RemoteSvc('userSvc').GetTrialDaysRemaining() EveLabelLarge(parent=mainCont, align=uiconst.TOTOP, text=localization.GetByLabel( 'UI/TrialUpsell/TrialTimeLeft', daysLeft=trialDays.daysLeft, daysTotal=trialDays.trialLen), color=(0.8, 0.6, 0.2, 0.8), padding=(160, 0, 20, 8)) self.iconGlow = Sprite( parent=mainCont, align=uiconst.CENTERLEFT, state=uiconst.UI_DISABLED, texturePath= 'res:/UI/Texture/classes/Monetization/Trial_Icon_Glow_256.png', left=-20, width=200, height=200) Sprite( parent=mainCont, align=uiconst.CENTERLEFT, state=uiconst.UI_DISABLED, texturePath= 'res:/UI/Texture/classes/Monetization/Trial_Icon_NoGlow_256.png', left=-20, width=200, height=200) self.iconGlare1 = Sprite( parent=mainCont, align=uiconst.CENTERLEFT, state=uiconst.UI_DISABLED, texturePath='res:/UI/Texture/classes/Monetization/glare_256_1.png', textureSecondaryPath= 'res:/UI/Texture/classes/Monetization/Trial_Icon_NoGlow_256.png', spriteEffect=trinity.TR2_SFX_MODULATE, blendMode=trinity.TR2_SBM_ADDX2, left=-20, width=200, height=200, tileX=True, tileY=True) self.iconGlare2 = Sprite( parent=mainCont, align=uiconst.CENTERLEFT, state=uiconst.UI_DISABLED, texturePath='res:/UI/Texture/classes/Monetization/glare_256_2.png', textureSecondaryPath= 'res:/UI/Texture/classes/Monetization/Trial_Icon_NoGlow_256.png', spriteEffect=trinity.TR2_SFX_MODULATE, left=-20, width=200, height=200, tileX=True, tileY=True) buttonCont = FlowContainer(parent=bodyCont, align=uiconst.TOTOP, centerContent=True, contentSpacing=(4, 4), padding=(8, 16, 8, 16)) closeButton = Button( parent=buttonCont, align=uiconst.NOALIGN, fixedheight=26, label=localization.GetByLabel('UI/TrialUpsell/ButtonClose'), fontsize=12, func=lambda _: self.Close(), color=(0.2, 0.2, 0.2, 1.0)) closeButton.sr.activeframe.SetFixedColor((0.6, 0.6, 0.6, 1.0)) moreButton = Button( parent=buttonCont, align=uiconst.NOALIGN, fixedheight=26, label=localization.GetByLabel('UI/TrialUpsell/ButtonSubscribe'), fontsize=14, func=lambda _: self.OpenSubscriptionPage(), color=(0.8, 0.6, 0.2, 0.6)) moreButton.sr.activeframe.SetFixedColor((0.9, 0.9, 0.9, 1.0)) self.Animate()
def Layout(self): self.HideHeader() self.MakeUnResizeable() self.container = ContainerAutoSize(parent=self.GetMainArea(), align=uiconst.TOTOP, alignMode=uiconst.TOTOP, state=uiconst.UI_PICKCHILDREN, padding=(15, 15, 15, 0), callback=self.OnContainerResized) EveLabelLargeBold(parent=self.container, align=uiconst.TOTOP, text=localization.GetByLabel( 'UI/ActivateMultiTraining/ActivateHeading')) EveLabelMedium(parent=self.container, align=uiconst.TOTOP, text=localization.GetByLabel( 'UI/ActivateMultiTraining/ActivateDescription'), color=self.GRAY_COLOR, padding=(0, 5, 0, 10)) Line(parent=self.container, align=uiconst.TOTOP, color=self.LINE_COLOR) slot1 = ContainerAutoSize(parent=self.container, align=uiconst.TOTOP, alignMode=uiconst.TOTOP, state=uiconst.UI_PICKCHILDREN, bgColor=(0, 0, 0, 0.3)) self.slot1Background = Fill(parent=slot1, color=self.GREEN_COLOR, opacity=0.0) self.slot1Title = EveLabelMediumBold(parent=slot1, align=uiconst.TOTOP, text='', padding=(60, 12, 140, 0), color=self.WHITE_COLOR) self.slot1Expiry = EveLabelMediumBold(parent=slot1, align=uiconst.TOTOP, text='', padding=(60, 0, 140, 10), color=self.GRAY_COLOR) self.slot1Button = Button(parent=slot1, label='', align=uiconst.CENTERRIGHT, fontsize=13, fixedwidth=120, fixedheight=30, pos=(10, 0, 0, 0)) self.slot1Button.confirmHilite = GradientSprite( bgParent=self.slot1Button, rotation=-math.pi / 2, rgbData=[(0, self.GREEN_COLOR[:3])], alphaData=[(0, 0.5), (0.3, 0.2), (0.6, 0.14)], opacity=0.0) self.slot1Icon = Sprite( parent=slot1, texturePath='res:/UI/Texture/Icons/add_training_queue.png', align=uiconst.CENTERLEFT, pos=(15, 0, 32, 32)) Line(parent=self.container, align=uiconst.TOTOP, color=self.LINE_COLOR) slot2 = ContainerAutoSize(parent=self.container, align=uiconst.TOTOP, alignMode=uiconst.TOTOP, state=uiconst.UI_PICKCHILDREN, bgColor=(0, 0, 0, 0.3)) self.slot2Background = Fill(parent=slot2, color=self.GREEN_COLOR, opacity=0.0) self.slot2Title = EveLabelMediumBold(parent=slot2, align=uiconst.TOTOP, text='', padding=(60, 12, 140, 0), color=self.WHITE_COLOR) self.slot2Expiry = EveLabelMediumBold(parent=slot2, align=uiconst.TOTOP, text='', padding=(60, 0, 140, 10), color=self.GRAY_COLOR) self.slot2Button = Button(parent=slot2, label='', align=uiconst.CENTERRIGHT, fontsize=13, fixedwidth=120, fixedheight=30, pos=(10, 0, 0, 0)) self.slot2Button.confirmHilite = GradientSprite( bgParent=self.slot2Button, rotation=-math.pi / 2, rgbData=[(0, self.GREEN_COLOR[:3])], alphaData=[(0, 0.5), (0.3, 0.2), (0.6, 0.14)], opacity=0.0) self.slot2Icon = Sprite( parent=slot2, texturePath='res:/UI/Texture/Icons/add_training_queue.png', align=uiconst.CENTERLEFT, pos=(15, 0, 32, 32)) Line(parent=self.container, align=uiconst.TOTOP, color=self.LINE_COLOR) self.closeButton = Button( parent=self.container, label=localization.GetByLabel('UI/Generic/Cancel'), func=self.Close, align=uiconst.TOTOP, fontsize=13, padding=(120, 10, 120, 30))
def ApplyAttributes(self, attributes): Container.ApplyAttributes(self, attributes) self.offer = attributes.offer self._charID = None self._typeID = None self.on_charid = fsdlite.Signal() self.on_typeid = fsdlite.Signal() self.on_charid.connect(self.OnPickCharacter) self.on_typeid.connect(self.OnPickType) self.charButtons = [] self._charButtonsDisplayed = False textLayer = Container(name='TextLayer', parent=self) descriptionBox = ContainerAutoSize(parent=textLayer, align=uiconst.TOBOTTOM, bgColor=OFFER_TEXT_BOX_COLOR, clipChildren=True) Label(parent=descriptionBox, align=uiconst.TOTOP, text=self.offer.description, fontsize=VGS_FONTSIZE_SMALL, padding=(INFO_PADDING_BIG, 0, INFO_PADDING_BIG, 10)) titleBox = ContainerAutoSize(name='InfoBox', parent=textLayer, align=uiconst.TOBOTTOM, bgColor=OFFER_TEXT_BOX_COLOR) Label(parent=titleBox, align=uiconst.TOTOP, text=self.offer.name, fontsize=VGS_FONTSIZE_LARGE, padding=(INFO_PADDING_BIG, 2, INFO_PADDING_BIG + 32, 2), fontStyle=fontConst.STYLE_HEADER, uppercase=True, lineSpacing=-0.15) collapseBox = ContainerAutoSize(parent=textLayer, align=uiconst.TOBOTTOM_NOPUSH, top=-36) CollapseButton(parent=collapseBox, align=uiconst.TOPRIGHT, target=descriptionBox) self.characterPickerLayer = ContainerAutoSize( parent=self, align=uiconst.TOPLEFT, state=uiconst.UI_PICKCHILDREN, top=50 if self.offer.label else 10, left=10) self.CreateCharacterButtons() self.loadingLayer = Container(parent=self, align=uiconst.TOALL, state=uiconst.UI_DISABLED) self.loadingWheel = LoadingWheel(parent=self.loadingLayer, align=uiconst.CENTER, state=uiconst.UI_DISABLED, opacity=0.0) self.cover = Sprite( parent=self.loadingLayer, align=uiconst.TOALL, texturePath='res:/UI/Texture/preview/asset_preview_background.png') self.imageLayer = Transform(name='imageLayer', parent=self, align=uiconst.TOALL, scalingCenter=(0.5, 0.5), bgColor=OFFER_BACKGROUND_COLOR) if self.offer.label is not None: Ribbon(parent=self.imageLayer, align=uiconst.TOPLEFT, label=self.offer.label, state=uiconst.UI_DISABLED, idx=0, isBig=True) self.previewContainer = PreviewContainer( parent=self.imageLayer, OnStartLoading=self.OnStartLoading, OnStopLoading=self.OnStopLoading) self.lazySprite = LazyUrlSprite(parent=self.imageLayer, align=uiconst.TOALL, imageUrl=self.offer.imageUrl, state=uiconst.UI_DISABLED) GradientSprite(name='OfferGradient', align=uiconst.TOALL, bgParent=self.imageLayer, rgbData=((1.0, OFFER_RADIAL_SHADOW), ), alphaData=((0.0, 0.0), (1.0, 1.0)), radial=True, idx=0) self.PickFirstPreviewableType()