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

infoPanelESS.py (34046B)


      1 #Embedded file name: C:\BuildAgent\work\20d73f1b24eed06e\eve\release\V24.01\eve\client\script\ui\shared\infoPanels\essUI\infoPanelESS.py
      2 import blue
      3 import eveformat
      4 import localization
      5 import locks
      6 import uthread2
      7 from carbon.common.lib.const import SEC
      8 from carbon.common.script.util.timerstuff import AutoTimer
      9 from carbonui import uiconst
     10 from carbonui.primitives.container import Container
     11 from carbonui.primitives.containerAutoSize import ContainerAutoSize
     12 from carbonui.primitives.sprite import Sprite
     13 from carbonui.primitives.transform import Transform
     14 from carbonui.uianimations import animations
     15 from carbonui.uicore import uicore
     16 from carbonui.util.color import Color
     17 from dynamicresources.client.ess.bracket.notification import TransitionNotification, COLOR_WARN, ICON_WARN
     18 from dynamicresources.client.ui.ess_info_panel_ui_const import RESERVE_BANK_AUTOPAYOUT_BAR_COLOR, MAIN_BANK_ACTIVE_BAR_COLOR, TRANSITION_LOCK
     19 from dynamicresources.client.ui.main_bank_hacking_timer import MainBankHackingTimer
     20 from dynamicresources.client.ui.reserve_bank_hacking_widget import ReserveBankHackingWidget
     21 from carbonui.control.buttonIcon import ButtonIcon
     22 from eve.client.script.ui.control.statefulButton import StatefulButton
     23 from eve.client.script.ui.control.eveLabel import EveLabelLarge, EveCaptionLarge, EveCaptionSmall
     24 from eve.client.script.ui.control.gaugeCircular import GaugeCircular
     25 from eve.client.script.ui.shared.dynamicResource.warpToEssStatefulButtonController import WarpToEssButtonController
     26 from eve.client.script.ui.shared.infoPanels.InfoPanelBase import InfoPanelBase
     27 from eve.client.script.ui.shared.infoPanels.const import infoPanelConst
     28 from eve.client.script.ui.shared.infoPanels.essUI.controller import InfoPanelESSStateController, MAIN_BANK_HACKING, RESERVE_BANK_UNLOCKED, MAIN_BANK_IDLE, RESERVE_BANK_LOCKED
     29 from evelink.link import Link
     30 from gametime import GetSimTime
     31 from globalConfig import GetESSFeatureFlaggedOffline
     32 from localization.formatters import FormatTimeIntervalShort
     33 from uthread2 import StartTasklet
     34 
     35 class InfoPanelESS(InfoPanelBase):
     36     default_name = 'InfoPanelESS'
     37     panelTypeID = infoPanelConst.PANEL_ESS
     38     label = 'UI/ESS/infoPanelESSTitle'
     39     default_iconTexturePath = 'res:/ui/Texture/classes/ess/Icon_ESS_24px.png'
     40     default_isModeFixed = False
     41     hasSettings = False
     42     __notifyevents__ = InfoPanelBase.__notifyevents__ + ['OnESSDataUpdate_Local', 'OnMainBankPlayerLinkDisconnected', 'OnMainBankPlayerHackSuccess']
     43 
     44     @staticmethod
     45     def IsAvailable():
     46         if GetESSFeatureFlaggedOffline(sm.GetService('machoNet')):
     47             return False
     48         if sm.GetService('dynamicResourceSvc').GetESSDataForCurrentSystem() is None:
     49             return False
     50         return True
     51 
     52     def ApplyAttributes(self, attributes):
     53         super(InfoPanelESS, self).ApplyAttributes(attributes)
     54         self.titleCaption = EveCaptionSmall(parent=self.headerCont, text=localization.GetByLabel('UI/ESS/infoPanelESSTitle'), align=uiconst.CENTERLEFT, state=uiconst.UI_NORMAL)
     55         self.bodyCont = ContainerAutoSize(name='bodyCont', align=uiconst.TOTOP, parent=self.mainCont)
     56         self.mainBankState = None
     57         self.reserveBankState = None
     58         self.updateIdleMainBankTimer = None
     59         self.updateMainBankHackingGaugeTimer = None
     60         self.updateMainBankHackingLabelTimer = None
     61         self.updateReserveBankHackingStateTimer = None
     62         self.mainBankDelayedPayoutTimerGauge = None
     63         self.updateIdleMainBankLabelsTimer = None
     64         self.collapsedStateMainBankIdleGaugeAutoTimer = None
     65         self.collapsedStateMainBankHackingTimer = None
     66         self.collapsedStateReserveBankHackingTimer = None
     67         self.mainBankHackTimerGauge = None
     68         self.mainBankAutopaymentProgressBar = None
     69         self.reserveBankHackingGauge = None
     70         self.collapsedStateCont = None
     71         self.state_controller = InfoPanelESSStateController()
     72         StartTasklet(self.TransitionState)
     73 
     74     def ConstructHeaderButton(self):
     75         btn = ButtonIcon(parent=self.headerBtnCont, align=uiconst.TOPRIGHT, pos=(0,
     76          0,
     77          self.topCont.height,
     78          self.topCont.height), texturePath=self.default_iconTexturePath, iconSize=18, showIcon=True, func=uicore.cmd.OpenEncounterSurveillanceSystemInAgency)
     79         btn.hint = localization.GetByLabel('UI/ESS/LinkToAgencyTooltip')
     80 
     81     def ConstructHiddenCollpsedState(self):
     82         if self.collapsedStateCont:
     83             self.collapsedStateCont.Flush()
     84         else:
     85             self.collapsedStateCont = ContainerAutoSize(parent=self.headerCont, align=uiconst.TOLEFT)
     86         mainBankState = self.state_controller.GetEnumeratedMainBankState()
     87         reserveBankState = self.state_controller.GetEnumeratedReserveBankState()
     88         if mainBankState == MAIN_BANK_IDLE:
     89             self.collapsedStateMainBankIdleGauge = GaugeCircular(parent=self.collapsedStateCont, align=uiconst.TOLEFT, showMarker=False, colorStart=Color.WHITE, colorEnd=Color.WHITE, colorBg=Color(*Color.WHITE).SetAlpha(0.2).GetRGBA(), radius=12, state=uiconst.UI_DISABLED, top=2)
     90             self.UpdateMainBankAutopaymentGauge(None, self.collapsedStateMainBankIdleGauge, animate=False)
     91             self.collapsedStateMainBankIdleGaugeAutoTimer = AutoTimer(500, self.UpdateMainBankAutopaymentGauge, self.collapsedStateMainBankIdleGaugeAutoTimer, self.collapsedStateMainBankIdleGauge, animate=False)
     92         elif mainBankState == MAIN_BANK_HACKING:
     93             self.collapsedStateMainBankhackingGauge = GaugeCircular(parent=self.collapsedStateCont, align=uiconst.TOLEFT, showMarker=False, colorStart=MAIN_BANK_ACTIVE_BAR_COLOR, colorEnd=MAIN_BANK_ACTIVE_BAR_COLOR, colorBg=Color(*Color.WHITE).SetAlpha(0.2).GetRGBA(), radius=12, state=uiconst.UI_DISABLED, top=2)
     94             self.UpdateMainBankHackingTimerGauge(None, self.collapsedStateMainBankhackingGauge)
     95             self.collapsedStateMainBankHackingTimer = AutoTimer(500, self.UpdateMainBankHackingTimerGauge, self.collapsedStateMainBankHackingTimer, self.collapsedStateMainBankhackingGauge)
     96         if reserveBankState == RESERVE_BANK_UNLOCKED:
     97             reserveBankGauge = GaugeCircular(parent=self.collapsedStateCont, align=uiconst.TOLEFT, showMarker=False, colorStart=RESERVE_BANK_AUTOPAYOUT_BAR_COLOR, colorEnd=RESERVE_BANK_AUTOPAYOUT_BAR_COLOR, colorBg=Color(*Color.WHITE).SetAlpha(0.2).GetRGBA(), radius=12, state=uiconst.UI_DISABLED, padLeft=10, top=2)
     98 
     99             def update_simple_reserve_bank_gauge(thisTimer, gauge):
    100                 if self.destroyed:
    101                     thisTimer = None
    102                     return
    103                 pulsesRemaining = self.state_controller.Get('reserveBankPulsesRemaining')
    104                 pulsesTotal = self.state_controller.Get('reserveBankPulsesTotal')
    105                 newGaugeValue = float(pulsesRemaining) / float(pulsesTotal)
    106                 gauge.SetValue(newGaugeValue, animate=False)
    107 
    108             update_simple_reserve_bank_gauge(None, reserveBankGauge)
    109             self.collapsedStateReserveBankHackingTimer = AutoTimer(500, update_simple_reserve_bank_gauge, self.collapsedStateReserveBankHackingTimer, reserveBankGauge)
    110         if self.mode != infoPanelConst.MODE_COMPACT:
    111             self.collapsedStateCont.Hide()
    112 
    113     def ConstructCompact(self):
    114         if self.titleCaption:
    115             self.titleCaption.Hide()
    116         if self.collapsedStateCont:
    117             self.collapsedStateCont.Show()
    118 
    119     def ConstructNormal(self):
    120         if self.titleCaption:
    121             self.titleCaption.Show()
    122         if self.collapsedStateCont:
    123             self.collapsedStateCont.Hide()
    124 
    125     def TransitionState(self, newMainBankState = None, newReserveBankState = None, linkDisconnected = False, hackSuccess = False, thisClient = False):
    126         with locks.TempLock('TransitionState'):
    127             if not self.state_controller.RefreshEssData():
    128                 return
    129             if newMainBankState is None:
    130                 newMainBankState = self.state_controller.GetEnumeratedMainBankState()
    131             if newReserveBankState is None:
    132                 newReserveBankState = self.state_controller.GetEnumeratedReserveBankState()
    133             animateMainBankChange = False
    134             animateReserveBankChange = False
    135             if self.mainBankState:
    136                 if self.mainBankState != newMainBankState:
    137                     animateMainBankChange = True
    138                     if self.mainBankState == MAIN_BANK_IDLE and newMainBankState == MAIN_BANK_HACKING:
    139                         animations.FadeOut(self.mainBankIdleIskSymbolTransform, duration=0.25)
    140                         animations.FadeOut(self.mainBankAutopaymentProgressBar, duration=0.25)
    141                         animations.FadeOut(self.mainBankAutupaymentTimerTextCont, duration=0.25)
    142                         animations.MoveOutRight(self.mainBankAutupaymentTimerTextCont, amount=10, duration=0.25, sleep=True)
    143                         link_state = self.state_controller.GetMainBankLinkState()
    144                         if not link_state['this_client']:
    145                             notificationBox = TransitionNotification(self.mainBankIdleTimerCont, uiconst.TOPLEFT, text=localization.GetByLabel('UI/ESS/MainBankOtherPlayerHacking'), iconHexColor=COLOR_WARN, icon=ICON_WARN)
    146                             notificationBox.show(sleep=True)
    147                             uthread2.sleep(1)
    148                             notificationBox.hide(close=True, sleep=True)
    149                     elif self.mainBankState == MAIN_BANK_HACKING and newMainBankState == MAIN_BANK_IDLE:
    150                         animations.FadeOut(self.mainBankHackingLabelsCont, duration=0.25)
    151                         animations.MoveOutLeft(self.mainBankHackingLabelsCont, amount=10, duration=0.25)
    152                         if self.mainBankHackTimerGauge:
    153                             self.mainBankHackTimerGauge.AnimateOut()
    154                         if self.mainBankDelayedPayoutTimerGauge:
    155                             animations.FadeOut(self.mainBankDelayedPayoutLockSymbol)
    156                             animations.FadeOut(self.mainBankDelayedPayoutTimerGauge, sleep=True)
    157                         if not thisClient:
    158                             alertText = None
    159                             if linkDisconnected:
    160                                 alertText = localization.GetByLabel('UI/ESS/MainBankLinkDisconnected')
    161                             elif hackSuccess:
    162                                 alertText = localization.GetByLabel('UI/ESS/MainBankHackingSuccess')
    163                             notificationBox = TransitionNotification(self.mainBankHackingCont, uiconst.TOPLEFT, text=alertText, iconHexColor=COLOR_WARN, icon=ICON_WARN)
    164                             notificationBox.show(sleep=True)
    165                             uthread2.sleep(1)
    166                             notificationBox.hide(close=True, sleep=True)
    167                         self.mainBankHackTimerGauge = None
    168             if self.reserveBankState:
    169                 if self.reserveBankState != newReserveBankState:
    170                     animateReserveBankChange = True
    171                     if self.reserveBankState == RESERVE_BANK_UNLOCKED and newReserveBankState == RESERVE_BANK_LOCKED:
    172                         animations.FadeOut(self.reserveBankHackingTimerLabelsCont, duration=0.25)
    173                         animations.MoveOutLeft(self.reserveBankHackingTimerLabelsCont, amount=0.05, duration=0.25)
    174                         self.reserveBankHackingGauge.AnimateOut()
    175             self.mainBankState = newMainBankState
    176             self.reserveBankState = newReserveBankState
    177             self.ConstructHiddenCollpsedState()
    178             self.ConstructUncollapsedState(animateMainBankChange, animateReserveBankChange)
    179 
    180     def ConstructUncollapsedState(self, animateMainBankChange, animateReserveBankChange):
    181         with locks.TempLock(TRANSITION_LOCK):
    182             gaugeStates = {'mainBankHackGaugeStartValue': None,
    183              'reserveBankHackGaugeStartValue': None,
    184              'reserveBankNextPayoutTimerValue': None,
    185              'mainBankIdleTimerStartValue': None,
    186              'mainBankDelayedAutopayGaugeValue': None}
    187             if self.mainBankAutopaymentProgressBar:
    188                 gaugeStates['mainBankIdleTimerStartValue'] = self.mainBankAutopaymentProgressBar.value
    189             if self.mainBankHackTimerGauge:
    190                 gaugeStates['mainBankHackGaugeStartValue'] = self.mainBankHackTimerGauge.value
    191             if self.reserveBankHackingGauge:
    192                 gaugeStates['reserveBankHackGaugeStartValue'] = self.reserveBankHackingGauge.value
    193                 gaugeStates['reserveBankNextPayoutTimerValue'] = self.reserveBankHackingGauge.nextPayoutTimerValue
    194             if self.mainBankDelayedPayoutTimerGauge:
    195                 gaugeStates['mainBankDelayedAutopayGaugeValue'] = self.mainBankDelayedPayoutTimerGauge.value
    196             self.bodyCont.Flush()
    197             if self.updateIdleMainBankTimer:
    198                 self.updateIdleMainBankTimer.KillTimer()
    199                 self.updateIdleMainBankTimer = None
    200             if self.updateMainBankHackingGaugeTimer:
    201                 self.updateMainBankHackingGaugeTimer.KillTimer()
    202                 self.updateMainBankHackingGaugeTimer = None
    203             if self.updateReserveBankHackingStateTimer:
    204                 self.updateReserveBankHackingStateTimer.KillTimer()
    205                 self.updateReserveBankHackingStateTimer = None
    206             if self.updateMainBankHackingLabelTimer:
    207                 self.updateMainBankHackingLabelTimer.KillTimer()
    208                 self.updateMainBankHackingLabelTimer = None
    209             self.ConstructMainBankInfo(gaugeStates, animateMainBankChange)
    210             self.ConstructReserveBankInfo(gaugeStates, animateReserveBankChange)
    211             if self.mainBankState == MAIN_BANK_HACKING or self.reserveBankState == RESERVE_BANK_UNLOCKED:
    212                 warpToButtonCont = ContainerAutoSize(parent=self.bodyCont, align=uiconst.TOTOP)
    213                 StatefulButton(name='warpToEssButton', parent=warpToButtonCont, align=uiconst.TOPLEFT, controller=WarpToEssButtonController(), top=15)
    214 
    215     def ConstructReserveBankInfo(self, gaugeStates, animate):
    216         if self.state_controller.GetEssData() is not None:
    217             self.reserveBankCont = ContainerAutoSize(name='reserveBankCont', parent=self.bodyCont, align=uiconst.TOTOP, alignMode=uiconst.TOTOP, padTop=15)
    218             reserveBankLinkText = localization.GetByLabel('UI/ESS/infoPanelReserveBank', iskString=eveformat.isk_readable_short(self.state_controller.Get('reserveValue', 0.0)))
    219             reserveBankLink = Link(url='essTransactionHistory:reserveBank', text=reserveBankLinkText, alt=localization.GetByLabel('UI/ESS/TransactionHistoryHint'))
    220             reserveBankLinkCont = ContainerAutoSize(parent=self.reserveBankCont, align=uiconst.TOTOP, name='reserveBankLinkCont')
    221             EveLabelLarge(parent=reserveBankLinkCont, text=reserveBankLink, align=uiconst.TOPLEFT, state=uiconst.UI_NORMAL, linkStyle=uiconst.LINKSTYLE_SUBTLE)
    222             pulsesRemaining = self.state_controller.Get('reserveBankPulsesRemaining')
    223             pulsesTotal = self.state_controller.Get('reserveBankPulsesTotal')
    224             if pulsesRemaining > 0 and pulsesTotal > 0:
    225                 self.ConstructReserveBankUnlockedState(animate, gaugeStates)
    226             else:
    227                 self.ConstructReserveBankLockedState(animate)
    228                 if self.reserveBankHackingGauge:
    229                     self.reserveBankHackingGauge = None
    230 
    231     def ConstructReserveBankLockedState(self, animate):
    232         startingOpacity = 0 if animate else 1
    233         lockedGaugeCont = Container(name='lockedGaugeCont', parent=self.reserveBankCont, align=uiconst.TOTOP, alignMode=uiconst.TOPLEFT, padTop=13, height=50, state=uiconst.UI_DISABLED, opacity=startingOpacity)
    234         GaugeCircular(parent=lockedGaugeCont, color=Color.WHITE, align=uiconst.TOLEFT, showMarker=False, lineWidth=3, radius=22, colorStart=Color.WHITE, colorEnd=Color.WHITE, colorBg=Color(*Color.WHITE).SetAlpha(0.2).GetRGBA())
    235         lockSymbolTransform = Transform(parent=lockedGaugeCont, align=uiconst.TOPLEFT, width=44, height=44)
    236         lockSymbolSprite = Sprite(parent=lockSymbolTransform, align=uiconst.CENTER, texturePath='res:/ui/Texture/classes/ess/mainBank/lock.png', color=Color(*Color.WHITE).SetAlpha(0.8).GetRGBA(), width=25, height=25)
    237         EveLabelLarge(parent=lockedGaugeCont, align=uiconst.TOLEFT, bold=False, padLeft=15, top=11, text=localization.GetByLabel('UI/ESS/BankLocked'))
    238         lockSymbolSprite.scalingCenter = (0.5, 0.5)
    239         if animate:
    240             animations.FadeIn(lockedGaugeCont, duration=0.25)
    241 
    242     def ConstructReserveBankUnlockedState(self, animate, gaugeStates):
    243         pulsesRemaining = self.state_controller.Get('reserveBankPulsesRemaining')
    244         pulsesTotal = self.state_controller.Get('reserveBankPulsesTotal')
    245         lastPulseInitiated = self.state_controller.Get('reserveBankLastPulseInitiated')
    246         activeLinks = self.state_controller.Get('reserveBankActiveLinks')
    247         currentSimTime = blue.os.GetSimTime()
    248         pulseInterval = self.state_controller.GetSetting('reservePulseIntervalSeconds') * SEC
    249         hackInfoCont = Container(parent=self.reserveBankCont, align=uiconst.TOTOP, height=150)
    250         initialValue = float(pulsesRemaining) / float(pulsesTotal)
    251         payoutValues = self.state_controller.CalculateReserveBankPayouts()
    252         self.reserveBankHackingGauge = ReserveBankHackingWidget(parent=hackInfoCont, name='reserveBankHackingWidget', align=uiconst.TOLEFT, pulsesTotal=pulsesTotal, progress=initialValue, linked=activeLinks, paymentValues=payoutValues, onMouseEnterCallback=self._OnReserveBankHackingWidgetMouseEnter, onMouseExitCallback=self._OnReserveBankHackingWidgetMouseExit, animateIn=animate)
    253         gaugeValue = float(pulsesRemaining) / float(pulsesTotal)
    254         self.reserveBankHackingGauge.SetValue(gaugeValue)
    255         if gaugeStates['reserveBankNextPayoutTimerValue']:
    256             self.reserveBankHackingGauge.SetNextPayoutTimerValue(gaugeStates['reserveBankNextPayoutTimerValue'], animate=False)
    257         self.reserveBankHackingTimerLabelsCont = Container(name='reserveBankHackingTimerLabelsCont', parent=hackInfoCont, align=uiconst.TOLEFT_PROP, width=0.5, padLeft=15)
    258         EveLabelLarge(parent=self.reserveBankHackingTimerLabelsCont, text=localization.GetByLabel('UI/ESS/ReserveBankOpenFor'), align=uiconst.TOTOP, bold=False, padTop=20)
    259         timeUntilNextPulse = pulseInterval - (currentSimTime - lastPulseInitiated)
    260         timeLeftUntilCloseText = FormatTimeIntervalShort(pulseInterval * (pulsesRemaining - 1) + timeUntilNextPulse, showFrom='minute')
    261         self.reserveBankTimeLeftLabel = EveCaptionLarge(parent=self.reserveBankHackingTimerLabelsCont, text=timeLeftUntilCloseText, align=uiconst.TOTOP, bold=False, color=RESERVE_BANK_AUTOPAYOUT_BAR_COLOR)
    262         if timeUntilNextPulse <= 0:
    263             timeUntilNextPulseText = FormatTimeIntervalShort(0, showFrom='minute')
    264         else:
    265             timeUntilNextPulseText = FormatTimeIntervalShort(timeUntilNextPulse, showFrom='minute')
    266         EveLabelLarge(parent=self.reserveBankHackingTimerLabelsCont, align=uiconst.TOTOP, bold=False, text=localization.GetByLabel('UI/ESS/MainBankNextAutopayLabel'))
    267         self.reserveBankTimeUntilNextPulseLabel = EveCaptionLarge(parent=self.reserveBankHackingTimerLabelsCont, align=uiconst.TOTOP, bold=False, text=timeUntilNextPulseText)
    268         self.reserveBankHackingOnHoverLabelsCont = Container(name='reserveBankHackingTimerLabelsCont', parent=hackInfoCont, align=uiconst.TOLEFT_PROP, width=0.5, padLeft=17, opacity=0)
    269         EveLabelLarge(parent=self.reserveBankHackingOnHoverLabelsCont, text=localization.GetByLabel('UI/ESS/ReserveBankPaymentRate'), align=uiconst.TOTOP, bold=False, padTop=20)
    270         self.reserveBankPayoutRateLabel = EveCaptionLarge(parent=self.reserveBankHackingOnHoverLabelsCont, align=uiconst.TOTOP, text=self._GetPaymentRateText(), bold=False, color=RESERVE_BANK_AUTOPAYOUT_BAR_COLOR)
    271         EveLabelLarge(parent=self.reserveBankHackingOnHoverLabelsCont, align=uiconst.TOTOP, text=localization.GetByLabel('UI/ESS/MainBankNextAutopayLabel'), bold=False)
    272         self.reserveBankNextPayoutLabel = EveCaptionLarge(parent=self.reserveBankHackingOnHoverLabelsCont, align=uiconst.TOTOP, text=eveformat.isk_readable_short(25000000), bold=False)
    273         self.updateReserveBankHackingStateTimer = AutoTimer(500, self.UpdateReserveBankState)
    274 
    275     def _GetPaymentRateText(self):
    276         earlyPayoutThresholdFactor = round(self.state_controller.GetSetting('earlyPayoutThresholdFactor'), 1)
    277         latePayoutThresholdFactor = round(self.state_controller.GetSetting('latePayoutThresholdFactor'), 1)
    278         pulsesRemaining = self.state_controller.Get('reserveBankPulsesRemaining')
    279         pulsesTotal = self.state_controller.Get('reserveBankPulsesTotal')
    280         proportionComplete = 1.0 - float(pulsesRemaining) / float(pulsesTotal)
    281         if proportionComplete < earlyPayoutThresholdFactor:
    282             return localization.GetByLabel('UI/ESS/ReserveBankEarly')
    283         elif proportionComplete >= earlyPayoutThresholdFactor and proportionComplete < 1.0 - latePayoutThresholdFactor:
    284             return localization.GetByLabel('UI/ESS/ReserveBankPeak')
    285         else:
    286             return localization.GetByLabel('UI/ESS/ReserveBankLate')
    287 
    288     def _OnReserveBankHackingWidgetMouseEnter(self):
    289 
    290         def fade_in_cont():
    291             self.reserveBankHackingTimerLabelsCont.Hide()
    292             animations.FadeIn(self.reserveBankHackingOnHoverLabelsCont, duration=0.1)
    293             animations.MoveInFromLeft(self.reserveBankHackingOnHoverLabelsCont, duration=0.1, amount=0.025)
    294 
    295         animations.FadeOut(self.reserveBankHackingTimerLabelsCont, duration=0.1, callback=fade_in_cont)
    296 
    297     def _OnReserveBankHackingWidgetMouseExit(self):
    298         animations.FadeIn(self.reserveBankHackingTimerLabelsCont, duration=0.1, callback=self.reserveBankHackingTimerLabelsCont.Show)
    299         animations.FadeOut(self.reserveBankHackingOnHoverLabelsCont, duration=0.1)
    300 
    301     def UpdateMainBankAutopaymentGauge(self, thisTimer, gauge, animate = True):
    302         if self.destroyed or not self.state_controller.GetEssData():
    303             thisTimer = None
    304             return
    305         maxVal = self.state_controller.Get('nextScheduledAutopayment', GetSimTime() + 100)
    306         minVal = self.state_controller.Get('lastAutopayment', GetSimTime())
    307         current = GetSimTime()
    308         proportion = 1.0 - float(current - minVal) / float(maxVal - minVal)
    309         proportion = max(0.0, min(proportion, 1.0))
    310         gauge.SetValue(proportion, animate=animate)
    311 
    312     def UpdateMainBankAutopaymemtLabel(self, thisTimer, label):
    313         if self.destroyed or not self.state_controller.GetEssData():
    314             thisTimer = None
    315             return
    316         maxVal = self.state_controller.Get('nextScheduledAutopayment', GetSimTime() + 100)
    317         current = GetSimTime()
    318         autopaymentCountdown = maxVal - current
    319         if autopaymentCountdown > 0:
    320             label.SetText(FormatTimeIntervalShort(autopaymentCountdown, showFrom='hour', showTo='second'))
    321         else:
    322             label.SetText(FormatTimeIntervalShort(0, showFrom='hour', showTo='second'))
    323 
    324     def UpdateReserveBankState(self):
    325         if not self.state_controller.GetEssData():
    326             self.updateReserveBankHackingStateTimer.KillTimer()
    327             self.updateReserveBankHackingStateTimer = None
    328             self.reserveBankHackingGauge = None
    329             return
    330         lastPulseInitiated = self.state_controller.Get('reserveBankLastPulseInitiated')
    331         pulsesRemaining = self.state_controller.Get('reserveBankPulsesRemaining')
    332         pulsesTotal = self.state_controller.Get('reserveBankPulsesTotal')
    333         if self.destroyed or pulsesRemaining < 1:
    334             self.updateReserveBankHackingStateTimer.KillTimer()
    335             self.updateReserveBankHackingStateTimer = None
    336             self.reserveBankHackingGauge = None
    337             return
    338         currentSimTime = blue.os.GetSimTime()
    339         pulseInterval = self.state_controller.GetSetting('reservePulseIntervalSeconds') * SEC
    340         nextPayoutIn = max(0, pulseInterval - (currentSimTime - lastPulseInitiated))
    341         timeLeft = pulseInterval * (pulsesRemaining - 1)
    342         timeLeftText = FormatTimeIntervalShort(timeLeft + nextPayoutIn, showFrom='minute')
    343         self.reserveBankTimeLeftLabel.SetText(timeLeftText)
    344         nextPayoutInText = FormatTimeIntervalShort(nextPayoutIn, showFrom='minute')
    345         if nextPayoutIn <= 0:
    346             nextPayoutInText = FormatTimeIntervalShort(0, showFrom='minute')
    347         self.reserveBankTimeUntilNextPulseLabel.SetText(nextPayoutInText)
    348         newNextPayoutTimerValue = float(nextPayoutIn) / float(pulseInterval)
    349         if newNextPayoutTimerValue < 0.01:
    350             newNextPayoutTimerValue = 0
    351         normalGaugeMovement = newNextPayoutTimerValue <= self.reserveBankHackingGauge.nextPayoutTimerValue
    352         self.reserveBankHackingGauge.SetNextPayoutTimerValue(newNextPayoutTimerValue, animate=normalGaugeMovement)
    353         if newNextPayoutTimerValue == 0:
    354             self.reserveBankHackingGauge.BlinkOutNextPaymentTimer()
    355         if not normalGaugeMovement:
    356             self.reserveBankHackingGauge.BlinkInNextPaymentTimer()
    357         newGaugeValue = float(pulsesRemaining) / float(pulsesTotal)
    358         self.reserveBankHackingGauge.SetValue(newGaugeValue)
    359         activeLinks = self.state_controller.Get('reserveBankActiveLinks')
    360         self.reserveBankHackingGauge.SetLinked(activeLinks)
    361         nextPayoutAmount = self.state_controller.GetCurrentReserveBankPulsePayout()
    362         self.reserveBankNextPayoutLabel.SetText(eveformat.isk_readable_short(nextPayoutAmount))
    363         self.reserveBankPayoutRateLabel.SetText(self._GetPaymentRateText())
    364 
    365     def ConstructMainBankInfo(self, gaugeStates, animate):
    366         if self.state_controller.GetEssData() is not None:
    367             mainBankLinkText = localization.GetByLabel('UI/ESS/infoPanelMainBank', iskString=eveformat.isk_readable(self.state_controller.Get('mainValue', 0.0)))
    368             mainBankLink = Link(url='essTransactionHistory:mainBank', text=mainBankLinkText, alt=localization.GetByLabel('UI/ESS/TransactionHistoryHint'))
    369             mainBankLabelCont = ContainerAutoSize(parent=self.bodyCont, name='mainBankLabelCont', align=uiconst.TOTOP, padTop=15)
    370             EveLabelLarge(parent=mainBankLabelCont, text=mainBankLink, align=uiconst.TOPLEFT, state=uiconst.UI_NORMAL)
    371             if self.mainBankState == MAIN_BANK_HACKING:
    372                 self.ConstructMainBankHackingState(gaugeStates, animate)
    373             else:
    374                 self.ConstructMainBankIdleState(gaugeStates, animate)
    375 
    376     def ConstructMainBankHackingState(self, gaugeStates, animate):
    377         self.mainBankHackingCont = Container(name='mainBankHackingCont', parent=self.bodyCont, align=uiconst.TOTOP, alignMode=uiconst.TOTOP, padTop=13, padBottom=0, height=46)
    378         autopayTimerCont = Container(name='autopayTimerCont', parent=self.mainBankHackingCont, align=uiconst.TOTOP, height=50)
    379         gaugeStartingOpacity = 1
    380         if animate:
    381             gaugeStartingOpacity = 0
    382         self.mainBankDelayedPayoutLockSymbol = Transform(parent=autopayTimerCont, align=uiconst.TOLEFT_NOPUSH, width=44, height=44, top=-1, opacity=gaugeStartingOpacity, state=uiconst.UI_DISABLED)
    383         lockSprite = Sprite(parent=self.mainBankDelayedPayoutLockSymbol, width=32, height=32, align=uiconst.CENTER, color=Color(*Color.WHITE).SetAlpha(0.8).GetRGBA(), texturePath='res:/ui/Texture/classes/ess/mainBank/lock.png')
    384         lockSprite.scalingCenter = (0.5, 0.5)
    385         self.mainBankDelayedPayoutTimerGauge = GaugeCircular(parent=autopayTimerCont, color=Color.WHITE, align=uiconst.TOLEFT, colorStart=Color.WHITE, colorEnd=Color.WHITE, showMarker=False, lineWidth=5.0, colorBg=Color(*Color.WHITE).SetAlpha(0.2).GetRGBA(), radius=22, opacity=gaugeStartingOpacity, state=uiconst.UI_DISABLED)
    386         if gaugeStates['mainBankDelayedAutopayGaugeValue']:
    387             self.mainBankDelayedPayoutTimerGauge.SetValue(gaugeStates['mainBankDelayedAutopayGaugeValue'], animate=animate)
    388         if animate:
    389             animations.FadeIn(self.mainBankDelayedPayoutTimerGauge)
    390             animations.FadeIn(self.mainBankDelayedPayoutLockSymbol)
    391         startValue = gaugeStates['mainBankHackGaugeStartValue'] or 1.0
    392         mainBankLink = self.state_controller.GetMainBankLinkState()['link']
    393         self.mainBankHackTimerGauge = MainBankHackingTimer(name='mainBankHackTimerGauge', parent=autopayTimerCont, align=uiconst.TOLEFT, alignMode=uiconst.TOPLEFT, characterID=mainBankLink.get('characterID'), padLeft=20, value=startValue, animate=animate)
    394         self.mainBankHackingLabelsCont = ContainerAutoSize(name='hackingLabelsCont', parent=autopayTimerCont, align=uiconst.TOLEFT, alignMode=uiconst.TOPLEFT, padLeft=15)
    395         EveLabelLarge(parent=self.mainBankHackingLabelsCont, align=uiconst.TOPLEFT, text=localization.GetByLabel('UI/ESS/mainBankHackedIn'))
    396         timeLeftText = FormatTimeIntervalShort(self.state_controller.GetTimeLeftForMainBankHack(), showFrom='minute')
    397         self.mainBankHackTimerLabel = EveCaptionLarge(parent=self.mainBankHackingLabelsCont, align=uiconst.CENTERLEFT, text=timeLeftText, color=MAIN_BANK_ACTIVE_BAR_COLOR, padTop=5, bold=False)
    398         if gaugeStates['mainBankHackGaugeStartValue']:
    399             self.mainBankHackTimerGauge.SetValue(gaugeStates['mainBankHackGaugeStartValue'])
    400         self.updateMainBankHackingLabelTimer = AutoTimer(500, self.UpdateMainBankHackingTimerLabel)
    401         self.updateMainBankHackingGaugeTimer = AutoTimer(500, self.UpdateMainBankHackingTimerGauge, self.updateMainBankHackingGaugeTimer, self.mainBankHackTimerGauge)
    402         self.updateIdleMainBankTimer = AutoTimer(500, self.UpdateMainBankAutopaymentGauge, self.updateIdleMainBankTimer, self.mainBankDelayedPayoutTimerGauge)
    403 
    404     def UpdateMainBankHackingTimerLabel(self):
    405         if self.destroyed:
    406             self.updateMainBankHackingLabelTimer = None
    407             return
    408         timeLeftText = FormatTimeIntervalShort(self.state_controller.GetTimeLeftForMainBankHack(), showFrom='minute')
    409         self.mainBankHackTimerLabel.SetText(timeLeftText)
    410 
    411     def UpdateMainBankHackingTimerGauge(self, thisTimer, gauge):
    412         if self.destroyed and thisTimer:
    413             thisTimer.KillTimer()
    414             thisTimer = None
    415             return
    416         newValue = self.state_controller.GetProportionOfTimeLeftForMainBankHack()
    417         gauge.SetValue(newValue)
    418 
    419     def ConstructMainBankIdleState(self, gaugeStates, animate):
    420         if self.state_controller.GetEssData():
    421             self.mainBankCont = ContainerAutoSize(name='mainBankCont', parent=self.bodyCont, align=uiconst.TOTOP, alignMode=uiconst.TOTOP, padTop=13)
    422             self.mainBankIdleTimerCont = Container(name='timerCont', parent=self.mainBankCont, align=uiconst.TOTOP, alignMode=uiconst.TOPLEFT, height=46, state=uiconst.UI_DISABLED)
    423             startingOpacity = 0 if animate else 1
    424             self.mainBankAutopaymentProgressBar = GaugeCircular(parent=self.mainBankIdleTimerCont, color=Color.WHITE, align=uiconst.TOLEFT, showMarker=False, lineWidth=5.0, radius=22, colorStart=Color.WHITE, colorEnd=Color.WHITE, colorBg=Color(*Color.WHITE).SetAlpha(0.2).GetRGBA(), opacity=startingOpacity)
    425             self.mainBankIdleIskSymbolTransform = Transform(parent=self.mainBankIdleTimerCont, align=uiconst.TOPLEFT, width=44, height=44)
    426             iskSymbolSprite = Sprite(parent=self.mainBankIdleIskSymbolTransform, align=uiconst.CENTER, texturePath='res:/ui/Texture/classes/ess/mainBank/wallet.png', color=Color(*Color.WHITE).SetAlpha(0.8).GetRGBA(), width=25, height=25)
    427             iskSymbolSprite.scalingCenter = (0.5, 0.5)
    428             self.mainBankAutupaymentTimerTextCont = ContainerAutoSize(name='timerTextCont', parent=self.mainBankIdleTimerCont, align=uiconst.TOLEFT, alignMode=uiconst.TOPLEFT, padLeft=15, opacity=startingOpacity)
    429             EveLabelLarge(parent=self.mainBankAutupaymentTimerTextCont, text=localization.GetByLabel('UI/ESS/MainBankNextAutopayLabel'), align=uiconst.TOPLEFT, top=-3)
    430             current = GetSimTime()
    431             maxVal = self.state_controller.Get('nextScheduledAutopayment', GetSimTime() + 100)
    432             autopaymentCountdown = max(0, maxVal - current)
    433             self.mainBankIdlePaymentCountdownLabel = EveCaptionLarge(parent=self.mainBankAutupaymentTimerTextCont, text=FormatTimeIntervalShort(autopaymentCountdown, showFrom='hour', showTo='second'), align=uiconst.BOTTOMLEFT, bold=False, top=3)
    434             if not animate and gaugeStates['mainBankIdleTimerStartValue']:
    435                 self.mainBankAutopaymentProgressBar.SetValue(gaugeStates['mainBankIdleTimerStartValue'], animate=False)
    436 
    437             def animate_in():
    438                 with locks.TempLock(TRANSITION_LOCK):
    439                     animations.FadeIn(self.mainBankAutopaymentProgressBar, duration=0.25)
    440                     animations.FadeIn(self.mainBankAutupaymentTimerTextCont, duration=0.25)
    441                     animations.MoveInFromRight(self.mainBankAutupaymentTimerTextCont, amount=10, duration=0.25, sleep=True)
    442 
    443             if animate:
    444                 StartTasklet(animate_in)
    445             self.updateIdleMainBankTimer = AutoTimer(500, self.UpdateMainBankAutopaymentGauge, self.updateIdleMainBankTimer, self.mainBankAutopaymentProgressBar)
    446             self.updateIdleMainBankLabelsTimer = AutoTimer(500, self.UpdateMainBankAutopaymemtLabel, self.updateIdleMainBankLabelsTimer, self.mainBankIdlePaymentCountdownLabel)
    447 
    448     def OnESSDataUpdate_Local(self):
    449         self.TransitionState()
    450 
    451     def OnMainBankPlayerLinkDisconnected(self, data):
    452         thisClient = data['characterID'] == session.charid
    453         self.TransitionState(linkDisconnected=True, newMainBankState=MAIN_BANK_IDLE, thisClient=thisClient)
    454 
    455     def OnMainBankPlayerHackSuccess(self, data):
    456         thisClient = data['characterID'] == session.charid
    457         self.TransitionState(hackSuccess=True, newMainBankState=MAIN_BANK_IDLE, thisClient=thisClient)