Some preparations for the Goofy Speedway leaderboard

This commit is contained in:
John Cote 2015-06-10 23:35:42 -04:00
parent 443233ad1d
commit 0da6a108e4
2 changed files with 8 additions and 6 deletions

View file

@ -27,15 +27,17 @@ class GSHoodAI(HoodAI.HoodAI):
HoodAI.HoodAI.startup(self) HoodAI.HoodAI.startup(self)
self.createStartingBlocks() self.createStartingBlocks()
self.cycleDuration = 10
self.createLeaderBoards() self.createLeaderBoards()
self.cycleLeaderBoards() self.__cycleLeaderBoards()
def shutdown(self): def shutdown(self):
HoodAI.HoodAI.shutdown(self) HoodAI.HoodAI.shutdown(self)
taskMgr.removeTasksMatching('leaderBoardSwitch') taskMgr.removeTasksMatching(str(self) + '_leaderBoardSwitch')
for board in self.leaderBoards: for board in self.leaderBoards:
board.delete() board.delete()
del self.leaderBoards del self.leaderBoards
def findRacingPads(self, dnaGroup, zoneId, area, padType='racing_pad'): def findRacingPads(self, dnaGroup, zoneId, area, padType='racing_pad'):
@ -140,6 +142,6 @@ class GSHoodAI(HoodAI.HoodAI):
for subscription in RaceGlobals.LBSubscription[leaderBoardType]: for subscription in RaceGlobals.LBSubscription[leaderBoardType]:
leaderBoard.subscribeTo(subscription) leaderBoard.subscribeTo(subscription)
def cycleLeaderBoards(self, task=None): def __cycleLeaderBoards(self, task = None):
messenger.send('leaderBoardSwap-' + str(self.zoneId)) messenger.send('GS_LeaderBoardSwap' + str(self.zoneId))
taskMgr.doMethodLater(10, self.cycleLeaderBoards, 'leaderBoardSwitch') taskMgr.doMethodLater(self.cycleDuration, self.__cycleLeaderBoards, str(self) + '_leaderBoardSwitch')