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

standingEntries.py (5734B)


      1 #Embedded file name: C:\BuildAgent\work\20d73f1b24eed06e\eve\release\V24.01\eve\client\script\ui\shared\standings\standingEntries.py
      2 import math
      3 from carbonui import uiconst
      4 from carbonui.primitives.container import Container
      5 from eve.client.script.ui.control.eveIcon import OwnerIconAndLabel, OwnerIcon
      6 from eve.client.script.ui.control.eveWindowUnderlay import ListEntryUnderlay
      7 from eve.client.script.ui.control.themeColored import GradientThemeColored, SpriteThemeColored
      8 from eve.client.script.ui.shared.standings.standingLabel import StandingLabel
      9 from eve.client.script.ui.shared.standings.standingsUIUtil import GetBGOpacity
     10 from eve.common.script.util.standingUtil import OpenStandingsPanelOnOwnerByID
     11 
     12 class StandingsEntry(Container):
     13     default_state = uiconst.UI_NORMAL
     14 
     15     def ApplyAttributes(self, attributes):
     16         super(StandingsEntry, self).ApplyAttributes(attributes)
     17         self.standingData = attributes.standingData
     18         self._hiliteFill = None
     19 
     20     def ConstructHiliteFill(self):
     21         if not self._hiliteFill:
     22             self._hiliteFill = ListEntryUnderlay(bgParent=self)
     23 
     24     def ShowHilite(self, animate = True):
     25         self.ConstructHiliteFill()
     26         self._hiliteFill.set_hovered(True, animate)
     27 
     28     def OnMouseEnter(self, *args):
     29         self.ShowHilite()
     30 
     31     def HideHilite(self, animate = True):
     32         self.ConstructHiliteFill()
     33         self._hiliteFill.set_hovered(False, animate)
     34 
     35     def OnMouseExit(self, *args):
     36         self.HideHilite()
     37 
     38 
     39 class StandingsEntryOneWay(StandingsEntry):
     40     default_name = 'StandingsEntryOneWay'
     41 
     42     def ApplyAttributes(self, attributes):
     43         super(StandingsEntryOneWay, self).ApplyAttributes(attributes)
     44         self.commonOwnerID = attributes.commonOwnerID
     45         isEvenRow = attributes.isEvenRow
     46         self.hideName = getattr(attributes, 'hideName', False)
     47         self.ConstructRightCont()
     48         GradientThemeColored(bgParent=self, alphaData=((0.0, 0.0), (0.5, 0.5), (1.0, 0.0)), colorType=uiconst.COLORTYPE_UIBASECONTRAST, rotation=0)
     49         if self.standingData.IsRightToLeft():
     50             left = 12
     51             rotation = math.pi
     52         else:
     53             left = -12
     54             rotation = 0.0
     55         SpriteThemeColored(parent=self, align=uiconst.CENTER, state=uiconst.UI_DISABLED, texturePath='res:/UI/Texture/Classes/Standings/arrowsBG.png', pos=(left,
     56          0,
     57          103,
     58          22), opacity=GetBGOpacity(isEvenRow), rotation=rotation)
     59 
     60     def ConstructRightCont(self):
     61         StandingLabel(parent=self, align=uiconst.CENTER, standingData=self.standingData, isRightToLeft=self.standingData.IsRightToLeft())
     62         align = uiconst.CENTERRIGHT if self.standingData.IsRightToLeft() else uiconst.CENTERLEFT
     63         iconAlign = uiconst.TORIGHT if self.standingData.IsRightToLeft() else uiconst.TOLEFT
     64         if self.hideName:
     65             ownerIconComponent = OwnerIcon
     66         else:
     67             ownerIconComponent = OwnerIconAndLabel
     68         ownerIconComponent(parent=self, align=align, ownerID=self.GetOwnerID(), iconSize=28, height=28, width=28, iconAlign=iconAlign)
     69 
     70     def GetOwnerID(self):
     71         if self.commonOwnerID == self.standingData.ownerID2:
     72             return self.standingData.ownerID1
     73         return self.standingData.ownerID2
     74 
     75     def GetStandingFormatted(self):
     76         if self.standingData.IsRightToLeft():
     77             return self.standingData.GetStanding2To1Formatted()
     78         else:
     79             return self.standingData.GetStanding1To2Formatted()
     80 
     81     def GetStanding(self):
     82         if self.standingData.IsRightToLeft():
     83             return self.standingData.GetStanding2To1()
     84         else:
     85             return self.standingData.GetStanding1To2()
     86 
     87     def OnDblClick(self):
     88         if self.standingData.GetOwnerID1() == session.charid and self.standingData.IsRightToLeft():
     89             OpenStandingsPanelOnOwnerByID(self.standingData.GetOwnerID2())
     90 
     91 
     92 class StandingsEntryTwoWay(StandingsEntry):
     93     default_name = 'StandingsEntryTwoWay'
     94 
     95     def ApplyAttributes(self, attributes):
     96         super(StandingsEntryTwoWay, self).ApplyAttributes(attributes)
     97         self.isEvenRow = attributes.isEvenRow
     98         self.leftCont = Container(name='leftCont', parent=self, align=uiconst.TOLEFT_PROP, width=0.5, padRight=10)
     99         self.rightCont = Container(name='rightCont', parent=self, padLeft=10)
    100         self.ConstructLeftCont()
    101         self.ConstructRightCont()
    102         GradientThemeColored(bgParent=self, alphaData=((0.0, 0.0), (0.5, 0.5), (1.0, 0.0)), colorType=uiconst.COLORTYPE_UIBASECONTRAST, rotation=0)
    103 
    104     def ConstructLeftCont(self):
    105         self._ConstructContentHalf(self.leftCont, uiconst.CENTERRIGHT, isRightToLeft=False)
    106 
    107     def _ConstructContentHalf(self, parent, align, isRightToLeft, showBGArrows = True):
    108         standingCont = StandingLabel(parent=parent, align=align, standingData=self.standingData, isRightToLeft=isRightToLeft)
    109         standingCont.OnMouseEnter = self.OnMouseEnter
    110         standingCont.OnMouseExit = self.OnMouseExit
    111         if showBGArrows:
    112             align = uiconst.CENTERLEFT if isRightToLeft else uiconst.CENTERRIGHT
    113             rotation = math.pi if isRightToLeft else 0.0
    114             SpriteThemeColored(parent=parent, align=align, state=uiconst.UI_DISABLED, texturePath='res:/UI/Texture/Classes/Standings/arrowsBG.png', pos=(1, 0, 103, 22), opacity=GetBGOpacity(self.isEvenRow), rotation=rotation)
    115 
    116     def ConstructRightCont(self):
    117         cont = Container(parent=self.rightCont, padLeft=30, clipChildren=True)
    118         OwnerIconAndLabel(parent=cont, ownerID=self.standingData.ownerID2, align=uiconst.CENTERRIGHT, iconSize=28, height=28, iconAlign=uiconst.TORIGHT)
    119         self._ConstructContentHalf(self.rightCont, uiconst.CENTERLEFT, isRightToLeft=True)