linkWithShipController.py (1412B)
1 #Embedded file name: C:\BuildAgent\work\20d73f1b24eed06e\eve\release\V24.01\eve\client\script\spacecomponents\linkWithShipController.py 2 from eve.client.script.spacecomponents.countercontroller import BaseCounterController 3 from spacecomponents.client.messages import MSG_ON_LINKWITHSHIP_TIMER_UPDATED 4 from spacecomponents.common.componentConst import LINK_WITH_SHIP 5 import blue 6 import logging 7 from spacecomponents.common.components.linkWithShip import LINKSTATE_RUNNING 8 logger = logging.getLogger(__name__) 9 LINK_TIMER_COLOR = (0.19, 0.7, 9.0, 1.0) 10 11 class LinkWithShipCounterController(BaseCounterController): 12 __componentClass__ = LINK_WITH_SHIP 13 __counterColor__ = LINK_TIMER_COLOR 14 __counterLabel__ = 'UI/Inflight/SpaceComponents/LinkWithShip/TimerLabel' 15 __timerFunc__ = blue.os.GetSimTime 16 __countsDown__ = False 17 18 def __init__(self, *args): 19 BaseCounterController.__init__(self, *args) 20 self.componentRegistry.SubscribeToItemMessage(self.itemID, MSG_ON_LINKWITHSHIP_TIMER_UPDATED, self.UpdateTimerState) 21 22 def UpdateTimerState(self, instance, slimItem): 23 if slimItem.component_linkWithShip is None: 24 return 25 if instance.linkState == LINKSTATE_RUNNING: 26 if self.timer is None: 27 self.AddTimer(instance.linkCompleteAtTime, instance.attributes.linkDuration) 28 elif self.timer is not None: 29 self.RemoveTimer()