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

skillIcon.py (2504B)


      1 #Embedded file name: C:\BuildAgent\work\20d73f1b24eed06e\eve\release\V24.01\eve\client\script\ui\shared\industry\views\skillIcon.py
      2 import carbonui.const as uiconst
      3 from carbon.client.script.environment.AudioUtil import PlaySound
      4 from carbonui.primitives.container import Container
      5 from carbonui.primitives.sprite import Sprite
      6 from eve.client.script.ui.control.themeColored import FillThemeColored
      7 from eve.client.script.ui.shared.industry.industryUIConst import GetJobColor
      8 from eve.client.script.ui.shared.industry.views.industryTooltips import SkillTooltipPanel
      9 from eve.client.script.ui.tooltips.tooltipHandler import TOOLTIP_DELAY_GAMEPLAY
     10 from carbonui.uicore import uicore
     11 
     12 class SkillIcon(Container):
     13     default_name = 'SkillIcon'
     14     default_state = uiconst.UI_NORMAL
     15     default_width = 67
     16     default_height = 46
     17     default_bgTexturePath = 'res:/UI/Texture/classes/Industry/Center/skillFrame.png'
     18 
     19     def ApplyAttributes(self, attributes):
     20         Container.ApplyAttributes(self, attributes)
     21         self.jobData = attributes.jobData
     22         self.skills = []
     23         self.skillIcon = Sprite(name='skillIcon', parent=self, align=uiconst.CENTER, state=uiconst.UI_DISABLED, pos=(0, -1, 33, 33))
     24         self.patternSprite = Sprite(name='patternSprite', bgParent=self, texturePath='res:/UI/Texture/classes/Industry/Center/skillFramePattern.png')
     25         FillThemeColored(bgParent=self, padding=3)
     26         self.UpdateState()
     27 
     28     def UpdateState(self, *args):
     29         if not self.jobData:
     30             return
     31         self.jobData.on_updated.connect(self.UpdateState)
     32         texturePath, _ = sm.GetService('skills').GetRequiredSkillsLevelTexturePathAndHint(self.skills)
     33         self.skillIcon.SetTexturePath(texturePath)
     34         color = GetJobColor(self.jobData)
     35         uicore.animations.SpColorMorphTo(self.patternSprite, self.patternSprite.GetRGBA(), color, duration=0.3)
     36 
     37     def OnNewJobData(self, jobData):
     38         self.jobData = jobData
     39         if not self.jobData:
     40             self.skills = []
     41             return
     42         skills = self.jobData.required_skills
     43         self.skills = [ (skill.typeID, skill.level) for skill in skills if skill.typeID is not None ]
     44         self.UpdateState()
     45 
     46     def LoadTooltipPanel(self, tooltipPanel, *args):
     47         self.tooltipPanel = SkillTooltipPanel(skills=self.skills, tooltipPanel=tooltipPanel)
     48 
     49     def GetTooltipPointer(self):
     50         return uiconst.POINT_LEFT_2
     51 
     52     def OnMouseEnter(self, *args):
     53         PlaySound(uiconst.SOUND_BUTTON_HOVER)