Bye street signs

This commit is contained in:
DenialMC 2015-04-09 14:39:58 +03:00
parent 510e70df2d
commit 64322c9768
3 changed files with 2 additions and 108 deletions

View file

@ -1,5 +1,3 @@
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 *
@ -43,11 +41,7 @@ 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 HoodMgr import types, time, random, HoodMgr, PlayGame
import PlayGame
from toontown.hood import StreetSign
import random
class ToontownClientRepository(OTPClientRepository.OTPClientRepository): class ToontownClientRepository(OTPClientRepository.OTPClientRepository):
SupportTutorial = 1 SupportTutorial = 1
@ -76,7 +70,6 @@ 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
@ -86,7 +79,6 @@ class ToontownClientRepository(OTPClientRepository.OTPClientRepository):
self.playerFriendsManager = self.generateGlobalObject(OtpDoGlobals.OTP_DO_ID_PLAYER_FRIENDS_MANAGER, 'TTPlayerFriendsManager') self.playerFriendsManager = self.generateGlobalObject(OtpDoGlobals.OTP_DO_ID_PLAYER_FRIENDS_MANAGER, 'TTPlayerFriendsManager')
self.ttuFriendsManager = self.generateGlobalObject(OtpDoGlobals.OTP_DO_ID_TTU_FRIENDS_MANAGER, 'TTUFriendsManager') self.ttuFriendsManager = self.generateGlobalObject(OtpDoGlobals.OTP_DO_ID_TTU_FRIENDS_MANAGER, 'TTUFriendsManager')
self.streetSign = None
self.furnitureManager = None self.furnitureManager = None
self.objectManager = None self.objectManager = None
self.openAvatarPanels = set() self.openAvatarPanels = set()
@ -406,8 +398,6 @@ 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):

View file

@ -1,66 +0,0 @@
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

View file

@ -134,7 +134,6 @@ 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):
@ -368,33 +367,4 @@ 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