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

radialMenuUtils.py (2987B)


      1 #Embedded file name: C:\BuildAgent\work\20d73f1b24eed06e\eve\release\V24.01\eve\client\script\ui\shared\radialMenu\radialMenuUtils.py
      2 import utillib
      3 
      4 class SimpleRadialMenuAction(utillib.KeyVal):
      5 
      6     def __init__(self, option1 = None, option2 = None, *args, **kw):
      7         self.option1Path = option1
      8         self.option2Path = option2
      9         self.activeOption = option1
     10         self.func = None
     11         self.funcArgs = ()
     12         for attrname, val in kw.iteritems():
     13             setattr(self, attrname, val)
     14 
     15 
     16 class RangeRadialMenuAction(utillib.KeyVal):
     17 
     18     def __init__(self, optionPath = None, optionPath2 = None, rangeList = None, defaultRange = None, callback = None, *args, **kw):
     19         self.option1Path = optionPath
     20         self.option2Path = optionPath2
     21         self.activeOption = optionPath
     22         self.rangeList = rangeList
     23         self.defaultRange = defaultRange
     24         self.callback = callback
     25         for attrname, val in kw.iteritems():
     26             setattr(self, attrname, val)
     27 
     28 
     29 class SecondLevelRadialMenuAction(utillib.KeyVal):
     30 
     31     def __init__(self, levelType = '', texturePath = 'res:/UI/Texture/classes/RadialMenu/plus.png', *args, **kw):
     32         self.option1Path = ''
     33         self.activeOption = ''
     34         self.levelType = levelType
     35         self.texturePath = texturePath
     36         for attrname, val in kw.iteritems():
     37             setattr(self, attrname, val)
     38 
     39 
     40 class RadialMenuOptionsInfo:
     41 
     42     def __init__(self, allWantedMenuOptions, activeSingleOptions = None, inactiveSingleOptions = None, activeRangeOptions = None, inactiveRangeOptions = None):
     43         self.allWantedMenuOptions = allWantedMenuOptions
     44         self.activeSingleOptions = activeSingleOptions or {}
     45         self.inactiveSingleOptions = inactiveSingleOptions or set()
     46         self.activeRangeOptions = activeRangeOptions or {}
     47         self.inactiveRangeOptions = inactiveRangeOptions or set()
     48 
     49 
     50 def FindOptionsDegree(counter, degreeStep, startingDegree = 0, alternate = False):
     51     if counter == 0:
     52         return startingDegree
     53     if alternate:
     54         rightSide = counter % 2
     55         numOnSide = counter / 2
     56         if rightSide:
     57             numOnSide += 1
     58         degree = numOnSide * degreeStep
     59         if not rightSide:
     60             degree = -degree + 360
     61     else:
     62         degree = counter * degreeStep
     63     degree = startingDegree + degree
     64     if degree >= 360:
     65         degree -= 360
     66     return degree
     67 
     68 
     69 class RadialMenuSizeInfo:
     70 
     71     def __init__(self, width, height, shadowSize, rangeSize, sliceCount, buttonHeight, buttonWidth, buttonPaddingTop, buttonPaddingBottom, actionDistance):
     72         self.width = width
     73         self.height = height
     74         self.shadowSize = shadowSize
     75         self.rangeSize = rangeSize
     76         self.sliceCount = sliceCount
     77         self.buttonHeight = buttonHeight
     78         self.buttonWidth = buttonWidth
     79         self.buttonPaddingTop = buttonPaddingTop
     80         self.buttonPaddingBottom = buttonPaddingBottom
     81         self.actionDistance = actionDistance