mirror of
https://github.com/Sneed-Group/Poodletooth-iLand
synced 2025-01-09 17:53:50 +00:00
parent
8a01138fc6
commit
0412683301
3 changed files with 108 additions and 2 deletions
|
@ -1,3 +1,5 @@
|
||||||
|
import types
|
||||||
|
import time
|
||||||
from direct.distributed.ClockDelta import *
|
from direct.distributed.ClockDelta import *
|
||||||
from direct.gui.DirectGui import *
|
from direct.gui.DirectGui import *
|
||||||
from pandac.PandaModules import *
|
from pandac.PandaModules import *
|
||||||
|
@ -40,7 +42,11 @@ from toontown.makeatoon import TTPickANamePattern
|
||||||
from toontown.parties import ToontownTimeManager
|
from toontown.parties import ToontownTimeManager
|
||||||
from toontown.toon import Toon, DistributedToon
|
from toontown.toon import Toon, DistributedToon
|
||||||
from ToontownMsgTypes import *
|
from ToontownMsgTypes import *
|
||||||
import types, time, random, HoodMgr, PlayGame
|
import HoodMgr
|
||||||
|
import PlayGame
|
||||||
|
from toontown.hood import StreetSign
|
||||||
|
import random
|
||||||
|
|
||||||
|
|
||||||
class ToontownClientRepository(OTPClientRepository.OTPClientRepository):
|
class ToontownClientRepository(OTPClientRepository.OTPClientRepository):
|
||||||
SupportTutorial = 1
|
SupportTutorial = 1
|
||||||
|
@ -69,6 +75,7 @@ class ToontownClientRepository(OTPClientRepository.OTPClientRepository):
|
||||||
self.tutorialManager = None
|
self.tutorialManager = None
|
||||||
self.welcomeValleyManager = None
|
self.welcomeValleyManager = None
|
||||||
self.newsManager = None
|
self.newsManager = None
|
||||||
|
self.streetSign = None
|
||||||
self.distributedDistrict = None
|
self.distributedDistrict = None
|
||||||
self.partyManager = None
|
self.partyManager = None
|
||||||
self.lobbyManager = None
|
self.lobbyManager = None
|
||||||
|
@ -80,6 +87,7 @@ class ToontownClientRepository(OTPClientRepository.OTPClientRepository):
|
||||||
|
|
||||||
self.argManager = self.generateGlobalObject(OtpDoGlobals.OTP_DO_ID_TTS_ARG_MANAGER, 'ARGManager')
|
self.argManager = self.generateGlobalObject(OtpDoGlobals.OTP_DO_ID_TTS_ARG_MANAGER, 'ARGManager')
|
||||||
|
|
||||||
|
self.streetSign = None
|
||||||
self.furnitureManager = None
|
self.furnitureManager = None
|
||||||
self.objectManager = None
|
self.objectManager = None
|
||||||
self.openAvatarPanels = set()
|
self.openAvatarPanels = set()
|
||||||
|
@ -402,6 +410,8 @@ class ToontownClientRepository(OTPClientRepository.OTPClientRepository):
|
||||||
base.localAvatar.defaultZone,
|
base.localAvatar.defaultZone,
|
||||||
-1])
|
-1])
|
||||||
self._userLoggingOut = False
|
self._userLoggingOut = False
|
||||||
|
if not self.streetSign:
|
||||||
|
self.streetSign = StreetSign.StreetSign()
|
||||||
return
|
return
|
||||||
|
|
||||||
def exitPlayingGame(self):
|
def exitPlayingGame(self):
|
||||||
|
|
66
toontown/hood/StreetSign.py
Normal file
66
toontown/hood/StreetSign.py
Normal file
|
@ -0,0 +1,66 @@
|
||||||
|
import os
|
||||||
|
import shutil
|
||||||
|
import datetime
|
||||||
|
from pandac.PandaModules import *
|
||||||
|
from direct.directnotify import DirectNotifyGlobal
|
||||||
|
from direct.distributed import DistributedObject
|
||||||
|
from direct.showbase import AppRunnerGlobal
|
||||||
|
from toontown.toonbase import TTLocalizer
|
||||||
|
|
||||||
|
class StreetSign(DistributedObject.DistributedObject):
|
||||||
|
RedownloadTaskName = 'RedownloadStreetSign'
|
||||||
|
StreetSignFileName = config.GetString('street-sign-filename', 'texture.jpg')
|
||||||
|
StreetSignBaseDir = config.GetString('street-sign-base-dir', 'sign')
|
||||||
|
StreetSignUrl = base.config.GetString('street-sign-url', 'http://cdn.toontown.disney.go.com/toontown/en/street-signs/img/')
|
||||||
|
notify = DirectNotifyGlobal.directNotify.newCategory('StreetSign')
|
||||||
|
|
||||||
|
def __init__(self):
|
||||||
|
self.downloadingStreetSign = False
|
||||||
|
self.percentDownloaded = 0.0
|
||||||
|
self.startDownload = datetime.datetime.now()
|
||||||
|
self.endDownload = datetime.datetime.now()
|
||||||
|
self.notify.info('Street sign url is %s' % self.StreetSignUrl)
|
||||||
|
#self.redownloadStreetSign()
|
||||||
|
|
||||||
|
def replaceTexture(self):
|
||||||
|
searchPath = DSearchPath()
|
||||||
|
searchPath.appendDirectory(self.directory)
|
||||||
|
|
||||||
|
def redownloadStreetSign(self):
|
||||||
|
self.precentDownload = 0.0
|
||||||
|
self.startRedownload = datetime.datetime.now()
|
||||||
|
self.downloadingStreetSign = True
|
||||||
|
Filename(self.StreetSignBaseDir + '/.').makeDir()
|
||||||
|
http = HTTPClient.getGlobalPtr()
|
||||||
|
self.url = self.StreetSignUrl + self.StreetSignFileName
|
||||||
|
self.ch = http.makeChannel(True)
|
||||||
|
localFilename = Filename(self.StreetSignBaseDir, self.StreetSignFileName)
|
||||||
|
self.ch.getHeader(DocumentSpec(self.url))
|
||||||
|
size = self.ch.getFileSize()
|
||||||
|
doc = self.ch.getDocumentSpec()
|
||||||
|
localSize = localFilename.getFileSize()
|
||||||
|
outOfDate = True
|
||||||
|
if size == localSize:
|
||||||
|
if doc.hasDate():
|
||||||
|
date = doc.getDate()
|
||||||
|
localDate = HTTPDate(localFilename.getTimestamp())
|
||||||
|
if localDate.compareTo(date) > 0:
|
||||||
|
outOfDate = False
|
||||||
|
self.notify.info('Street Sign is up to date')
|
||||||
|
if outOfDate and self.ch.isValid():
|
||||||
|
self.ch.beginGetDocument(doc)
|
||||||
|
self.ch.downloadToFile(localFilename)
|
||||||
|
taskMgr.add(self.downloadStreetSignTask, self.RedownloadTaskName)
|
||||||
|
|
||||||
|
def downloadStreetSignTask(self, task):
|
||||||
|
if self.ch.run():
|
||||||
|
return task.cont
|
||||||
|
doc = self.ch.getDocumentSpec()
|
||||||
|
date = ''
|
||||||
|
if doc.hasDate():
|
||||||
|
date = doc.getDate().getString()
|
||||||
|
if not self.ch.isValid():
|
||||||
|
self.redownloadingStreetSign = False
|
||||||
|
return task.done
|
||||||
|
self.notify.info('Down downloading street sign')
|
||||||
|
return task.done
|
|
@ -134,6 +134,7 @@ class Street(BattlePlace.BattlePlace):
|
||||||
self.enterZone(requestStatus['zoneId'])
|
self.enterZone(requestStatus['zoneId'])
|
||||||
self.tunnelOriginList = base.cr.hoodMgr.addLinkTunnelHooks(self, self.loader.nodeList, self.zoneId)
|
self.tunnelOriginList = base.cr.hoodMgr.addLinkTunnelHooks(self, self.loader.nodeList, self.zoneId)
|
||||||
self.fsm.request(requestStatus['how'], [requestStatus])
|
self.fsm.request(requestStatus['how'], [requestStatus])
|
||||||
|
self.replaceStreetSignTextures()
|
||||||
return
|
return
|
||||||
|
|
||||||
def exit(self, visibilityFlag = 1):
|
def exit(self, visibilityFlag = 1):
|
||||||
|
@ -367,4 +368,33 @@ class Street(BattlePlace.BattlePlace):
|
||||||
self.halloweenLights += geom.findAllMatches('**/*lamp*')
|
self.halloweenLights += geom.findAllMatches('**/*lamp*')
|
||||||
self.halloweenLights += geom.findAllMatches('**/prop_snow_tree*')
|
self.halloweenLights += geom.findAllMatches('**/prop_snow_tree*')
|
||||||
for light in self.halloweenLights:
|
for light in self.halloweenLights:
|
||||||
light.setColorScaleOff(1)
|
light.setColorScaleOff(1)
|
||||||
|
|
||||||
|
return
|
||||||
|
|
||||||
|
def replaceStreetSignTextures(self):
|
||||||
|
if not hasattr(base.cr, 'playGame'):
|
||||||
|
return
|
||||||
|
place = base.cr.playGame.getPlace()
|
||||||
|
if place is None:
|
||||||
|
return
|
||||||
|
geom = base.cr.playGame.getPlace().loader.geom
|
||||||
|
signs = geom.findAllMatches('**/*tunnelAheadSign*;+s')
|
||||||
|
if signs.getNumPaths() > 0:
|
||||||
|
streetSign = base.cr.streetSign
|
||||||
|
signTexturePath = streetSign.StreetSignBaseDir + '/' + streetSign.StreetSignFileName
|
||||||
|
loaderTexturePath = Filename(str(signTexturePath))
|
||||||
|
alphaPath = 'phase_4/maps/tt_t_ara_gen_tunnelAheadSign_a.rgb'
|
||||||
|
inDreamland = False
|
||||||
|
if place.zoneId and ZoneUtil.getCanonicalHoodId(place.zoneId) == ToontownGlobals.DonaldsDreamland:
|
||||||
|
inDreamland = True
|
||||||
|
alphaPath = 'phase_4/maps/tt_t_ara_gen_tunnelAheadSign_a.rgb'
|
||||||
|
if Filename(signTexturePath).exists():
|
||||||
|
signTexture = loader.loadTexture(loaderTexturePath, alphaPath)
|
||||||
|
for sign in signs:
|
||||||
|
if Filename(signTexturePath).exists():
|
||||||
|
sign.setTexture(signTexture, 1)
|
||||||
|
if inDreamland:
|
||||||
|
sign.setColorScale(0.525, 0.525, 0.525, 1)
|
||||||
|
|
||||||
|
return
|
Loading…
Reference in a new issue