reinforcecontroller.py (1629B)
1 #Embedded file name: C:\BuildAgent\work\20d73f1b24eed06e\eve\release\V24.01\eve\client\script\spacecomponents\reinforcecontroller.py 2 from eve.client.script.spacecomponents.countercontroller import BaseCounterController 3 from spacecomponents.client.messages import MSG_ON_REINFORCE_TIMER_UPDATED 4 from spacecomponents.common.componentConst import REINFORCE_CLASS 5 import blue 6 import logging 7 logger = logging.getLogger(__name__) 8 REINFORCE_TIMER_COLOR = (1.0, 0.2, 0.3, 1.0) 9 10 class ReinforceCounterController(BaseCounterController): 11 __componentClass__ = REINFORCE_CLASS 12 __counterColor__ = REINFORCE_TIMER_COLOR 13 __counterLabel__ = 'UI/Inflight/SpaceComponents/Reinforce/TimerLabel' 14 __timerFunc__ = blue.os.GetWallclockTime 15 __countsDown__ = True 16 __soundInitialEvent__ = 'counter_reinforced_play' 17 __soundFinishedEvent__ = 'bounty_open_play' 18 19 def __init__(self, *args): 20 BaseCounterController.__init__(self, *args) 21 self.componentRegistry.SubscribeToItemMessage(self.itemID, MSG_ON_REINFORCE_TIMER_UPDATED, self.UpdateTimerState) 22 23 def UpdateTimerState(self, instance, slimItem): 24 if slimItem.component_reinforce is not None: 25 if not instance.isReinforced: 26 if self.timer is not None: 27 logger.debug('%s Removing timer for %s', self.__class__.__name__, slimItem.itemID) 28 self.RemoveTimer() 29 elif self.timer is None: 30 logger.debug('%s Adding timer for %s', self.__class__.__name__, slimItem.itemID) 31 self.AddTimer(instance.reinforceTimestamp, instance.attributes.durationSeconds)