mirror of
https://github.com/Sneed-Group/Poodletooth-iLand
synced 2024-12-24 04:02:40 -06:00
DANIEL: Cycle through races shit
This commit is contained in:
parent
1e47509477
commit
9db517cfb3
5 changed files with 57 additions and 30 deletions
7
dependencies/astron/dclass/stride.dc
vendored
7
dependencies/astron/dclass/stride.dc
vendored
|
@ -2623,9 +2623,14 @@ dclass DistributedStartingBlock : DistributedObject {
|
|||
dclass DistributedViewingBlock : DistributedStartingBlock {
|
||||
};
|
||||
|
||||
struct LeaderboardResult {
|
||||
string name;
|
||||
uint32 time;
|
||||
};
|
||||
|
||||
dclass DistributedLeaderBoard : DistributedObject {
|
||||
setPosHpr(int16/10, int16/10, int16/10, int16/10, int16/10, int16/10) required broadcast ram;
|
||||
setDisplay(blob) broadcast ram;
|
||||
setDisplay(uint8, uint8, LeaderboardResult[]) required broadcast ram;
|
||||
};
|
||||
|
||||
dclass DistributedLawbotBoss : DistributedBossCog {
|
||||
|
|
|
@ -133,7 +133,8 @@ class GSHoodAI(HoodAI.HoodAI):
|
|||
hpr = childDnaGroup.getHpr()
|
||||
nameInfo = childDnaGroup.getName().split('_')
|
||||
|
||||
leaderBoard = DistributedLeaderBoardAI(simbase.air, nameInfo[1])
|
||||
if nameInfo[1] in RaceGlobals.LBSubscription:
|
||||
leaderBoard = DistributedLeaderBoardAI(simbase.air, RaceGlobals.LBSubscription[nameInfo[1]])
|
||||
leaderBoard.setPosHpr(pos[0], pos[1], pos[2], hpr[0], hpr[1], hpr[2])
|
||||
leaderBoard.generateWithRequired(zoneId)
|
||||
leaderBoards.append(leaderBoard)
|
||||
|
@ -151,12 +152,6 @@ class GSHoodAI(HoodAI.HoodAI):
|
|||
dnaData = self.air.dnaDataMap[self.zoneId]
|
||||
if dnaData.getName() == 'root':
|
||||
self.leaderBoards = self.findLeaderBoards(dnaData, self.zoneId)
|
||||
for leaderBoard in self.leaderBoards:
|
||||
if not leaderBoard:
|
||||
continue
|
||||
leaderBoardType = leaderBoard.getName()
|
||||
for subscription in RaceGlobals.LBSubscription[leaderBoardType]:
|
||||
leaderBoard.subscribeTo(subscription)
|
||||
|
||||
def __cycleLeaderBoards(self, task = None):
|
||||
messenger.send('GS_LeaderBoardSwap' + str(self.zoneId))
|
||||
|
|
|
@ -5,7 +5,6 @@ from toontown.racing import KartShopGlobals
|
|||
from toontown.toonbase import TTLocalizer
|
||||
from toontown.toonbase.ToonBaseGlobal import *
|
||||
from toontown.toonbase.ToontownGlobals import *
|
||||
import cPickle
|
||||
|
||||
class DistributedLeaderBoard(DistributedObject.DistributedObject):
|
||||
notify = DirectNotifyGlobal.directNotify.newCategory('DisributedLeaderBoard')
|
||||
|
@ -35,10 +34,13 @@ class DistributedLeaderBoard(DistributedObject.DistributedObject):
|
|||
def setPosHpr(self, x, y, z, h, p, r):
|
||||
self.surface.setPosHpr(x, y, z, h, p, r)
|
||||
|
||||
def setDisplay(self, pData):
|
||||
self.notify.debug('setDisplay: changing leaderboard text on local side')
|
||||
trackName, recordTitle, scores = cPickle.loads(pData)
|
||||
self.display(trackName, recordTitle, scores)
|
||||
def setDisplay(self, track, type, results):
|
||||
if not track in TTLocalizer.KartRace_TrackNames or len(TTLocalizer.RecordPeriodStrings) <= type:
|
||||
return
|
||||
|
||||
trackName = TTLocalizer.KartRace_TrackNames[track]
|
||||
recordTitle = TTLocalizer.RecordPeriodStrings[type]
|
||||
self.display(trackName, recordTitle, results)
|
||||
|
||||
def buildListParts(self):
|
||||
self.surface = self.board.attachNewNode('surface')
|
||||
|
@ -78,7 +80,7 @@ class DistributedLeaderBoard(DistributedObject.DistributedObject):
|
|||
self.trackNameNode.setText(pTrackTitle)
|
||||
self.updateCount += 1
|
||||
for i in xrange(10):
|
||||
if i > len(pLeaderList):
|
||||
if i >= len(pLeaderList):
|
||||
self.nameTextNodes[i].setText('-')
|
||||
self.timeTextNodes[i].setText('-')
|
||||
else:
|
||||
|
|
|
@ -1,13 +1,41 @@
|
|||
from direct.directnotify import DirectNotifyGlobal
|
||||
from direct.task import Task
|
||||
from direct.distributed.DistributedObjectAI import DistributedObjectAI
|
||||
import random
|
||||
|
||||
class DistributedLeaderBoardAI(DistributedObjectAI):
|
||||
notify = DirectNotifyGlobal.directNotify.newCategory("DistributedLeaderBoardAI")
|
||||
|
||||
def __init__(self, air, name):
|
||||
def __init__(self, air, displays):
|
||||
DistributedObjectAI.__init__(self, air)
|
||||
self.displays = displays
|
||||
self.display = (0, 0, [])
|
||||
self.posHpr = (0, 0, 0, 0, 0, 0)
|
||||
self.name = name
|
||||
|
||||
def generateWithRequired(self, zoneId):
|
||||
DistributedObjectAI.generateWithRequired(self, zoneId)
|
||||
self.setup()
|
||||
|
||||
def delete(self):
|
||||
DistributedObjectAI.delete(self)
|
||||
taskMgr.remove(self.switchTask)
|
||||
|
||||
def setup(self):
|
||||
self.currentId = 0
|
||||
self.switchDisplay()
|
||||
self.switchTask = taskMgr.doMethodLater(15, self.switchDisplay, 'leaderboardSwitchTask-%s' % random.random())
|
||||
|
||||
def switchDisplay(self, task=None):
|
||||
race = self.displays[self.currentId]
|
||||
|
||||
self.display = (race[0], race[1], [])
|
||||
self.currentId += 1
|
||||
|
||||
if self.currentId >= len(self.displays):
|
||||
self.currentId = 0
|
||||
|
||||
self.sendUpdate('setDisplay', [self.display[0], self.display[1], self.display[2]])
|
||||
return Task.again
|
||||
|
||||
def setPosHpr(self, x, y, z, h, p, r):
|
||||
self.posHpr = (x, y, z, h, p, r)
|
||||
|
@ -15,14 +43,5 @@ class DistributedLeaderBoardAI(DistributedObjectAI):
|
|||
def getPosHpr(self):
|
||||
return self.posHpr
|
||||
|
||||
def setName(self, name):
|
||||
self.name = name
|
||||
|
||||
def getName(self):
|
||||
return self.name
|
||||
|
||||
def setDisplay(self, todo0):
|
||||
pass
|
||||
|
||||
def subscribeTo(self, todo0):
|
||||
print 'subscribed to %s' % (todo0,)
|
||||
def getDisplay(self):
|
||||
return self.display
|
|
@ -8467,3 +8467,9 @@ TrueFriendsNotFriends = 'You cannot be True Friends with %s until you are regula
|
|||
TrueFriendsAddNotice = 'If you are playing Toontown with someone you trust, you can become True Friends.\n\nYou can chat using the keyboard with your True Friends.\n\nOther Toons won\'t understand what you\'re saying.\n\n\x01WLRed\x01However, this chat is completely unfiltered.\x02\n\nAre you sure you want to be True Friends with %s?'
|
||||
TrueFriendsAdded = 'You are now True Friends with %s!\n\nYou can now understand everything %s says.\n\nHowever, chances are %s hasn\'t added you as a True Friend yet.\n\nIf this is the case, he cannot understand you yet. Please ask %s to add you as a True Friend aswell!'
|
||||
TrueFriendsRemoved = 'You are no longer True Friends with %s.'
|
||||
|
||||
def convertSecondsToDate(seconds):
|
||||
m, s = divmod(seconds, 60)
|
||||
h, m = divmod(m, 60)
|
||||
|
||||
print '%d:%02d:%02d' % (h, m, s)
|
||||
|
|
Loading…
Reference in a new issue