fix more crashes
This commit is contained in:
parent
25e353e290
commit
72c6316f6e
4 changed files with 123 additions and 92 deletions
|
@ -1,19 +1,24 @@
|
|||
from toontown.toonbase.ToonBaseGlobal import *
|
||||
from panda3d.core import *
|
||||
from panda3d.toontown import *
|
||||
from toontown.toonbase.ToontownGlobals import *
|
||||
import random
|
||||
from direct.task.Task import Task
|
||||
from direct.distributed import DistributedObject
|
||||
from direct.directnotify import DirectNotifyGlobal
|
||||
from . import ToonInteriorColors
|
||||
import pickle
|
||||
from toontown.toonbase import TTLocalizer
|
||||
from panda3d.core import ModelNode, NodePath, TextNode
|
||||
from panda3d.toontown import DNADoor
|
||||
|
||||
class DistributedHQInterior(DistributedObject.DistributedObject):
|
||||
from direct.directnotify.DirectNotifyGlobal import directNotify
|
||||
from direct.distributed.DistributedObject import DistributedObject
|
||||
from direct.task.TaskManagerGlobal import taskMgr
|
||||
|
||||
from toontown.building import ToonInteriorColors
|
||||
from toontown.toonbase import ToontownGlobals
|
||||
from toontown.toonbase import TTLocalizer
|
||||
from toontown.toonbase.ToonBaseGlobal import base
|
||||
|
||||
import pickle
|
||||
from random import Random
|
||||
|
||||
|
||||
class DistributedHQInterior(DistributedObject):
|
||||
notify = directNotify.newCategory('DistributedHQInterior')
|
||||
|
||||
def __init__(self, cr):
|
||||
DistributedObject.DistributedObject.__init__(self, cr)
|
||||
DistributedObject.__init__(self, cr)
|
||||
self.dnaStore = cr.playGame.dnaStore
|
||||
self.leaderAvIds = []
|
||||
self.leaderNames = []
|
||||
|
@ -22,15 +27,15 @@ class DistributedHQInterior(DistributedObject.DistributedObject):
|
|||
self.tutorial = 0
|
||||
|
||||
def generate(self):
|
||||
DistributedObject.DistributedObject.generate(self)
|
||||
self.interior = loader.loadModel('phase_3.5/models/modules/HQ_interior')
|
||||
self.interior.reparentTo(render)
|
||||
DistributedObject.generate(self)
|
||||
self.interior = base.loader.loadModel('phase_3.5/models/modules/HQ_interior')
|
||||
self.interior.reparentTo(base.render)
|
||||
self.interior.find('**/cream').hide()
|
||||
self.interior.find('**/crashed_piano').hide()
|
||||
self.buildLeaderBoard()
|
||||
|
||||
def announceGenerate(self):
|
||||
DistributedObject.DistributedObject.announceGenerate(self)
|
||||
DistributedObject.announceGenerate(self)
|
||||
self.setupDoors()
|
||||
self.interior.flattenMedium()
|
||||
emptyBoard = self.interior.find('**/empty_board')
|
||||
|
@ -41,6 +46,7 @@ class DistributedHQInterior(DistributedObject.DistributedObject):
|
|||
return
|
||||
else:
|
||||
self.tutorial = flag
|
||||
|
||||
if self.tutorial:
|
||||
self.interior.find('**/periscope').hide()
|
||||
self.interior.find('**/speakers').hide()
|
||||
|
@ -53,7 +59,7 @@ class DistributedHQInterior(DistributedObject.DistributedObject):
|
|||
self.block = block
|
||||
|
||||
def buildLeaderBoard(self):
|
||||
self.leaderBoard = hidden.attachNewNode('leaderBoard')
|
||||
self.leaderBoard = base.hidden.attachNewNode('leaderBoard')
|
||||
self.leaderBoard.setPosHprScale(0.1, 0, 4.5, 90, 0, 0, 0.9, 0.9, 0.9)
|
||||
z = 0
|
||||
row = self.buildTitleRow()
|
||||
|
@ -63,7 +69,7 @@ class DistributedHQInterior(DistributedObject.DistributedObject):
|
|||
self.nameTextNodes = []
|
||||
self.scoreTextNodes = []
|
||||
self.trophyStars = []
|
||||
for i in range(self.numLeaders):
|
||||
for _ in range(self.numLeaders):
|
||||
row, nameText, scoreText, trophyStar = self.buildLeaderRow()
|
||||
self.nameTextNodes.append(nameText)
|
||||
self.scoreTextNodes.append(scoreText)
|
||||
|
@ -87,7 +93,7 @@ class DistributedHQInterior(DistributedObject.DistributedObject):
|
|||
self.trophyStars[i].hide()
|
||||
|
||||
def buildTitleRow(self):
|
||||
row = hidden.attachNewNode('leaderRow')
|
||||
row = base.hidden.attachNewNode('leaderRow')
|
||||
nameText = TextNode('titleRow')
|
||||
nameText.setFont(ToontownGlobals.getSignFont())
|
||||
nameText.setAlign(TextNode.ACenter)
|
||||
|
@ -98,7 +104,7 @@ class DistributedHQInterior(DistributedObject.DistributedObject):
|
|||
return row
|
||||
|
||||
def buildLeaderRow(self):
|
||||
row = hidden.attachNewNode('leaderRow')
|
||||
row = base.hidden.attachNewNode('leaderRow')
|
||||
nameText = TextNode('nameText')
|
||||
nameText.setFont(ToontownGlobals.getToonFont())
|
||||
nameText.setAlign(TextNode.ALeft)
|
||||
|
@ -135,15 +141,16 @@ class DistributedHQInterior(DistributedObject.DistributedObject):
|
|||
doorModelName = doorModelName[:-1] + 'l'
|
||||
else:
|
||||
doorModelName = doorModelName[:-1] + 'r'
|
||||
|
||||
door = self.dnaStore.findNode(doorModelName)
|
||||
return door
|
||||
|
||||
def setupDoors(self):
|
||||
self.randomGenerator = random.Random()
|
||||
self.randomGenerator = Random()
|
||||
self.randomGenerator.seed(self.zoneId)
|
||||
self.colors = ToonInteriorColors.colors[ToontownCentral]
|
||||
self.colors = ToonInteriorColors.colors[ToontownGlobals.ToontownCentral]
|
||||
door = self.chooseDoor()
|
||||
doorOrigins = render.findAllMatches('**/door_origin*')
|
||||
doorOrigins = base.render.findAllMatches('**/door_origin*')
|
||||
numDoorOrigins = doorOrigins.getNumPaths()
|
||||
for npIndex in range(numDoorOrigins):
|
||||
doorOrigin = doorOrigins[npIndex]
|
||||
|
@ -173,10 +180,10 @@ class DistributedHQInterior(DistributedObject.DistributedObject):
|
|||
del self.scoreTextNodes
|
||||
del self.trophyStars
|
||||
taskMgr.remove(self.uniqueName('starSpinHQ'))
|
||||
DistributedObject.DistributedObject.disable(self)
|
||||
DistributedObject.disable(self)
|
||||
|
||||
def buildTrophyStar(self):
|
||||
trophyStar = loader.loadModel('phase_3.5/models/gui/name_star')
|
||||
trophyStar = base.loader.loadModel('phase_3.5/models/gui/name_star')
|
||||
trophyStar.hide()
|
||||
trophyStar.setPos(*TTLocalizer.DHQItrophyStarPos)
|
||||
return trophyStar
|
||||
|
@ -211,7 +218,7 @@ class DistributedHQInterior(DistributedObject.DistributedObject):
|
|||
trophyStar.hide()
|
||||
|
||||
def __starSpin(self, task):
|
||||
now = globalClock.getFrameTime()
|
||||
now = base.clock.getFrameTime()
|
||||
r = now * task.trophyStarSpeed % 360.0
|
||||
task.trophyStar.setR(r)
|
||||
return Task.cont
|
||||
return task.cont
|
||||
|
|
|
@ -1,12 +1,15 @@
|
|||
from panda3d.core import *
|
||||
from panda3d.core import CardMaker, CollisionNode, CollisionPlane, NodePath, Plane, Point3, Vec3
|
||||
|
||||
from direct.directnotify.DirectNotifyGlobal import directNotify
|
||||
from direct.showbase.DirectObject import DirectObject
|
||||
from toontown.toonbase.ToonBaseGlobal import *
|
||||
from direct.directnotify import DirectNotifyGlobal
|
||||
from toontown.minigame import ToonBlitzGlobals, TwoDBlock
|
||||
from panda3d.core import CardMaker
|
||||
|
||||
from toontown.minigame import ToonBlitzGlobals
|
||||
from toontown.toonbase import ToontownGlobals
|
||||
from toontown.toonbase.ToonBaseGlobal import base
|
||||
|
||||
|
||||
class ToonBlitzAssetMgr(DirectObject):
|
||||
notify = DirectNotifyGlobal.directNotify.newCategory('DistributedToonBlitzAssets')
|
||||
notify = directNotify.newCategory('DistributedToonBlitzAssets')
|
||||
|
||||
def __init__(self, game):
|
||||
self.__defineConstants()
|
||||
|
@ -18,47 +21,47 @@ class ToonBlitzAssetMgr(DirectObject):
|
|||
|
||||
def load(self):
|
||||
self.world = NodePath('ToonBlitzWorld')
|
||||
self.background = loader.loadModel('phase_4/models/minigames/toonblitz_game')
|
||||
self.background = base.loader.loadModel('phase_4/models/minigames/toonblitz_game')
|
||||
self.background.reparentTo(self.world)
|
||||
self.startingWall = loader.loadModel('phase_4/models/minigames/toonblitz_game_wall')
|
||||
self.startingPipe = loader.loadModel('phase_4/models/minigames/toonblitz_game_start')
|
||||
self.exitElevator = loader.loadModel('phase_4/models/minigames/toonblitz_game_elevator')
|
||||
self.arrow = loader.loadModel('phase_4/models/minigames/toonblitz_game_arrow')
|
||||
self.sprayProp = loader.loadModel('phase_4/models/minigames/prop_waterspray')
|
||||
self.startingWall = base.loader.loadModel('phase_4/models/minigames/toonblitz_game_wall')
|
||||
self.startingPipe = base.loader.loadModel('phase_4/models/minigames/toonblitz_game_start')
|
||||
self.exitElevator = base.loader.loadModel('phase_4/models/minigames/toonblitz_game_elevator')
|
||||
self.arrow = base.loader.loadModel('phase_4/models/minigames/toonblitz_game_arrow')
|
||||
self.sprayProp = base.loader.loadModel('phase_4/models/minigames/prop_waterspray')
|
||||
self.treasureModelList = []
|
||||
salesIcon = loader.loadModel('phase_4/models/minigames/salesIcon')
|
||||
salesIcon = base.loader.loadModel('phase_4/models/minigames/salesIcon')
|
||||
self.treasureModelList.append(salesIcon)
|
||||
moneyIcon = loader.loadModel('phase_4/models/minigames/moneyIcon')
|
||||
moneyIcon = base.loader.loadModel('phase_4/models/minigames/moneyIcon')
|
||||
self.treasureModelList.append(moneyIcon)
|
||||
legalIcon = loader.loadModel('phase_4/models/minigames/legalIcon')
|
||||
legalIcon = base.loader.loadModel('phase_4/models/minigames/legalIcon')
|
||||
self.treasureModelList.append(legalIcon)
|
||||
corpIcon = loader.loadModel('phase_4/models/minigames/corpIcon')
|
||||
corpIcon = base.loader.loadModel('phase_4/models/minigames/corpIcon')
|
||||
self.treasureModelList.append(corpIcon)
|
||||
self.particleGlow = loader.loadModel('phase_4/models/minigames/particleGlow')
|
||||
self.particleGlow = base.loader.loadModel('phase_4/models/minigames/particleGlow')
|
||||
self.blockTypes = []
|
||||
for i in range(4):
|
||||
blockType = loader.loadModel('phase_4/models/minigames/toonblitz_game_block0' + str(i))
|
||||
blockType = base.loader.loadModel('phase_4/models/minigames/toonblitz_game_block0' + str(i))
|
||||
self.blockTypes.append(blockType)
|
||||
|
||||
self.stomper = loader.loadModel('phase_4/models/minigames/toonblitz_game_stomper')
|
||||
self.stomper = base.loader.loadModel('phase_4/models/minigames/toonblitz_game_stomper')
|
||||
plane = CollisionPlane(Plane(Vec3(0, 0, 1), Point3(0, 0, -50)))
|
||||
dropPlane = CollisionNode('dropPlane')
|
||||
dropPlane.addSolid(plane)
|
||||
dropPlane.setCollideMask(ToontownGlobals.FloorBitmask)
|
||||
self.world.attachNewNode(dropPlane)
|
||||
self.gameMusic = base.loader.loadMusic('phase_4/audio/bgm/MG_TwoDGame.ogg')
|
||||
self.treasureGrabSound = loader.loadSfx('phase_4/audio/sfx/SZ_DD_treasure.ogg')
|
||||
self.treasureGrabSound = base.loader.loadSfx('phase_4/audio/sfx/SZ_DD_treasure.ogg')
|
||||
self.sndOof = base.loader.loadSfx('phase_4/audio/sfx/MG_cannon_hit_dirt.ogg')
|
||||
self.soundJump = base.loader.loadSfx('phase_4/audio/sfx/MG_sfx_vine_game_jump.ogg')
|
||||
self.fallSound = base.loader.loadSfx('phase_4/audio/sfx/MG_sfx_vine_game_fall.ogg')
|
||||
self.watergunSound = base.loader.loadSfx('phase_4/audio/sfx/AA_squirt_seltzer_miss.ogg')
|
||||
self.splashSound = base.loader.loadSfx('phase_4/audio/sfx/Seltzer_squirt_2dgame_hit.ogg')
|
||||
self.threeSparkles = loader.loadSfx('phase_4/audio/sfx/threeSparkles.ogg')
|
||||
self.sparkleSound = loader.loadSfx('phase_4/audio/sfx/sparkly.ogg')
|
||||
self.headCollideSound = loader.loadSfx('phase_3.5/audio/sfx/AV_collision.ogg')
|
||||
self.threeSparkles = base.loader.loadSfx('phase_4/audio/sfx/threeSparkles.ogg')
|
||||
self.sparkleSound = base.loader.loadSfx('phase_4/audio/sfx/sparkly.ogg')
|
||||
self.headCollideSound = base.loader.loadSfx('phase_3.5/audio/sfx/AV_collision.ogg')
|
||||
self.faceStartPos = Vec3(-0.8, 0, -0.87)
|
||||
self.faceEndPos = Vec3(0.8, 0, -0.87)
|
||||
self.aspect2dRoot = aspect2d.attachNewNode('TwoDGuiAspect2dRoot')
|
||||
self.aspect2dRoot = base.aspect2d.attachNewNode('TwoDGuiAspect2dRoot')
|
||||
self.aspect2dRoot.setDepthWrite(1)
|
||||
self.cardMaker = CardMaker('card')
|
||||
self.cardMaker.reset()
|
||||
|
@ -114,10 +117,9 @@ class ToonBlitzAssetMgr(DirectObject):
|
|||
del self.sparkleSound
|
||||
del self.headCollideSound
|
||||
self.game = None
|
||||
return
|
||||
|
||||
def onstage(self):
|
||||
self.world.reparentTo(render)
|
||||
self.world.reparentTo(base.render)
|
||||
base.playMusic(self.gameMusic, looping=1, volume=0.9)
|
||||
|
||||
def offstage(self):
|
||||
|
|
|
@ -1,14 +1,29 @@
|
|||
from panda3d.core import *
|
||||
from panda3d.core import CollisionHandlerEvent, CollisionNode, CollisionSphere, Point3, Point4, VBase3, Vec3
|
||||
|
||||
from direct.directnotify.DirectNotifyGlobal import directNotify
|
||||
from direct.interval.IntervalGlobal import (
|
||||
ActorInterval,
|
||||
Func,
|
||||
LerpPosInterval,
|
||||
LerpScaleInterval,
|
||||
Parallel,
|
||||
Sequence,
|
||||
Wait
|
||||
)
|
||||
|
||||
from direct.showbase.DirectObject import DirectObject
|
||||
from toontown.toonbase.ToonBaseGlobal import *
|
||||
from direct.directnotify import DirectNotifyGlobal
|
||||
from direct.interval.IntervalGlobal import *
|
||||
from toontown.battle.BattleProps import *
|
||||
from direct.showbase.MessengerGlobal import messenger
|
||||
|
||||
from toontown.battle import MovieUtil
|
||||
import math
|
||||
from toontown.battle.BattleProps import globalPropPool
|
||||
from toontown.toonbase import ToontownGlobals
|
||||
from toontown.toonbase.ToonBaseGlobal import base
|
||||
|
||||
from math import sin
|
||||
|
||||
|
||||
class TwoDBattleMgr(DirectObject):
|
||||
notify = DirectNotifyGlobal.directNotify.newCategory('TwoDBattleMgr')
|
||||
notify = directNotify.newCategory('TwoDBattleMgr')
|
||||
|
||||
def __init__(self, game, toon):
|
||||
self.game = game
|
||||
|
@ -26,7 +41,6 @@ class TwoDBattleMgr(DirectObject):
|
|||
self.setupPistol()
|
||||
if self.toon == base.localAvatar:
|
||||
self.createShootCollision()
|
||||
return
|
||||
|
||||
def destroy(self):
|
||||
if self.toon == base.localAvatar:
|
||||
|
@ -34,18 +48,20 @@ class TwoDBattleMgr(DirectObject):
|
|||
self.waterBulletIval.finish()
|
||||
del self.waterBulletIval
|
||||
self.waterBulletIval = None
|
||||
|
||||
self.ignore('enter' + self.collSphereName)
|
||||
base.localAvatar.controlManager.currentControls.cTrav.removeCollider(self.waterBullet)
|
||||
self.waterBullet.removeNode()
|
||||
del self.waterBullet
|
||||
|
||||
self.hand_jointpath0.removeNode()
|
||||
MovieUtil.removeProp(self.pistol)
|
||||
if self.shootTrack != None:
|
||||
self.shootTrack.finish()
|
||||
self.shootTrack = None
|
||||
|
||||
self.game = None
|
||||
self.toon = None
|
||||
return
|
||||
|
||||
def start(self):
|
||||
pass
|
||||
|
@ -67,6 +83,7 @@ class TwoDBattleMgr(DirectObject):
|
|||
if self.toon == base.localAvatar:
|
||||
self.shootTrack.append(Func(self.game.assetMgr.playWatergunSound))
|
||||
self.shootTrack.append(self.getWaterBulletIval())
|
||||
|
||||
self.shootTrack.start()
|
||||
return
|
||||
elif self.shootTrack.isStopped():
|
||||
|
@ -74,6 +91,7 @@ class TwoDBattleMgr(DirectObject):
|
|||
if self.toon == base.localAvatar:
|
||||
self.shootTrack.append(Func(self.game.assetMgr.playWatergunSound))
|
||||
self.shootTrack.append(self.getWaterBulletIval())
|
||||
|
||||
self.shootTrack.start()
|
||||
|
||||
def createShootCollision(self):
|
||||
|
@ -90,6 +108,7 @@ class TwoDBattleMgr(DirectObject):
|
|||
self.waterBullet.hide()
|
||||
if self.showCollSpheres:
|
||||
self.waterBullet.show()
|
||||
|
||||
bulletEvent = CollisionHandlerEvent()
|
||||
bulletEvent.addInPattern('enter%fn')
|
||||
bulletEvent.addOutPattern('exit%fn')
|
||||
|
@ -108,22 +127,23 @@ class TwoDBattleMgr(DirectObject):
|
|||
else:
|
||||
toon.loop('neutral')
|
||||
|
||||
torso = self.toon.getPart('torso', '1000')
|
||||
toonTrack = Sequence(ActorInterval(self.toon, 'water-gun', startFrame=48, endFrame=58, partName='torso'), ActorInterval(self.toon, 'water-gun', startFrame=107, endFrame=126, playRate=2, partName='torso'), Func(returnToLastAnim, self.toon))
|
||||
return toonTrack
|
||||
|
||||
def calcSprayStartPos(self):
|
||||
if self.toon:
|
||||
self.toon.update(0)
|
||||
|
||||
joint = self.pistol.find('**/joint_nozzle')
|
||||
p = joint.getPos(render)
|
||||
p = joint.getPos(base.render)
|
||||
self.origin = p
|
||||
|
||||
def calcSprayEndPos(self):
|
||||
if self.toon:
|
||||
xDirection = -math.sin(self.toon.getH())
|
||||
xDirection = -sin(self.toon.getH())
|
||||
else:
|
||||
xDirection = -math.sin(-90)
|
||||
xDirection = -sin(-90)
|
||||
|
||||
endPos = Point3(self.origin.getX() + self.SHOOT_DISTANCE * xDirection, self.origin.getY(), self.origin.getZ())
|
||||
self.target = endPos
|
||||
|
||||
|
@ -131,7 +151,7 @@ class TwoDBattleMgr(DirectObject):
|
|||
dSprayScale = 0.15
|
||||
dSprayHold = 0.035
|
||||
color = self.WATER_SPRAY_COLOR
|
||||
parent = render
|
||||
parent = base.render
|
||||
horizScale = 1.0
|
||||
vertScale = 1.0
|
||||
|
||||
|
@ -161,12 +181,13 @@ class TwoDBattleMgr(DirectObject):
|
|||
sprayScale.removeNode()
|
||||
|
||||
sprayProp = self.sprayProp
|
||||
sprayScale = hidden.attachNewNode('spray-parent')
|
||||
sprayRot = hidden.attachNewNode('spray-rotate')
|
||||
sprayScale = base.hidden.attachNewNode('spray-parent')
|
||||
sprayRot = base.hidden.attachNewNode('spray-rotate')
|
||||
spray = sprayRot
|
||||
spray.setColor(color)
|
||||
if color[3] < 1.0:
|
||||
spray.setTransparency(1)
|
||||
|
||||
track = Sequence(Wait(0.1), Func(self.calcSprayStartPos), Func(self.calcSprayEndPos), Func(showSpray, sprayScale, sprayRot, sprayProp, parent), LerpScaleInterval(sprayScale, dSprayScale, calcTargetScale, startScale=MovieUtil.PNT3_NEARZERO), Wait(dSprayHold), Func(prepareToShrinkSpray, spray, sprayProp), LerpScaleInterval(sprayScale, dSprayScale, MovieUtil.PNT3_NEARZERO), Func(hideSpray, spray, sprayScale, sprayRot, sprayProp, globalPropPool))
|
||||
return track
|
||||
|
||||
|
@ -180,8 +201,8 @@ class TwoDBattleMgr(DirectObject):
|
|||
if self.waterBulletIval:
|
||||
self.waterBulletIval.finish()
|
||||
del self.waterBulletIval
|
||||
|
||||
self.waterBulletIval = None
|
||||
return
|
||||
|
||||
def getWaterBulletIval(self):
|
||||
if not self.waterBulletIval.isPlaying():
|
||||
|
|
|
@ -1,39 +1,39 @@
|
|||
from direct.distributed import DistributedObject
|
||||
from direct.directnotify import DirectNotifyGlobal
|
||||
from otp.otpbase import OTPTimer
|
||||
from panda3d.core import NodePath, TextNode
|
||||
|
||||
from direct.directnotify.DirectNotifyGlobal import directNotify
|
||||
from direct.distributed.DistributedObject import DistributedObject
|
||||
|
||||
from toontown.toonbase import ToontownGlobals
|
||||
from toontown.toonbase import TTLocalizer
|
||||
from toontown.racing import KartShopGlobals
|
||||
from toontown.toonbase.ToonBaseGlobal import *
|
||||
from panda3d.core import *
|
||||
from toontown.toonbase.ToontownGlobals import *
|
||||
import random
|
||||
from toontown.toonbase.ToonBaseGlobal import base
|
||||
|
||||
import pickle
|
||||
|
||||
class DistributedLeaderBoard(DistributedObject.DistributedObject):
|
||||
notify = DirectNotifyGlobal.directNotify.newCategory('DisributedLeaderBoard')
|
||||
|
||||
class DistributedLeaderBoard(DistributedObject):
|
||||
notify = directNotify.newCategory('DisributedLeaderBoard')
|
||||
|
||||
def __init__(self, cr):
|
||||
self.notify.debug('__init__: initialization of local leaderboard')
|
||||
DistributedObject.DistributedObject.__init__(self, cr)
|
||||
DistributedObject.__init__(self, cr)
|
||||
self.corner = 0
|
||||
self.length = 0
|
||||
self.width = 0
|
||||
self.updateCount = 0
|
||||
self.board = None
|
||||
self.surface = None
|
||||
return
|
||||
|
||||
def generateInit(self):
|
||||
DistributedObject.DistributedObject.generateInit(self)
|
||||
DistributedObject.generateInit(self)
|
||||
self.board = NodePath(self.uniqueName('LeaderBoard'))
|
||||
|
||||
def generate(self):
|
||||
DistributedObject.DistributedObject.generate(self)
|
||||
DistributedObject.generate(self)
|
||||
self.buildListParts()
|
||||
|
||||
def announceGenerate(self):
|
||||
DistributedObject.DistributedObject.announceGenerate(self)
|
||||
self.board.reparentTo(render)
|
||||
DistributedObject.announceGenerate(self)
|
||||
self.board.reparentTo(base.render)
|
||||
self.accept('decorator-holiday-%d-ending' % ToontownGlobals.CRASHED_LEADERBOARD, self.showLists)
|
||||
self.accept('decorator-holiday-%d-starting' % ToontownGlobals.CRASHED_LEADERBOARD, self.hideLists)
|
||||
newsManager = base.cr.newsManager
|
||||
|
@ -72,7 +72,7 @@ class DistributedLeaderBoard(DistributedObject.DistributedObject):
|
|||
z = zListTop
|
||||
self.nameTextNodes = []
|
||||
self.timeTextNodes = []
|
||||
for i in range(10):
|
||||
for _ in range(10):
|
||||
row, nameText, timeText, placeText = self.buildLeaderRow()
|
||||
self.nameTextNodes.append(nameText)
|
||||
placeText.setText(str(len(self.nameTextNodes)) + '.')
|
||||
|
@ -81,6 +81,7 @@ class DistributedLeaderBoard(DistributedObject.DistributedObject):
|
|||
if len(self.nameTextNodes) == 6:
|
||||
z = zListTop
|
||||
x = 0.35
|
||||
|
||||
row.setX(x)
|
||||
row.setZ(z)
|
||||
row.setY(1.6)
|
||||
|
@ -105,7 +106,7 @@ class DistributedLeaderBoard(DistributedObject.DistributedObject):
|
|||
self.timeTextNodes[i].setText('%02d:%02d:%02d' % (min, sec, hundredths * 100))
|
||||
|
||||
def buildTitleRow(self):
|
||||
row = hidden.attachNewNode('TitleRow')
|
||||
row = base.hidden.attachNewNode('TitleRow')
|
||||
nameText = TextNode('titleRow')
|
||||
nameText.setFont(ToontownGlobals.getSignFont())
|
||||
nameText.setAlign(TextNode.ACenter)
|
||||
|
@ -117,7 +118,7 @@ class DistributedLeaderBoard(DistributedObject.DistributedObject):
|
|||
return (row, nameText)
|
||||
|
||||
def buildTrackRow(self):
|
||||
row = hidden.attachNewNode('trackRow')
|
||||
row = base.hidden.attachNewNode('trackRow')
|
||||
nameText = TextNode('trackRow')
|
||||
nameText.setFont(ToontownGlobals.getSignFont())
|
||||
nameText.setAlign(TextNode.ACenter)
|
||||
|
@ -129,7 +130,7 @@ class DistributedLeaderBoard(DistributedObject.DistributedObject):
|
|||
return (row, nameText)
|
||||
|
||||
def buildLeaderRow(self):
|
||||
row = hidden.attachNewNode('leaderRow')
|
||||
row = base.hidden.attachNewNode('leaderRow')
|
||||
nameText = TextNode('nameText')
|
||||
nameText.setFont(ToontownGlobals.getToonFont())
|
||||
nameText.setAlign(TextNode.ALeft)
|
||||
|
@ -166,4 +167,4 @@ class DistributedLeaderBoard(DistributedObject.DistributedObject):
|
|||
self.notify.debug('delete: deleting local leaderboard')
|
||||
self.ignoreAll()
|
||||
self.board.removeNode()
|
||||
DistributedObject.DistributedObject.delete(self)
|
||||
DistributedObject.delete(self)
|
||||
|
|
Loading…
Reference in a new issue