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

bottomCont.py (7039B)


      1 #Embedded file name: C:\BuildAgent\work\20d73f1b24eed06e\eve\release\V24.01\eve\client\script\ui\shared\loginRewards\bottomCont.py
      2 import math
      3 import gametime
      4 import uthread2
      5 from carbonui.control.button import Button
      6 from carbonui.primitives.container import Container
      7 from carbonui import uiconst, fontconst
      8 from carbonui.primitives.sprite import Sprite
      9 from clonegrade import COLOR_OMEGA_ORANGE
     10 from eve.client.script.ui.control.eveLabel import EveLabelMedium
     11 from eve.client.script.ui.eveColor import WHITE
     12 from eve.client.script.ui.shared.cloneGrade.upgradeButton import UpgradeButton
     13 from localization import GetByLabel
     14 from loginrewards.common.const import CLAIM_STATE_CLAIMABLE
     15 
     16 class ClaimButton(Button):
     17 
     18     def OnMouseEnter(self, *args):
     19         super(ClaimButton, self).OnMouseEnter(*args)
     20         sm.ScatterEvent('OnClaimRewardBtnHover', True)
     21 
     22     def OnMouseExit(self, *args):
     23         super(ClaimButton, self).OnMouseExit(*args)
     24         sm.ScatterEvent('OnClaimRewardBtnHover', False)
     25 
     26 
     27 class RewardBottomCont(Container):
     28     default_align = uiconst.TOBOTTOM
     29 
     30     def ApplyAttributes(self, attributes):
     31         self.panelController = attributes.panelController
     32         pConst = self.panelController.GetPanelConstants()
     33         self.default_height = pConst.CENTER_BOTTOM_HEIGHT
     34         Container.ApplyAttributes(self, attributes)
     35         self.rewardInfo = None
     36         self.nextRewardTime = None
     37         self.leftCont = Container(parent=self, align=uiconst.TOLEFT, width=pConst.LEFT_WIDTH)
     38         buttonCont = Container(parent=self, padLeft=pConst.SECTION_DIVIDER)
     39         self.claimBtn = ClaimButton(parent=buttonCont, align=uiconst.CENTER, label=GetByLabel('UI/LoginRewards/ClaimButtonText'), func=self.OnClaimBtnClicked)
     40         self.closeBtn = Button(parent=buttonCont, align=uiconst.CENTER, label=GetByLabel('UI/LoginRewards/CloseText'), func=self.OnCloseClicked)
     41         self.closeBtn.display = False
     42         self.closeBtn.GetHint = self.GetCloseBtnHint
     43         self.closeBtn.GetTooltipPointer = lambda *args: uiconst.POINT_TOP_2
     44 
     45     def OnClaimBtnClicked(self, *args):
     46         pass
     47 
     48     def OnCloseClicked(self, *args):
     49         self.CloseWnd()
     50 
     51     def LoadRewardInfo(self, claimState, next_reward_time, withTransition = False):
     52         self.nextRewardTime = next_reward_time
     53         if claimState == CLAIM_STATE_CLAIMABLE:
     54             self.SetBtnClaimable(withTransition)
     55         else:
     56             self.SetButtonUnclaimable(withTransition)
     57 
     58     def SetButtonUnclaimable(self, withTransition = False):
     59         self.claimBtn.display = False
     60         self.closeBtn.display = True
     61         if withTransition:
     62             self.closeBtn.Disable()
     63             uthread2.call_after_wallclocktime_delay(self.SetButtonUnclaimable, 0.5)
     64         else:
     65             self.closeBtn.Enable()
     66 
     67     def SetBtnClaimable(self, withTransition = False):
     68         self.claimBtn.display = True
     69         self.closeBtn.display = False
     70 
     71     def GetCloseBtnHint(self):
     72         pass
     73 
     74     def CloseWnd(self):
     75         pass
     76 
     77 
     78 class OneTrackRewardBottomCont(RewardBottomCont):
     79 
     80     def ApplyAttributes(self, attributes):
     81         self.rewardInfo = None
     82         self.nextRewardTime = None
     83         RewardBottomCont.ApplyAttributes(self, attributes)
     84         if not self.panelController.IsOmega() and not self.panelController.IsRookieCampaign():
     85             UpgradeBtnCont(parent=self, align=uiconst.CENTERLEFT, left=30, isOmega=self.panelController.IsOmega())
     86             EveLabelMedium(name='upSellText', parent=self, align=uiconst.CENTERLEFT, left=220, color=WHITE, text=GetByLabel('UI/LoginRewards/EverGreenOmegaUpSell'))
     87 
     88     def OnClaimBtnClicked(self, *args):
     89         self.panelController.ClaimReward()
     90 
     91     def LoadRewardInfo(self, rewardInfo, next_reward_time, withTransition = False):
     92         self.rewardInfo = rewardInfo
     93         claimState = rewardInfo.claimState if rewardInfo else None
     94         RewardBottomCont.LoadRewardInfo(self, claimState, next_reward_time, withTransition)
     95 
     96     def GetCloseBtnHint(self):
     97         if self.rewardInfo is None:
     98             return ''
     99         if self.rewardInfo and self.rewardInfo.claimState == CLAIM_STATE_CLAIMABLE or not self.nextRewardTime:
    100             return ''
    101         now = gametime.GetWallclockTime()
    102         return GetByLabel('UI/LoginRewards/CloseWindowButtonText', time=self.nextRewardTime - now)
    103 
    104     def CloseWnd(self, *args):
    105         from eve.client.script.ui.shared.loginRewards.loginRewardsWnd import DailyLoginRewardsWnd
    106         wnd = DailyLoginRewardsWnd.GetIfOpen()
    107         if wnd:
    108             wnd.CloseByUser()
    109 
    110 
    111 class TwoTrackRewardBottomCont(RewardBottomCont):
    112     default_align = uiconst.TOBOTTOM
    113     default_width = 200
    114 
    115     def ApplyAttributes(self, attributes):
    116         RewardBottomCont.ApplyAttributes(self, attributes)
    117         if not self.panelController.IsOmega():
    118             UpgradeBtnCont(parent=self, align=uiconst.CENTERLEFT, left=30, padTop=20, isOmega=self.panelController.IsOmega())
    119             EveLabelMedium(name='upSellText', parent=self, align=uiconst.CENTERLEFT, left=220, padTop=20, color=WHITE, text=GetByLabel('UI/LoginRewards/eventOmegaUpSell'))
    120 
    121     def OnClaimBtnClicked(self, *args):
    122         self.panelController.ClaimReward()
    123 
    124     def CloseWnd(self, *args):
    125         from eve.client.script.ui.shared.loginRewards.loginRewardsWnd import DailyLoginRewardsWnd
    126         wnd = DailyLoginRewardsWnd.GetIfOpen()
    127         if wnd:
    128             wnd.CloseByUser()
    129 
    130 
    131 class UpgradeBtnCont(Container):
    132     default_name = 'upgradeBtnCont'
    133     default_align = uiconst.TOPLEFT
    134     default_width = 148
    135     default_height = 30
    136 
    137     def ApplyAttributes(self, attributes):
    138         Container.ApplyAttributes(self, attributes)
    139         isOmega = attributes.isOmega
    140         self.upSellSprite = Sprite(name='upSellSprite', parent=self, align=uiconst.CENTERLEFT, width=33, height=29, texturePath='res:/UI/Texture/Classes/LoginCampaign/upsellBanner_icon.png')
    141         text = GetByLabel('UI/CloneState/AddOmegaTime') if isOmega else GetByLabel('UI/CloneState/UpgradeToOmega')
    142         upgradeButton = UpgradeButton(parent=self, align=uiconst.CENTERLEFT, text=text, onClick=sm.GetService('loginCampaignService').open_vgs_to_buy_omega_time_from_DLI, onMouseEnterCallback=self.OmegaShineStart, onMouseExitCallback=self.OmegaShineEnd, fontSize=fontconst.EVE_SMALL_FONTSIZE, upperCase=False, pos=(self.upSellSprite.width - 2,
    143          0,
    144          120,
    145          24), labelColor=COLOR_OMEGA_ORANGE, fillColor=COLOR_OMEGA_ORANGE, stretchTexturePath='res:/UI/Texture/Classes/LoginCampaign/upsellBanner_button.png', hiliteTexturePath='res:/UI/Texture/Classes/LoginCampaign/upsellBanner_buttonRollover.png', textureEdgeSize=8)
    146         upgradeButton.bg.rotation = math.pi
    147         upgradeButton.hilite.rotation = math.pi
    148         upgradeButton.width = max(self.width, upgradeButton.label.textwidth + 35)
    149         self.width = max(self.width, upgradeButton.width + 28)
    150 
    151     def OmegaShineStart(self):
    152         self.upSellSprite.opacity = 1.5
    153 
    154     def OmegaShineEnd(self):
    155         self.upSellSprite.opacity = 1.0