dna: Fix up use of new DNA's storage by PlayGame and friends.
This commit is contained in:
parent
ebd6a8e7c8
commit
2c8d342a0f
3 changed files with 19 additions and 14 deletions
|
@ -25,7 +25,7 @@ from toontown.hood import EstateHood
|
|||
from toontown.hood import PartyHood
|
||||
from toontown.toonbase import TTLocalizer
|
||||
from toontown.parties.PartyGlobals import GoToPartyStatus
|
||||
from toontown.dna.DNAParser import *
|
||||
from toontown.dna.DNAStorage import DNAStorage
|
||||
|
||||
class PlayGame(StateData.StateData):
|
||||
notify = DirectNotifyGlobal.directNotify.newCategory('PlayGame')
|
||||
|
@ -142,17 +142,22 @@ class PlayGame(StateData.StateData):
|
|||
|
||||
def loadDnaStoreTutorial(self):
|
||||
self.dnaStore = DNAStorage()
|
||||
loadDNAFile(self.dnaStore, 'phase_3.5/dna/storage_tutorial.xml')
|
||||
loadDNAFile(self.dnaStore, 'phase_3.5/dna/storage_interior.xml')
|
||||
|
||||
tree = loader.loadDNA('phase_3.5/dna/storage_tutorial.xml').store(self.dnaStore)
|
||||
|
||||
tree = loader.loadDNA('phase_3.5/dna/storage_interior.xml').store(self.dnaStore)
|
||||
|
||||
def loadDnaStore(self):
|
||||
if not hasattr(self, 'dnaStore'):
|
||||
self.dnaStore = DNAStorage()
|
||||
loadDNAFile(self.dnaStore, 'phase_4/dna/storage.xml')
|
||||
self.dnaStore.storeFont('humanist', ToontownGlobals.getInterfaceFont())
|
||||
self.dnaStore.storeFont('mickey', ToontownGlobals.getSignFont())
|
||||
self.dnaStore.storeFont('suit', ToontownGlobals.getSuitFont())
|
||||
loadDNAFile(self.dnaStore, 'phase_3.5/dna/storage_interior.xml')
|
||||
|
||||
loader.loadDNA('phase_4/dna/storage.xml').store(self.dnaStore)
|
||||
|
||||
self.dnaStore.storeFont(ToontownGlobals.getInterfaceFont(), 'humanist')
|
||||
self.dnaStore.storeFont(ToontownGlobals.getSignFont(), 'mickey')
|
||||
self.dnaStore.storeFont(ToontownGlobals.getSuitFont(), 'suit')
|
||||
|
||||
loader.loadDNA('phase_3.5/dna/storage_interior.xml').store(self.dnaStore)
|
||||
|
||||
def unloadDnaStore(self):
|
||||
if hasattr(self, 'dnaStore'):
|
||||
|
|
|
@ -33,13 +33,13 @@ class DNAStorage:
|
|||
del self._typecode2entity[(purge.type, purge.code)]
|
||||
|
||||
# Helpers for the above:
|
||||
def storeNode(self, node, code, scope):
|
||||
def storeNode(self, node, code, scope='global'):
|
||||
self.store(node, 'node', code, scope)
|
||||
|
||||
def storeFont(self, font, code, scope):
|
||||
def storeFont(self, font, code, scope='global'):
|
||||
self.store(font, 'font', code, scope)
|
||||
|
||||
def storeTexture(self, texture, code, scope):
|
||||
def storeTexture(self, texture, code, scope='global'):
|
||||
self.store(texture, 'texture', code, scope)
|
||||
|
||||
def findNode(self, code):
|
||||
|
|
|
@ -76,13 +76,13 @@ class Hood(StateData.StateData):
|
|||
|
||||
def load(self):
|
||||
if self.storageDNAFile:
|
||||
loadDNAFile(self.dnaStore, self.storageDNAFile)
|
||||
loader.loadDNA(self.storageDNAFile).store(self.dnaStore)
|
||||
newsManager = base.cr.newsManager
|
||||
if newsManager:
|
||||
holidayIds = base.cr.newsManager.getDecorationHolidayId()
|
||||
for holiday in holidayIds:
|
||||
for storageFile in self.holidayStorageDNADict.get(holiday, []):
|
||||
loadDNAFile(self.dnaStore, storageFile)
|
||||
loader.loadDNA(storageFile).store(self.dnaStore)
|
||||
|
||||
if ToontownGlobals.HALLOWEEN_COSTUMES not in holidayIds and ToontownGlobals.SPOOKY_COSTUMES not in holidayIds or not self.spookySkyFile:
|
||||
self.sky = loader.loadModel(self.skyFile)
|
||||
|
@ -106,7 +106,7 @@ class Hood(StateData.StateData):
|
|||
del self.loader
|
||||
del self.fsm
|
||||
del self.parentFSM
|
||||
#self.dnaStore.resetHood()
|
||||
self.dnaStore.reset(scope='hood')
|
||||
del self.dnaStore
|
||||
self.sky.removeNode()
|
||||
del self.sky
|
||||
|
|
Loading…
Reference in a new issue