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

infoIcon.py (7667B)


      1 #Embedded file name: C:\BuildAgent\work\20d73f1b24eed06e\eve\release\V24.01\eve\client\script\ui\control\infoIcon.py
      2 from carbon.client.script.environment.AudioUtil import PlaySound
      3 from carbonui import const as uiconst
      4 from carbonui.primitives.container import Container
      5 from carbonui.primitives.sprite import Sprite
      6 from eve.client.script.ui import eveColor, eveThemeColor
      7 from eve.client.script.ui.control.glowSprite import GlowSprite
      8 
      9 class InfoIcon(GlowSprite):
     10     default_abstractinfo = None
     11     default_texturePath = 'res:/ui/Texture/Icons/38_16_208.png'
     12     default_name = 'InfoIcon'
     13     default_typeID = None
     14     default_itemID = None
     15     default_width = 16
     16     default_height = 16
     17 
     18     def ApplyAttributes(self, attributes):
     19         GlowSprite.ApplyAttributes(self, attributes)
     20         self.itemID = attributes.get('itemID', self.default_itemID)
     21         self.typeID = attributes.get('typeID', self.default_typeID)
     22         self.abstractinfo = attributes.get('abstractinfo', self.default_abstractinfo)
     23 
     24     def OnClick(self, *args):
     25         if not self.typeID:
     26             return
     27         PlaySound(uiconst.SOUND_BUTTON_CLICK)
     28         self.ShowInfo(self.typeID, self.itemID, self.abstractinfo)
     29 
     30     def ShowInfo(self, typeID, itemID, abstractinfo, *_args):
     31         sm.GetService('info').ShowInfo(typeID=typeID, itemID=itemID, abstractinfo=abstractinfo)
     32 
     33     def UpdateInfoLink(self, typeID, itemID, abstractinfo = None):
     34         self.typeID = typeID
     35         self.itemID = itemID
     36         self.abstractinfo = abstractinfo
     37 
     38     def SetTypeID(self, typeID):
     39         self.typeID = typeID
     40 
     41     def SetItemID(self, itemID):
     42         self.itemID = itemID
     43 
     44     def SetAbstractInfo(self, abstractInfo):
     45         self.abstractinfo = abstractInfo
     46 
     47     def OnMouseEnter(self, *args):
     48         GlowSprite.OnMouseEnter(self, *args)
     49         PlaySound(uiconst.SOUND_BUTTON_HOVER)
     50 
     51 
     52 class MoreInfoIcon(Sprite):
     53     default_width = 16
     54     default_height = 16
     55     default_texturePath = 'res:/ui/Texture/Shared/moreIcon.png'
     56 
     57     def GetTooltipDelay(self):
     58         return 0
     59 
     60     def OnMouseDown(self, *args):
     61         pass
     62 
     63     def OnMouseUp(self, *args):
     64         pass
     65 
     66     def OnMouseEnter(self, *args):
     67         PlaySound(uiconst.SOUND_BUTTON_HOVER)
     68 
     69 
     70 class MoreInfoIconBeta(Container):
     71     default_width = 16
     72     default_height = 16
     73     default_texturePath_circle = 'res:/ui/Texture/Shared/questionMarkCircle.png'
     74     default_texturePath_questionMark = 'res:/ui/Texture/Shared/questionMark.png'
     75     default_align = uiconst.TOPLEFT
     76     default_state = uiconst.UI_NORMAL
     77     default_circle_color = eveColor.CRYO_BLUE
     78 
     79     def ApplyAttributes(self, attributes):
     80         super(MoreInfoIconBeta, self).ApplyAttributes(attributes)
     81         self.circleTexturePath = attributes.get('circleTexturePath', self.default_texturePath_circle)
     82         self.circleColor = attributes.get('circleColor', self.default_circle_color)
     83         self.questionMarkTexturePath = attributes.get('questionMarkTexturePath', self.default_texturePath_questionMark)
     84         self.circle = GlowSprite(name='circle', parent=self, align=uiconst.CENTER, pos=(0,
     85          0,
     86          self.height,
     87          self.width), texturePath=self.circleTexturePath, state=uiconst.UI_DISABLED, color=self.circleColor)
     88         self.questionMark = Sprite(name='questionMark', parent=self, align=uiconst.CENTER, pos=(0,
     89          0,
     90          self.height,
     91          self.width), texturePath=self.questionMarkTexturePath, state=uiconst.UI_DISABLED)
     92 
     93     def GetTooltipDelay(self):
     94         return 0
     95 
     96     def OnMouseEnter(self, *args):
     97         super(MoreInfoIconBeta, self).OnMouseEnter(*args)
     98         self.circle.OnMouseEnter()
     99         PlaySound(uiconst.SOUND_BUTTON_HOVER)
    100 
    101     def OnMouseExit(self, *args):
    102         super(MoreInfoIconBeta, self).OnMouseExit(*args)
    103         self.circle.OnMouseExit()
    104 
    105 
    106 class MoreExtraInfoInTooltip(MoreInfoIcon):
    107     default_width = 11
    108     default_height = 11
    109     default_texturePath = 'res:/ui/Texture/Icons/generic/extraInfoInTooltip.png'
    110 
    111     def OnMouseEnter(self, *args):
    112         super(MoreExtraInfoInTooltip, self).OnMouseEnter(*args)
    113         self.opacity = 1.5
    114 
    115     def OnMouseExit(self, *args):
    116         super(MoreExtraInfoInTooltip, self).OnMouseExit(*args)
    117         self.opacity = 1.0
    118 
    119 
    120 class GlyphIcon(Container):
    121     default_align = uiconst.TOPLEFT
    122     default_state = uiconst.UI_NORMAL
    123     default_width = 16
    124     default_height = 16
    125     default_frameTexture = None
    126     default_glyphTexture = None
    127     default_frameColor = eveColor.WHITE
    128     default_glyphColor = eveColor.WHITE
    129     default_glowAmount = 0.5
    130 
    131     def ApplyAttributes(self, attributes):
    132         super(GlyphIcon, self).ApplyAttributes(attributes)
    133         self.frameTexture = attributes.get('frameTexture', self.default_frameTexture)
    134         self.glyphTexture = attributes.get('glyphTexture', self.default_glyphTexture)
    135         self.frameColor = attributes.get('frameColor', self.default_frameColor)
    136         self.glyphColor = attributes.get('glyphColor', self.default_glyphColor)
    137         self.glowAmount = attributes.get('glowAmount', self.default_glowAmount)
    138         self.func = attributes.get('func', None)
    139         self.ConstructLayout()
    140 
    141     def ConstructLayout(self):
    142         self.frame = GlowSprite(name='frame', parent=self, align=uiconst.CENTER, state=uiconst.UI_DISABLED, texturePath=self.frameTexture, color=self.frameColor, pos=(0,
    143          0,
    144          self.height,
    145          self.width), glowAmount=self.default_glowAmount)
    146         if not self.glyphTexture:
    147             return
    148         self.glyph = Sprite(name='glyph', parent=self, align=uiconst.CENTER, state=uiconst.UI_DISABLED, texturePath=self.glyphTexture, color=self.glyphColor, pos=(0,
    149          0,
    150          self.height,
    151          self.width))
    152 
    153     def OnClick(self, *args):
    154         if self.func:
    155             self.func()
    156 
    157 
    158 class ThemedGlyphIcon(GlyphIcon):
    159     default_frameColor = eveThemeColor.THEME_FOCUS
    160 
    161     def OnColorThemeChanged(self):
    162         super(ThemedGlyphIcon, self).OnColorThemeChanged()
    163         self.frameColor = eveThemeColor.THEME_FOCUS
    164         self.frame.color = self.frameColor
    165 
    166 
    167 class CheckMarkGlyphIcon(GlyphIcon):
    168     default_frameTexture = 'res:/ui/Texture/classes/Menu/Icons/circleBG.png'
    169     default_glyphTexture = 'res:/ui/Texture/classes/Menu/Icons/checkmark.png'
    170     default_frameColor = eveColor.SUCCESS_GREEN
    171 
    172 
    173 class ExclamationMarkGlyphIcon(GlyphIcon):
    174     default_frameTexture = 'res:/ui/Texture/classes/Menu/Icons/circleBG.png'
    175     default_glyphTexture = 'res:/ui/Texture/classes/Menu/Icons/exclamationMark.png'
    176     default_frameColor = eveColor.WARNING_ORANGE
    177 
    178 
    179 class WarningGlyphIcon(GlyphIcon):
    180     default_frameTexture = 'res:/ui/Texture/classes/Menu/Icons/triangleBG.png'
    181     default_glyphTexture = 'res:/ui/Texture/classes/Menu/Icons/exclamationMark.png'
    182     default_frameColor = eveColor.DANGER_RED
    183 
    184 
    185 class InfoGlyphIcon(ThemedGlyphIcon):
    186     default_frameTexture = 'res:/ui/Texture/classes/Menu/Icons/circleBG.png'
    187     default_glyphTexture = 'res:/ui/Texture/classes/Menu/Icons/info.png'
    188 
    189 
    190 class PlayGlyphIcon(ThemedGlyphIcon):
    191     default_frameTexture = 'res:/ui/Texture/classes/Menu/Icons/circleBG.png'
    192     default_glyphTexture = 'res:/ui/Texture/classes/Menu/Icons/play.png'
    193 
    194 
    195 class QuestionMarkGlyphIcon(ThemedGlyphIcon):
    196     default_frameTexture = 'res:/ui/Texture/classes/Menu/Icons/circleBG.png'
    197     default_glyphTexture = 'res:/ui/Texture/classes/Menu/Icons/questionMark.png'
    198 
    199 
    200 class AttentionGlyphIcon(GlyphIcon):
    201     default_frameTexture = 'res:/ui/Texture/classes/Menu/Icons/circleBG.png'
    202     default_glyphTexture = 'res:/ui/Texture/classes/Menu/Icons/exclamationMark.png'
    203     default_frameColor = eveColor.OMEGA_YELLOW