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

tourneyMatchStatusUI.py (3253B)


      1 #Embedded file name: C:\BuildAgent\work\20d73f1b24eed06e\eve\release\V24.01\eve\client\script\ui\extras\tourneyMatchStatusUI.py
      2 import carbonui.const as uiconst
      3 import blue
      4 import tournamentmanagement.const as tourneyConst
      5 import uthread
      6 import tournamentmanagement.tournamentTimerFormatter as tournamentTimerFormatter
      7 from carbonui.control.window import Window
      8 from carbonui.primitives.container import Container
      9 from carbonui.primitives.fill import Fill
     10 from eve.client.script.ui.control import eveLabel
     11 
     12 class TourneyMatchStatusUI(Window):
     13     __guid__ = 'form.TourneyMatchStatusUI'
     14     default_scope = uiconst.SCOPE_ALL
     15 
     16     def ApplyAttributes(self, attributes):
     17         Window.ApplyAttributes(self, attributes)
     18         self.SetCaption('Match Status')
     19         self.SetMinSize((100, 100))
     20         self.MakeUnResizeable()
     21         self.MakeUnKillable()
     22         self.matchState = 0
     23         self.matchStartTime = 0
     24         self.overtimeLevel = 0
     25         self.matchLength = 0
     26         self.overtimeLength = 0
     27         self.ConstructLayout()
     28         self.matchTimer = tournamentTimerFormatter.TournamentTimerFormatter()
     29         self.timerThread = uthread.new(self._UpdateTimer)
     30 
     31     def ConstructLayout(self):
     32         self.pointsContainer = Container(name='pointsContainer', align=uiconst.TOTOP, parent=self.sr.main, height=40)
     33         self.myScore = eveLabel.Label(name='myScore', text='000', padding=5, parent=self.pointsContainer, align=uiconst.TOLEFT, fontsize=30, width=55)
     34         self.scoreDivider = Fill(name='scoreDivider', padding=1, height=40, width=10, parent=self.pointsContainer, align=uiconst.CENTER)
     35         self.opponentScore = eveLabel.Label(name='opponentScore', text='000', padding=5, parent=self.pointsContainer, align=uiconst.TORIGHT, fontsize=30, width=55)
     36         self.clockLabel = eveLabel.Label(text='Waiting...', parent=self.sr.main, top=15, align=uiconst.CENTER, fontsize=40)
     37 
     38     def OnTournamentMatchStateChange(self, redPoints, bluePoints, myTeam, matchStatus):
     39         self.matchState = matchStatus['matchState']
     40         self.matchStartTime = matchStatus['matchStartTime']
     41         self.overtimeLevel = matchStatus['overtimeLevel']
     42         self.matchLength = matchStatus['matchLength']
     43         self.overtimeLength = matchStatus['overtimeLength']
     44         if self.matchState > tourneyConst.tournamentStateWarpin:
     45             if myTeam == 0:
     46                 self.myScore.SetRGBA(1, 0, 0, 1)
     47                 self.myScore.text = redPoints
     48                 self.opponentScore.text = bluePoints
     49             elif myTeam == 1:
     50                 self.myScore.SetRGBA(0, 0.75, 1, 1)
     51                 self.myScore.text = bluePoints
     52                 self.opponentScore.text = redPoints
     53 
     54     def _UpdateTimer(self):
     55         while not self.destroyed and self.matchState < tourneyConst.tournamentStateComplete:
     56             text, color = self.matchTimer.GetTimerTextAndColor(self.matchState, self.matchStartTime, self.overtimeLevel, self.matchLength, self.overtimeLength)
     57             self.clockLabel.text = text
     58             self.clockLabel.SetRGBA(*color)
     59             blue.synchro.SleepWallclock(200)
     60 
     61     def Close(self, *args, **kwargs):
     62         self.timerThread.kill()
     63         self.timerThread = None
     64         Window.Close(self, *args, **kwargs)