mirror of
https://github.com/Sneed-Group/Poodletooth-iLand
synced 2024-12-23 03:35:12 -06:00
Removed DownloadWatcher and LoadingBlocker
This commit is contained in:
parent
9f29fb2011
commit
0d1400006f
8 changed files with 1 additions and 286 deletions
|
@ -1199,9 +1199,7 @@ class OTPClientRepository(ClientRepositoryBase):
|
|||
return
|
||||
|
||||
def detectLeakedEvents(self, extraHooks = None):
|
||||
allowedHooks = ['destroy-DownloadWatcherBar',
|
||||
'destroy-DownloadWatcherText',
|
||||
'destroy-fade',
|
||||
allowedHooks = ['destroy-fade',
|
||||
'f9',
|
||||
'meta-q',
|
||||
'meta-q-repeat',
|
||||
|
|
|
@ -1,28 +0,0 @@
|
|||
from direct.task import Task
|
||||
from otp.otpbase import OTPLocalizer
|
||||
from direct.gui.DirectGui import *
|
||||
from pandac.PandaModules import *
|
||||
from direct.showbase.DirectObject import DirectObject
|
||||
|
||||
class DownloadWatcher(DirectObject):
|
||||
|
||||
def __init__(self, phaseNames):
|
||||
self.phaseNames = phaseNames
|
||||
self.text = DirectLabel(relief=None, guiId='DownloadWatcherText', pos=(-0.96, 0, -0.91), text=OTPLocalizer.DownloadWatcherInitializing, text_fg=(1, 1, 1, 1), text_scale=0.05, textMayChange=1, text_align=TextNode.ALeft, sortOrder=50)
|
||||
self.bar = DirectWaitBar(guiId='DownloadWatcherBar', pos=(-0.81, 0, -0.96), relief=DGG.SUNKEN, frameSize=(-0.6,
|
||||
0.6,
|
||||
-0.1,
|
||||
0.1), borderWidth=(0.02, 0.02), scale=0.25, range=100, sortOrder=50, frameColor=(0.5, 0.5, 0.5, 0.5), barColor=(0.2, 0.7, 0.2, 0.5), text='0%', text_scale=0.16, text_fg=(1, 1, 1, 1), text_align=TextNode.ACenter, text_pos=(0, -0.05))
|
||||
self.accept('launcherPercentPhaseComplete', self.update)
|
||||
return
|
||||
|
||||
def update(self, phase, percent, reqByteRate, actualByteRate):
|
||||
phaseName = self.phaseNames[phase]
|
||||
self.text['text'] = OTPLocalizer.DownloadWatcherUpdate % phaseName
|
||||
self.bar['text'] = '%s %%' % percent
|
||||
self.bar['value'] = percent
|
||||
|
||||
def cleanup(self):
|
||||
self.text.destroy()
|
||||
self.bar.destroy()
|
||||
self.ignoreAll()
|
|
@ -206,8 +206,6 @@ AfkForceAcknowledgeMessage = 'Your toon got sleepy and went to bed.'
|
|||
PeriodTimerWarning = 'Your available time is almost over!'
|
||||
PeriodForceAcknowledgeMessage = 'Sorry, you have used up all of your available time. Please exit to purchase more.'
|
||||
CREnteringToontown = 'Entering...'
|
||||
DownloadWatcherUpdate = 'Downloading %s'
|
||||
DownloadWatcherInitializing = 'Download Initializing...'
|
||||
LoginScreenUserName = 'Account Name'
|
||||
LoginScreenPassword = 'Password'
|
||||
LoginScreenLogin = 'Login'
|
||||
|
|
|
@ -49,7 +49,6 @@ from toontown.building import DistributedBuildingQueryMgr
|
|||
from ToontownMsgTypes import *
|
||||
import HoodMgr
|
||||
import PlayGame
|
||||
from toontown.toontowngui import ToontownLoadingBlocker
|
||||
from toontown.hood import StreetSign
|
||||
import random
|
||||
|
||||
|
@ -216,8 +215,6 @@ class ToontownClientRepository(OTPClientRepository.OTPClientRepository):
|
|||
self.avChoice.load(self.isPaid())
|
||||
self.avChoice.enter()
|
||||
self.accept(self.avChoiceDoneEvent, self.__handleAvatarChooserDone, [avList])
|
||||
if config.GetBool('want-gib-loader', 1):
|
||||
self.loadingBlocker = ToontownLoadingBlocker.ToontownLoadingBlocker(avList)
|
||||
return
|
||||
|
||||
def __handleAvatarChooserDone(self, avList, doneStatus):
|
||||
|
|
|
@ -1,14 +0,0 @@
|
|||
from direct.directnotify import DirectNotifyGlobal
|
||||
from otp.launcher.DownloadWatcher import DownloadWatcher
|
||||
from toontown.toonbase import TTLocalizer
|
||||
|
||||
class ToontownDownloadWatcher(DownloadWatcher):
|
||||
notify = DirectNotifyGlobal.directNotify.newCategory('ToontownDownloadWatcher')
|
||||
|
||||
def __init__(self, phaseNames):
|
||||
DownloadWatcher.__init__(self, phaseNames)
|
||||
|
||||
def update(self, phase, percent, reqByteRate, actualByteRate):
|
||||
DownloadWatcher.update(self, phase, percent, reqByteRate, actualByteRate)
|
||||
phaseName = self.phaseNames[phase]
|
||||
self.text['text'] = TTLocalizer.LoadingDownloadWatcherUpdate % phaseName
|
|
@ -4107,7 +4107,6 @@ LauncherStartingGame = 'Starting Toontown Unlimited...'
|
|||
LauncherRecoverFiles = 'Updating Toontown Unlimited. Recovering files...'
|
||||
LauncherCheckUpdates = 'Checking for updates for ' + LauncherProgress
|
||||
LauncherVerifyPhase = 'Updating Toontown Unlimited...'
|
||||
LoadingDownloadWatcherUpdate = 'Loading %s'
|
||||
AvatarChoiceMakeAToon = 'Make A\nToon'
|
||||
AvatarChoicePlayThisToon = 'Play\nThis Toon'
|
||||
AvatarChoiceSubscribersOnly = 'Subscribe'
|
||||
|
@ -8294,39 +8293,6 @@ FireworksNewYearsEveBeginning = lToonHQ + ': Happy New Year! Enjoy the fireworks
|
|||
FireworksNewYearsEveEnding = lToonHQ + ': Hope you enjoyed the show! Have a Toontastic New Year!'
|
||||
FireworksComboBeginning = lToonHQ + ': Enjoy lots of Laffs with Toon fireworks!'
|
||||
FireworksComboEnding = lToonHQ + ': Thank you, Toons! Hope you enjoyed the show!'
|
||||
BlockerTitle = 'LOADING TOONTOWN...'
|
||||
BlockerLoadingTexts = ['Rewriting history',
|
||||
'Baking pie crusts',
|
||||
'Heating pie filling',
|
||||
'Loading Doodle chow',
|
||||
'Stringing Jungle Vines',
|
||||
'Uncaging those spiders who crawl down jungle vines',
|
||||
'Planting squirting flower seeds',
|
||||
'Stretching trampolines',
|
||||
'Herding pigs',
|
||||
"Tweaking 'SPLAT' sounds",
|
||||
'Cleaning Hypno-glasses',
|
||||
'Unbottling ink for Toon News',
|
||||
'Clipping TNT fuses',
|
||||
"Setting up 'Under Construction' sign in Acorn Acres",
|
||||
'Waking Donald Duck',
|
||||
'Teaching new moves to dancing fire hydrants',
|
||||
'Binding Shticker Books',
|
||||
'Analyzing quacks',
|
||||
'Harvesting Jellybean pods',
|
||||
'Emptying fish buckets',
|
||||
'Corralling trashcan trash',
|
||||
'Spreading Cog grease',
|
||||
'Polishing kart trophies',
|
||||
'Balancing scale for weighing 1 Ton weights',
|
||||
'Practicing Victory Dances',
|
||||
'Preparing wackiness',
|
||||
"Giving Mickey Mouse the 'five minutes' sign",
|
||||
'Testing white gloves',
|
||||
'Bending underwater rings',
|
||||
'Spooling red tape',
|
||||
'Freezing Brrrgh ice',
|
||||
'Tuning falling pianos']
|
||||
TIP_NONE = 0
|
||||
TIP_GENERAL = 1
|
||||
TIP_STREET = 2
|
||||
|
|
|
@ -20,7 +20,6 @@ import ToontownGlobals
|
|||
import ToontownLoader
|
||||
from otp.otpbase import OTPBase
|
||||
from otp.otpbase import OTPGlobals
|
||||
from toontown.launcher import ToontownDownloadWatcher
|
||||
from toontown.margins import MarginGlobals
|
||||
from toontown.margins.MarginManager import MarginManager
|
||||
from toontown.nametag import NametagGlobals
|
||||
|
@ -389,18 +388,9 @@ class ToonBase(OTPBase.OTPBase):
|
|||
cell.setActive(active)
|
||||
self.marginManager.reorganize()
|
||||
|
||||
def cleanupDownloadWatcher(self):
|
||||
self.downloadWatcher.cleanup()
|
||||
self.downloadWatcher = None
|
||||
|
||||
def startShow(self, cr, launcherServer = None):
|
||||
self.cr = cr
|
||||
base.graphicsEngine.renderFrame()
|
||||
self.downloadWatcher = ToontownDownloadWatcher.ToontownDownloadWatcher(TTLocalizer.LauncherPhaseNames)
|
||||
if launcher.isDownloadComplete():
|
||||
self.cleanupDownloadWatcher()
|
||||
else:
|
||||
self.acceptOnce('launcherAllPhasesComplete', self.cleanupDownloadWatcher)
|
||||
gameServer = os.environ.get('TTU_GAMESERVER', 'localhost')
|
||||
# Get the base port.
|
||||
serverPort = base.config.GetInt('server-port', 7199)
|
||||
|
|
|
@ -1,192 +0,0 @@
|
|||
from direct.directnotify import DirectNotifyGlobal
|
||||
from direct.gui.DirectGui import *
|
||||
from pandac.PandaModules import TextNode
|
||||
from toontown.toonbase import ToontownGlobals
|
||||
from toontown.toonbase import TTLocalizer
|
||||
from toontown.toontowngui import TTDialog
|
||||
from otp.otpgui.OTPDialog import *
|
||||
from direct.interval.LerpInterval import LerpPosInterval, LerpScaleInterval, LerpFunc
|
||||
from direct.interval.IntervalGlobal import Sequence, Parallel, Func, Wait
|
||||
from direct.task import Task
|
||||
import random
|
||||
|
||||
class ToontownLoadingBlocker(TTDialog.TTDialog):
|
||||
notify = DirectNotifyGlobal.directNotify.newCategory('ToontownLoadingBlocker')
|
||||
|
||||
def __init__(self, avList):
|
||||
if not self.__shouldShowBlocker(avList):
|
||||
return
|
||||
TTDialog.TTDialog.__init__(self)
|
||||
gui = loader.loadModel('phase_3/models/gui/tt_m_gui_pat_mainGui')
|
||||
img = gui.find('**/tt_t_gui_pat_loadingPopup')
|
||||
self['image'] = img
|
||||
self['image_scale'] = (1, 0, 1)
|
||||
self['image_pos'] = (0, 0, -0.4)
|
||||
gui.removeNode()
|
||||
self.loadingTextChangeTimer = 10.0
|
||||
self.loadingTextTimerVariant = 3.0
|
||||
self.loadingTextFreezeTime = 3.0
|
||||
self.toonTipChangeTimer = 20.0
|
||||
self.hideBlockerIval = None
|
||||
self.canChangeLoadingText = True
|
||||
self.__setupLoadingBar()
|
||||
self.__createTitleText()
|
||||
self.__createToonTip()
|
||||
self.__createLoadingText()
|
||||
self.__showBlocker()
|
||||
self.accept('phaseComplete-4', self.__shrinkLoadingBar)
|
||||
self.accept('launcherPercentPhaseComplete', self.__update)
|
||||
return
|
||||
|
||||
def destroy(self):
|
||||
taskMgr.remove('changeLoadingTextTask')
|
||||
taskMgr.remove('canChangeLoadingTextTask')
|
||||
taskMgr.remove('changeToonTipTask')
|
||||
self.ignore('phaseComplete-4')
|
||||
self.ignore('launcherPercentPhaseComplete')
|
||||
self.__cleanupHideBlockerIval()
|
||||
self.title.destroy()
|
||||
self.title = None
|
||||
self.loadingText.destroy()
|
||||
self.loadingText = None
|
||||
self.loadingTextList = None
|
||||
self.toonTipText.destroy()
|
||||
self.toonTipText = None
|
||||
self.bar.destroy()
|
||||
self.bar = None
|
||||
TTDialog.TTDialog.destroy(self)
|
||||
return
|
||||
|
||||
def __hideBlocker(self):
|
||||
self.hide()
|
||||
if self.__isValidDownloadBar():
|
||||
base.downloadWatcher.text.show()
|
||||
|
||||
def __showBlocker(self):
|
||||
self.show()
|
||||
if self.__isValidDownloadBar():
|
||||
base.downloadWatcher.text.hide()
|
||||
|
||||
def __setupLoadingBar(self):
|
||||
self.bar = DirectWaitBar(parent=self, guiId='DownloadBlockerBar', pos=(0, 0, -0.3138), relief=DGG.SUNKEN, frameSize=(-0.6,
|
||||
0.6,
|
||||
-0.1,
|
||||
0.1), borderWidth=(0.02, 0.02), scale=(0.8, 0.8, 0.5), range=100, sortOrder=5000, frameColor=(0.5, 0.5, 0.5, 0.5), barColor=(0.2, 0.7, 0.2, 0.5), text='0%', text_scale=(0.08, 0.128), text_fg=(1, 1, 1, 1), text_align=TextNode.ACenter, text_pos=(0, -0.035))
|
||||
self.bar.setBin('gui-popup', 1)
|
||||
if self.__isValidDownloadBar():
|
||||
base.downloadWatcher.bar.hide()
|
||||
|
||||
def __resetLoadingBar(self):
|
||||
self.bar.clearBin()
|
||||
if self.__isValidDownloadBar():
|
||||
base.downloadWatcher.bar.show()
|
||||
|
||||
def __isValidDownloadBar(self):
|
||||
if hasattr(base, 'downloadWatcher') and base.downloadWatcher:
|
||||
if hasattr(base.downloadWatcher, 'bar') and base.downloadWatcher.bar:
|
||||
return True
|
||||
return False
|
||||
|
||||
def __createTitleText(self):
|
||||
self.title = DirectLabel(parent=self, relief=None, guiId='BlockerTitle', pos=(0, 0, 0.38), text=TTLocalizer.BlockerTitle, text_font=ToontownGlobals.getSignFont(), text_fg=(1, 0.9, 0.1, 1), text_align=TextNode.ACenter, text_scale=0.1, textMayChange=1, sortOrder=50)
|
||||
return
|
||||
|
||||
def __createLoadingText(self):
|
||||
self.loadingText = DirectLabel(parent=self, relief=None, guiId='BlockerLoadingText', pos=(0, 0, -0.2357), text='', text_fg=(1, 1, 1, 1), text_scale=0.055, textMayChange=1, text_align=TextNode.ACenter, sortOrder=50)
|
||||
self.loadingTextList = TTLocalizer.BlockerLoadingTexts
|
||||
self.__changeLoadingText()
|
||||
taskMgr.doMethodLater(self.loadingTextChangeTimer, self.__changeLoadingTextTask, 'changeLoadingTextTask')
|
||||
return
|
||||
|
||||
def __changeLoadingText(self):
|
||||
|
||||
def getLoadingText():
|
||||
listLen = len(self.loadingTextList)
|
||||
if listLen > 0:
|
||||
randomIndex = random.randrange(listLen)
|
||||
randomLoadingText = self.loadingTextList.pop(randomIndex)
|
||||
return randomLoadingText
|
||||
else:
|
||||
self.loadingTextList = TTLocalizer.BlockerLoadingTexts
|
||||
|
||||
if self.canChangeLoadingText:
|
||||
self.loadingText['text'] = getLoadingText()
|
||||
self.canChangeLoadingText = False
|
||||
taskMgr.doMethodLater(self.loadingTextFreezeTime, self.__canChangeLoadingTextTask, 'canChangeLoadingTextTask')
|
||||
|
||||
def __changeLoadingTextTask(self, task):
|
||||
self.__changeLoadingText()
|
||||
randVariation = random.uniform(-self.loadingTextTimerVariant, self.loadingTextTimerVariant)
|
||||
task.delayTime = self.loadingTextChangeTimer + randVariation
|
||||
return task.again
|
||||
|
||||
def __canChangeLoadingTextTask(self, task):
|
||||
self.canChangeLoadingText = True
|
||||
return task.done
|
||||
|
||||
def __createToonTip(self):
|
||||
self.toonTipText = DirectLabel(parent=self, relief=None, guiId='BlockerToonTip', pos=(0, 0, -0.4688), text='', text_fg=(1, 1, 1, 1), text_scale=0.05, textMayChange=1, text_align=TextNode.ACenter, text_wordwrap=32, sortOrder=50)
|
||||
self.__changeToonTip()
|
||||
taskMgr.doMethodLater(self.toonTipChangeTimer, self.__changeToonTipTask, 'changeToonTipTask')
|
||||
return
|
||||
|
||||
def __changeToonTip(self):
|
||||
|
||||
def getTip(tipCategory):
|
||||
return TTLocalizer.TipTitle + '\n' + random.choice(TTLocalizer.TipDict.get(tipCategory))
|
||||
|
||||
self.toonTipText['text'] = getTip(TTLocalizer.TIP_GENERAL)
|
||||
|
||||
def __changeToonTipTask(self, task):
|
||||
self.__changeToonTip()
|
||||
return task.again
|
||||
|
||||
def __shouldShowBlocker(self, avList):
|
||||
|
||||
def hasPlayableToon(avList):
|
||||
if len(avList) > 0:
|
||||
if base.cr.isPaid():
|
||||
return True
|
||||
else:
|
||||
for av in avList:
|
||||
if av.position == 1:
|
||||
return True
|
||||
|
||||
return False
|
||||
|
||||
if hasPlayableToon(avList):
|
||||
if not (base.launcher.getPhaseComplete(3.5) and base.launcher.getPhaseComplete(4)):
|
||||
return True
|
||||
return False
|
||||
|
||||
def __shrinkLoadingBar(self):
|
||||
if self.__isValidDownloadBar():
|
||||
ivalDuration = 0.5
|
||||
barPosIval = LerpPosInterval(self.bar, ivalDuration, (-0.81, 0, -0.96))
|
||||
barScaleIval = LerpScaleInterval(self.bar, ivalDuration, (0.25, 0.25, 0.25))
|
||||
|
||||
def posText(pos):
|
||||
self.bar['text_pos'] = (0, pos)
|
||||
|
||||
def scaleText(scale):
|
||||
self.bar['text_scale'] = (scale, scale)
|
||||
|
||||
textScaleIval = LerpFunc(scaleText, fromData=0.08, toData=0.16, duration=ivalDuration)
|
||||
textPosIval = LerpFunc(posText, fromData=-0.035, toData=-0.05, duration=ivalDuration)
|
||||
shrinkIval = Parallel(barPosIval, barScaleIval, textPosIval, textScaleIval, Func(self.loadingText.hide))
|
||||
self.hideBlockerIval = Sequence(shrinkIval, Wait(0.5), Func(self.__hideBlocker), Func(self.__resetLoadingBar), Func(self.destroy))
|
||||
self.hideBlockerIval.start()
|
||||
|
||||
def __cleanupHideBlockerIval(self):
|
||||
if self.hideBlockerIval:
|
||||
self.hideBlockerIval.finish()
|
||||
self.hideBlockerIval = None
|
||||
return
|
||||
|
||||
def __update(self, phase, percent, reqByteRate, actualByteRate):
|
||||
if self.__isValidDownloadBar():
|
||||
percent = base.downloadWatcher.bar['value']
|
||||
self.bar['text'] = '%s %%' % percent
|
||||
self.bar['value'] = percent
|
||||
if percent == 0:
|
||||
self.__changeLoadingText()
|
Loading…
Reference in a new issue