Cleanup Voltage's last commit.

This commit is contained in:
John Cote 2015-04-29 19:16:59 -04:00
parent 47bfb6210c
commit a226523ef2
2 changed files with 11 additions and 63 deletions

View file

@ -41,7 +41,7 @@ class TrackShop(StateData.StateData):
def load(self):
if self.loaded:
return
self.loaded = True
self.questGui = loader.loadModel('phase_3.5/models/gui/stickerbook_gui')
self.inventoryGui = loader.loadModel('phase_3.5/models/gui/inventory_icons')
@ -55,19 +55,19 @@ class TrackShop(StateData.StateData):
self.label = DirectLabel(aspect2d, relief=None, text=TTLocalizer.PickTrackNotice,
text_fg=(0, 1, 0, 1), text_scale=0.12, text_font=ToontownGlobals.getToonFont(),
pos=(-0.62, 0, 0.45), text_shadow=(0, 0.392, 0, 1))
self.leftButton = DirectButton(aspect2d, relief=None, image=(self.shuffleArrowUp, self.shuffleArrowDown),
pos=(-1.2, 0, -0.05), command=self.handleSetIndex, extraArgs=[-1])
self.rightButton = DirectButton(aspect2d, relief=None, image=(self.shuffleArrowUp, self.shuffleArrowDown),
pos=(-0.05, 0, -0.05), scale=-1, command=self.handleSetIndex, extraArgs=[1])
self.track = DirectLabel(aspect2d, relief=None, text='',
text_scale=0.11, text_font=ToontownGlobals.getSignFont(),
pos=(-0.64, 0, -0.08), text_shadow=(1, 1, 1, 1))
self.icon = DirectFrame(aspect2d, relief=None, pos=(-0.65, 0, -0.3), image_scale=1.5)
self.updateGuiByIndex()
def unload(self):
@ -75,27 +75,27 @@ class TrackShop(StateData.StateData):
if element:
element.destroy()
del element
self.index = 0
self.loaded = False
def handleSetIndex(self, offset):
newIndex = self.index + offset
if newIndex == 4:
self.index = 6
elif newIndex == 5:
self.index = 3
elif newIndex > -1 and newIndex < len(ToontownGlobals.PropIdToColor):
self.index = newIndex
self.updateGuiByIndex()
def updateGuiByIndex(self):
self.track['text'] = TTLocalizer.PropIdToName[self.index]
self.track['text_fg'] = ToontownGlobals.PropIdToColor[self.index]
self.icon['image'] = self.inventoryGui.find('**/' + AvPropsNew[self.index][0])
def __handleForward(self):
self.doneStatus = 'next'
messenger.send(self.doneEvent)

View file

@ -1,52 +0,0 @@
diff a/toontown/makeatoon/TrackShop.py b/toontown/makeatoon/TrackShop.py (rejected hunks)
@@ -1,38 +1,35 @@
from pandac.PandaModules import *
+from panda3d.core import NodePath, ModelNode
from direct.fsm import StateData
from direct.gui.DirectGui import *
from toontown.toonbase import TTLocalizer, ToontownGlobals
from direct.directnotify import DirectNotifyGlobal
-from toontown.toonbase.ToontownBattleGlobals import AvPropsNew
+from toontown.toonbase import ToontownBattleGlobals
class TrackShop(StateData.StateData):
notify = DirectNotifyGlobal.directNotify.newCategory('TrackShop')
def __init__(self, doneEvent):
StateData.StateData.__init__(self, doneEvent)
- self.quest = None
- self.label = None
- self.leftButton = None
- self.rightButton = None
- self.track = None
- self.icon = None
self.loaded = False
self.index = 0
+ self.buttonPath = None
+ self.curTrackLabel = None
return
+ def showButtons(self):
+ self.buttonPath.show()
+ self.curTrackLabel.show()
+
+ def hideButtons(self):
+ self.buttonPath.hide()
+ self.curTrackLabel.hide()
+
def enter(self):
base.disableMouse()
self.acceptOnce('last', self.__handleBackward)
self.acceptOnce('next', self.__handleForward)
- def showButtons(self):
- for element in [self.quest, self.label, self.leftButton, self.rightButton, self.track, self.icon]:
- element.show()
-
- def hideButtons(self):
- for element in [self.quest, self.label, self.leftButton, self.rightButton, self.track, self.icon]:
- element.hide()
-
def exit(self):
self.ignore('last')
self.ignore('next')