NovaBryan/EVE_Dump
Log | Files | 📦 下载最新源码 (.zip) | Refs | README

skillQueueButtons.py (5937B)


      1 #Embedded file name: C:\BuildAgent\work\20d73f1b24eed06e\eve\release\V24.01\eve\client\script\ui\skillPlan\skillQueuePanel\skillQueueButtons.py
      2 from carbon.client.script.environment.AudioUtil import PlaySound
      3 from carbonui import ButtonStyle, uiconst
      4 from carbonui.control.button import Button
      5 from carbonui.primitives.containerAutoSize import ContainerAutoSize
      6 from carbonui.primitives.sprite import Sprite
      7 from carbonui.uicore import uicore
      8 from eve.client.script.ui.control import tooltips
      9 from eve.client.script.ui.control.eveLabel import Label
     10 from eve.client.script.ui.shared.cloneGrade import cloneStateUtil, ORIGIN_TRAININGSPEEDICON, ORIGIN_SKILLPLANBUTTON
     11 from eve.client.script.ui.skilltrading.banner import SkillInjectorBanner, AlphaInjectorBanner
     12 from eve.client.script.ui.tooltips.tooltipsWrappers import TooltipBaseWrapper
     13 from inventorycommon import const as invconst
     14 from localization import GetByLabel
     15 from omega.client.clone_grade_svc import get_clone_grade_svc
     16 ICON_SIZE = 26
     17 BUTTON_SIZE = 32
     18 
     19 class ExpertSystemIconButton(Button):
     20 
     21     def LoadTooltipPanel(self, tooltipPanel, *args):
     22         tooltipPanel.LoadGeneric1ColumnTemplate()
     23         tooltipPanel.margin = (12, 8, 12, 8)
     24         tooltipPanel.AddSpriteLabel(texturePath='res:/UI/Texture/classes/ExpertSystems/logo_simple_32.png', label=GetByLabel('UI/CharacterSheet/CharacterSheetWindow/ExpertSystems/ExpertSystems'), iconOffset=0)
     25         tooltipPanel.AddSpacer(0, 5)
     26         tooltipPanel.AddLabelMedium(text=GetByLabel('UI/CharacterSheet/CharacterSheetWindow/ExpertSystems/ExpertSystemDescription'), wrapWidth=200)
     27 
     28 
     29 class ApplySkillPointsButtonTooltip(TooltipBaseWrapper):
     30 
     31     def __init__(self, queueLength, freeSkillPoints):
     32         super(ApplySkillPointsButtonTooltip, self).__init__()
     33         self.queueLength = queueLength
     34         self.freeSkillPoints = freeSkillPoints
     35 
     36     def CreateTooltip(self, parent, owner, idx):
     37         self.tooltipPanel = tooltips.TooltipPanel(parent=parent, owner=owner, idx=idx)
     38         self.tooltipPanel.LoadGeneric1ColumnTemplate()
     39         self.tooltipPanel.SetState(uiconst.UI_NORMAL)
     40         if self.queueLength <= 0:
     41             text = GetByLabel('UI/SkillQueue/ApllySkillPointsDisabledHint')
     42         elif self.freeSkillPoints <= 0:
     43             text = GetByLabel('UI/SkillQueue/FreeSkillPointsNeededLabel', injectorTypeID=invconst.typeSkillInjector)
     44         else:
     45             text = GetByLabel('UI/SkillQueue/ApplySkillPoints')
     46         self.tooltipPanel.AddLabelMedium(text=text, wrapWidth=250, state=uiconst.UI_NORMAL)
     47         return self.tooltipPanel
     48 
     49 
     50 class SkillInjectorTooltip(TooltipBaseWrapper):
     51 
     52     def __init__(self):
     53         super(SkillInjectorTooltip, self).__init__()
     54 
     55     def CreateTooltip(self, parent, owner, idx):
     56         self.tooltipPanel = tooltips.TooltipPanel(parent=parent, owner=owner, idx=idx)
     57         self.tooltipPanel.LoadGeneric1ColumnTemplate()
     58         self.tooltipPanel.SetState(uiconst.UI_NORMAL)
     59         self.tooltipPanel.AddCell(SkillInjectorBanner(align=uiconst.TOPLEFT, width=280))
     60         return self.tooltipPanel
     61 
     62 
     63 class AlphaInjectorTooltip(TooltipBaseWrapper):
     64 
     65     def __init__(self):
     66         super(AlphaInjectorTooltip, self).__init__()
     67 
     68     def CreateTooltip(self, parent, owner, idx):
     69         self.tooltipPanel = tooltips.TooltipPanel(parent=parent, owner=owner, idx=idx)
     70         self.tooltipPanel.LoadGeneric1ColumnTemplate()
     71         self.tooltipPanel.SetState(uiconst.UI_NORMAL)
     72         self.tooltipPanel.AddCell(AlphaInjectorBanner(align=uiconst.TOPLEFT, width=280))
     73         return self.tooltipPanel
     74 
     75 
     76 class TrainingSpeedIcon(ContainerAutoSize):
     77     default_name = 'TrainingSpeedIcon'
     78     default_height = 18
     79     default_state = uiconst.UI_NORMAL
     80     default_opacity = 0.7
     81     __notifyevents__ = ['OnSubscriptionChanged']
     82 
     83     def ApplyAttributes(self, attributes):
     84         ContainerAutoSize.ApplyAttributes(self, attributes)
     85         sm.RegisterNotify(self)
     86         cont = ContainerAutoSize(parent=self, align=uiconst.TOLEFT)
     87         self.label = Label(parent=cont, align=uiconst.CENTER, bold=True, padRight=3, colorType=uiconst.COLORTYPE_UIHILIGHTGLOW, opacity=1.0)
     88         self.icon = Sprite(parent=self, align=uiconst.TOLEFT, state=uiconst.UI_DISABLED, texturePath='res:/UI/Texture/Classes/CloneGrade/trainingSpeed.png', width=16, colorType=uiconst.COLORTYPE_UIHILIGHTGLOW, opacity=0.9)
     89         self.UpdateText()
     90 
     91     def UpdateText(self):
     92         if self.IsOmega():
     93             self.label.text = '2x'
     94         else:
     95             self.label.text = '1x'
     96 
     97     def LoadTooltipPanel(self, tooltipPanel, *args):
     98         return cloneStateUtil.LoadTooltipPanel(tooltipPanel, self.GetTooltipText(), origin=ORIGIN_TRAININGSPEEDICON)
     99 
    100     def IsOmega(self):
    101         return get_clone_grade_svc().is_omega_with_grace_period()
    102 
    103     def GetTooltipText(self):
    104         if self.IsOmega():
    105             return GetByLabel('UI/CharacterSheet/CharacterSheetWindow/SkillTabs/TrainingSpeedOmega')
    106         else:
    107             return GetByLabel('UI/CharacterSheet/CharacterSheetWindow/SkillTabs/TrainingSpeedAlpha')
    108 
    109     def OnMouseEnter(self, *args):
    110         PlaySound(uiconst.SOUND_BUTTON_HOVER)
    111 
    112     def OnSubscriptionChanged(self):
    113         self.UpdateText()
    114 
    115 
    116 class OmegaButton(Button):
    117     default_iconSize = 24
    118     default_style = ButtonStyle.MONETIZATION
    119     default_texturePath = 'res:/UI/Texture/classes/Seasons/omega_32x32.png'
    120     origin = ORIGIN_SKILLPLANBUTTON
    121 
    122     def ApplyAttributes(self, attributes):
    123         attributes.func = lambda button: uicore.cmd.OpenCloneUpgradeWindow(origin=button.origin)
    124         super(OmegaButton, self).ApplyAttributes(attributes)
    125 
    126 
    127 class OmegaTrainingSpeedButton(OmegaButton):
    128     origin = ORIGIN_TRAININGSPEEDICON
    129 
    130     def LoadTooltipPanel(self, tooltipPanel, *args):
    131         text = GetByLabel('UI/CharacterSheet/CharacterSheetWindow/SkillTabs/TrainingSpeedAlpha')
    132         return cloneStateUtil.LoadTooltipPanel(tooltipPanel, text, origin=self.origin)