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

standingsHeaderButtons.py (4274B)


      1 #Embedded file name: C:\BuildAgent\work\20d73f1b24eed06e\eve\release\V24.01\eve\client\script\ui\shared\neocom\charsheet\standingsPanel\standingsHeaderButtons.py
      2 import evetypes
      3 from carbonui import uiconst
      4 from carbonui.primitives.container import Container
      5 from carbonui.primitives.sprite import Sprite
      6 from carbonui.uianimations import animations
      7 from eve.client.script.ui.control.themeColored import SpriteThemeColored
      8 from eve.client.script.ui.shared.shipTree.infoBubble import SkillEntry
      9 from eve.client.script.ui.shared.standings import standingUIConst
     10 from localization import GetByLabel
     11 
     12 class BaseStandingButton(Container):
     13     default_name = 'StandingActionButton'
     14 
     15     def ApplyAttributes(self, attributes):
     16         Container.ApplyAttributes(self, attributes)
     17         self.func = attributes.func
     18         self.standingData = attributes.standingData
     19         SpriteThemeColored(parent=self, align=uiconst.TOALL, state=uiconst.UI_DISABLED, texturePath=attributes.texturePath, colorType=uiconst.COLORTYPE_UIHILIGHTGLOW, opacity=0.7)
     20         Sprite(name='bgHoverFrame', bgParent=self, texturePath='res:/UI/texture/shared/frame.png', opacity=0.2, colorType=uiconst.COLORTYPE_UIHILIGHTGLOW)
     21         self.bgFrame = SpriteThemeColored(name='bgHoverFrame', bgParent=self, texturePath='res:/UI/texture/shared/frameHover.png', opacity=0.0, colorType=uiconst.COLORTYPE_UIHILIGHTGLOW)
     22 
     23     def LoadTooltipPanel(self, tooltipPanel, *args):
     24         tooltipPanel.LoadGeneric2ColumnTemplate()
     25         tooltipPanel.AddLabelLarge(text=self.GetHintLabel(), colSpan=2, bold=True)
     26         tooltipPanel.AddSpacer(1, 8, 2)
     27         tooltipPanel.AddLabelMedium(text=self.GetHintText(), colSpan=2, wrapWidth=230)
     28 
     29     def GetHintLabel(self):
     30         pass
     31 
     32     def GetHintText(self):
     33         pass
     34 
     35     def OnClick(self, *args):
     36         self.func()
     37 
     38     def OnMouseEnter(self, *args):
     39         animations.FadeTo(self.bgFrame, 0.3, 0.0, duration=0.5)
     40 
     41     def OnMouseExit(self, *args):
     42         animations.FadeOut(self.bgFrame, duration=0.3)
     43 
     44 
     45 class StandingActionButton(BaseStandingButton):
     46 
     47     def ApplyAttributes(self, attributes):
     48         self.actionID = attributes.actionID
     49         BaseStandingButton.ApplyAttributes(self, attributes)
     50 
     51     def LoadTooltipPanel(self, tooltipPanel, *args):
     52         if self.actionID == standingUIConst.ACTION_TRAINSKILL:
     53             tooltipPanel.LoadGeneric2ColumnTemplate()
     54             tooltipPanel.state = uiconst.UI_NORMAL
     55             self.CreateTooltipSkill(tooltipPanel)
     56         else:
     57             BaseStandingButton.LoadTooltipPanel(self, tooltipPanel, *args)
     58 
     59     def CreateTooltipSkill(self, tooltipPanel):
     60         skillTypeID = self.standingData.GetSkillTypeID2To1()
     61         skillLevel = sm.GetService('skills').MySkillLevel(skillTypeID)
     62         tooltipPanel.AddLabelLarge(text=GetByLabel('UI/Standings/Actions/SocialSkills'), colSpan=2, bold=True)
     63         tooltipPanel.AddSpacer(1, 8, 2)
     64         tooltipPanel.AddLabelMedium(text=GetByLabel('Tooltips/CharacterSheet/StandingSkillTooltip', skillName=evetypes.GetName(skillTypeID), ownerID=self.standingData.GetOwnerID2()), colSpan=2, wrapWidth=230)
     65         tooltipPanel.AddSpacer(1, 8, 2)
     66         tooltipPanel.AddRow(rowClass=SkillEntry, typeID=skillTypeID, level=skillLevel, showLevel=False, skillBarPadding=(24, 0, 0, 0), cellPadding=(0, 0, 0, 0), textPadding=(0, 0, 0, 0))
     67         tooltipPanel.AddSpacer(1, 8, 2)
     68 
     69     def GetHintLabel(self):
     70         return GetByLabel(standingUIConst.LABELS_BY_ACTIONID[self.actionID])
     71 
     72     def GetHintText(self):
     73         ownerName = cfg.eveowners.Get(self.standingData.GetOwnerID2()).ownerName
     74         hintText = GetByLabel(standingUIConst.HINTS_BY_ACTIONID[self.actionID], ownerName=ownerName)
     75         return hintText
     76 
     77 
     78 class StandingBenefitButton(BaseStandingButton):
     79 
     80     def ApplyAttributes(self, attributes):
     81         self.benefitID = attributes.benefitID
     82         BaseStandingButton.ApplyAttributes(self, attributes)
     83 
     84     def GetHintLabel(self):
     85         return GetByLabel(standingUIConst.LABELS_BY_BENEFITID[self.benefitID])
     86 
     87     def GetHintText(self):
     88         ownerName = cfg.eveowners.Get(self.standingData.GetOwnerID2()).ownerName
     89         hintText = GetByLabel(standingUIConst.HINTS_BY_BENEFITID[self.benefitID], ownerName=ownerName)
     90         return hintText