tourneyUISvc.py (2864B)
1 #Embedded file name: C:\BuildAgent\work\20d73f1b24eed06e\eve\release\V24.01\eve\client\script\ui\extras\tourneyUISvc.py 2 from carbon.common.script.sys.service import Service 3 from carbonui import uiconst 4 from eve.client.script.ui.extras import tourneyBanUI 5 from eve.client.script.ui.extras import tourneyMatchStatusUI 6 from player_messaging.client.ui_message import prompt_player_fsd_dialog 7 8 class TourneyUISvc(Service): 9 __guid__ = 'svc.tourneyUISvc' 10 __notifyevents__ = ['OnTournamentPerformBan', 11 'OnChangeFleetBoss', 12 'OnEnterTournamentSystem', 13 'OnTournamentMatchStateChange', 14 'OnLeaveTournamentSystem'] 15 16 def Run(self, memStream = None): 17 super(TourneyUISvc, self).Run(memStream) 18 self.matchStatusWindow = None 19 20 def OnTournamentPerformBan(self, banID, numBans, curBans, deadline, respondToNodeID, tourneyID): 21 self.LogInfo('OnTourneyBan recv', banID, numBans, curBans, deadline, respondToNodeID) 22 banWindow = tourneyBanUI.TourneyBanUI 23 banWindow.CloseIfOpen() 24 tourneyMgr = sm.RemoteSvc('tourneyMgr') 25 tournamentShipDetails = tourneyMgr.QueryShipList(tourneyID) 26 shipList = tournamentShipDetails['allowedShipList'] 27 banBox = banWindow.Open() 28 banBox.Execute(banID, numBans, curBans, deadline, respondToNodeID, shipList) 29 banBox.ShowModal() 30 31 def OnChangeFleetBoss(self, charID, respondToNodeID): 32 self.LogInfo('OnChangeFleetBoss received', charID, respondToNodeID) 33 response = prompt_player_fsd_dialog('CustomQuestion', {'header': 'Team Captain Selection', 34 'question': '{} has nominated you as a Team Member for a Tournament Match. Do you accept? <br><br>Accepting means they will be able to see your fleet composition.'.format(cfg.eveowners.Get(charID).name)}, uiconst.YESNO) 35 if response == uiconst.ID_YES: 36 machoNet = sm.GetService('machoNet') 37 remoteTourneyMgr = machoNet.ConnectToRemoteService('tourneyMgr', respondToNodeID) 38 remoteTourneyMgr.ExecuteMemberChange() 39 40 def OnEnterTournamentSystem(self): 41 self.GetMatchStatusWindow() 42 43 def OnTournamentMatchStateChange(self, redPoints, bluePoints, myTeam, matchStatus): 44 self.LogInfo('OnTournamentMatchStateChange Received', redPoints, bluePoints, myTeam, matchStatus) 45 self.GetMatchStatusWindow().OnTournamentMatchStateChange(redPoints, bluePoints, myTeam, matchStatus) 46 47 def OnLeaveTournamentSystem(self): 48 self.GetMatchStatusWindow().Close() 49 self.matchStatusWindow = None 50 51 def GetMatchStatusWindow(self): 52 if not self.matchStatusWindow or self.matchStatusWindow.destroyed: 53 statusWindow = tourneyMatchStatusUI.TourneyMatchStatusUI 54 self.matchStatusWindow = statusWindow.Open(windowID='matchStatusWindow') 55 return self.matchStatusWindow