characterSelectionUtils.py (2751B)
1 #Embedded file name: C:\BuildAgent\work\20d73f1b24eed06e\eve\release\V24.01\eve\client\script\ui\login\charSelection\characterSelectionUtils.py 2 import localization 3 import trinity 4 import eve.client.script.ui.login.charSelection.characterSelectionColors as csColors 5 from carbonui.primitives.fill import Fill 6 from carbonui.primitives.frame import Frame 7 from carbonui.uicore import uicore 8 from carbonui.util.color import Color 9 from caching.memoize import Memoize 10 from eve.common.lib import appConst as const 11 WARNING_TIME = 5 * const.DAY 12 COLLAPSE_TIME = 0.3 13 FADE_ANIMATION_TIME = 0.3 14 15 def AddFrameWithFillAndGlow(parent, showFill = True, fillColor = None, frameColor = None, glowColor = csColors.FRAME_GLOW_ACTIVE): 16 if showFill: 17 fillColor = fillColor if fillColor else (0.5, 0.5, 0.5, 0.5) 18 fill = Fill(bgParent=parent, color=fillColor) 19 else: 20 fill = None 21 frameColor = frameColor if frameColor else (0.5, 0.5, 0.5, 0.5) 22 normalFrame = Frame(parent=parent, color=frameColor) 23 glowFrameTexturePath = 'res:/UI/Texture/classes/CharacterSelection/glowDotFrame.png' 24 glowFrame = Frame(parent=parent, name='glowFrame', color=glowColor, frameConst=(glowFrameTexturePath, 25 5, 26 -2, 27 0), padding=0) 28 return (glowFrame, normalFrame, fill) 29 30 31 def SetColor(uiComponent, newColor, animate = False): 32 if animate: 33 uicore.animations.SpColorMorphTo(uiComponent, startColor=uiComponent.GetRGBA(), endColor=newColor, duration=FADE_ANIMATION_TIME) 34 else: 35 uiComponent.SetRGBA(*newColor) 36 37 38 def MakeTransparent(uiComponent, animate = False): 39 if animate: 40 uicore.animations.MorphScalar(uiComponent, 'opacity', startVal=uiComponent.opacity, endVal=0.0, duration=FADE_ANIMATION_TIME) 41 else: 42 uiComponent.opacity = 0 43 44 45 def SetEffectOpacity(uiComponent, newOpacity, animate = False): 46 if animate: 47 uicore.animations.MorphScalar(uiComponent, 'effectOpacity', startVal=uiComponent.effectOpacity, endVal=newOpacity, duration=FADE_ANIMATION_TIME) 48 else: 49 uiComponent.effectOpacity = newOpacity 50 51 52 def SetSaturation(uiComponent, newSaturation, animate = False): 53 if animate: 54 uicore.animations.MorphScalar(uiComponent, 'saturation', startVal=uiComponent.saturation, endVal=newSaturation, duration=FADE_ANIMATION_TIME) 55 else: 56 uiComponent.saturation = newSaturation 57 58 59 def SetMonochromeStyle(uiComponent, animate = False): 60 SetColor(uiComponent, Color.GRAY5, animate) 61 SetSaturation(uiComponent, 0.0, animate) 62 uiComponent.spriteEffect = trinity.TR2_SFX_SOFTLIGHT 63 64 65 @Memoize(5) 66 def IsMonochromeStyleEnabled(): 67 if not localization.util.AmOnChineseServer(): 68 return False 69 return sm.RemoteSvc('kiringMgr').IsMonochromeStyleEnabled()