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

skillLevel.py (4689B)


      1 #Embedded file name: C:\BuildAgent\work\20d73f1b24eed06e\eve\release\V24.01\eve\client\script\ui\control\skillBar\skillLevel.py
      2 import carbonui.const as uiconst
      3 from carbonui.primitives.fill import Fill
      4 from carbonui.primitives.container import Container
      5 from carbonui.primitives.sprite import Sprite
      6 from carbonui.uianimations import animations
      7 from carbonui.util.color import Color
      8 import clonegrade
      9 from eve.client.script.ui.shared.neocom.skillConst import COLOR_SKILL_1
     10 import uthread
     11 BOX_SIZE = 10
     12 BOX_SIZE_SMALL = 4
     13 COLOR_NOT_REQUIRED = (0, 0, 0, 0.9)
     14 COLOR_UNTRAINED = (1.0, 1.0, 1.0, 0.3)
     15 COLOR_TRAINED = (0.8, 0.8, 0.8, 1.0)
     16 COLOR_TRAINED_OMEGA = Color(*clonegrade.COLOR_OMEGA_ORANGE).SetAlpha(0.8).GetRGBA()
     17 COLOR_REQUIRES_OMEGA = Color(*clonegrade.COLOR_OMEGA_ORANGE).SetAlpha(0.6).GetRGBA()
     18 COLOR_QUEUED = COLOR_SKILL_1
     19 
     20 class SkillLevel(Container):
     21     default_width = 12
     22     default_height = 12
     23     default_state = uiconst.UI_DISABLED
     24 
     25     def ApplyAttributes(self, attributes):
     26         super(SkillLevel, self).ApplyAttributes(attributes)
     27         self.skill = attributes.get('controller')
     28         self.level = attributes.get('level')
     29         self.boxSize = attributes.get('boxSize', BOX_SIZE)
     30         self.showEmpty = attributes.get('showEmpty', False)
     31         self.Layout()
     32         self.skill.onUpdate.connect(self.Refresh)
     33 
     34     def Refresh(self):
     35         self.Flush()
     36         self.Layout()
     37 
     38     def Layout(self):
     39         import expertSystems.client
     40         if self.skill.requiredLevel and not self.isRequired:
     41             if self.showEmpty:
     42                 self.AddBox((0, 0, 0, 0.9))
     43             return
     44         if self.skill.IsLevelTrainedByExpertSystem(self.level) and expertSystems.is_expert_systems_enabled():
     45             Container(parent=self, name='expertSystemUnderline', align=uiconst.TOBOTTOM_NOPUSH, bgColor=expertSystems.Color.base, height=2, top=-2, padding=(1, 0, 1, 0))
     46         if self.isTraining:
     47             self.AddInTraining(COLOR_TRAINED)
     48         elif self.isTrained:
     49             if self.isOmega and self.isRestricted:
     50                 self.AddBox(COLOR_TRAINED_OMEGA)
     51             else:
     52                 self.AddBox(COLOR_TRAINED)
     53         elif self.isTrainable:
     54             if self.isQueued:
     55                 self.AddBox(COLOR_QUEUED)
     56             else:
     57                 self.AddBox(COLOR_UNTRAINED)
     58             if self.isPartiallyTrained:
     59                 self.AddPartiallyTrained(COLOR_TRAINED)
     60         elif self.isOmega and self.isRestricted:
     61             self.AddBoxSmall(COLOR_REQUIRES_OMEGA)
     62         else:
     63             self.AddBoxSmall(COLOR_UNTRAINED)
     64 
     65     def AddInTraining(self, color):
     66         box = self.AddBox(color)
     67 
     68         def thread():
     69             while not box.destroyed:
     70                 animations.SpColorMorphTo(box, startColor=COLOR_QUEUED, endColor=color, duration=0.4, timeOffset=0.5, sleep=True)
     71                 animations.SpColorMorphTo(box, startColor=color, endColor=COLOR_QUEUED, duration=0.8, timeOffset=0.2, sleep=True)
     72 
     73         uthread.new(thread)
     74 
     75     def AddBox(self, color):
     76         return Fill(parent=self, align=uiconst.CENTER, pos=(0,
     77          0,
     78          self.boxSize,
     79          self.boxSize), color=color)
     80 
     81     def AddBoxSmall(self, color):
     82         Fill(parent=self, align=uiconst.CENTER, pos=(0,
     83          0,
     84          BOX_SIZE_SMALL,
     85          BOX_SIZE_SMALL), color=color, idx=0)
     86 
     87     def AddOmegaLocked(self):
     88         Sprite(parent=self, align=uiconst.CENTER, state=uiconst.UI_DISABLED, texturePath='res:/UI/Texture/classes/SkillBar/OmegaLocked.png', color=COLOR_TRAINED_OMEGA, pos=(0, 0, 12, 12))
     89 
     90     def AddPartiallyTrained(self, color):
     91         Sprite(parent=self, align=uiconst.CENTER, state=uiconst.UI_DISABLED, texturePath='res:/UI/Texture/classes/SkillBar/PartiallyTrained.png', color=color, pos=(0,
     92          0,
     93          self.boxSize + 2,
     94          self.boxSize + 2), idx=0)
     95 
     96     @property
     97     def isTrained(self):
     98         return self.level <= self.skill.level
     99 
    100     @property
    101     def isTrainable(self):
    102         return self.skill.IsLevelTrainable(self.level)
    103 
    104     @property
    105     def isQueued(self):
    106         return self.skill.IsLevelQueued(self.level)
    107 
    108     @property
    109     def isTraining(self):
    110         return self.skill.IsLevelTraining(self.level)
    111 
    112     @property
    113     def isPartiallyTrained(self):
    114         return self.level == self.skill.level + 1 and self.skill.isPartiallyTrained
    115 
    116     @property
    117     def isRequired(self):
    118         if self.skill.requiredLevel is None:
    119             return False
    120         return self.level <= self.skill.requiredLevel
    121 
    122     @property
    123     def isRestricted(self):
    124         return self.skill.isRestricted
    125 
    126     @property
    127     def isOmega(self):
    128         return self.skill.restrictedLevel < self.level