Closet clothing count display

This commit is contained in:
John 2015-08-28 13:38:36 +03:00
parent 99083861c3
commit c9e0f0deac
7 changed files with 32 additions and 46 deletions

View file

@ -2048,7 +2048,6 @@ dclass DistributedCloset : DistributedFurnitureItem {
setDNA(blob, int8, uint8) airecv clsend;
setState(uint8, uint32, uint32, string, uint8[], uint8[]) broadcast ram;
setMovie(uint8, uint32, int16) broadcast ram;
resetItemLists() broadcast ram;
setCustomerDNA(uint32, blob) broadcast ram;
};

View file

@ -28,21 +28,23 @@ class ClosetGUI(ClothesGUI.ClothesGUI):
self.gui = loader.loadModel('phase_3/models/gui/create_a_toon_gui')
self.cancelButton = DirectButton(relief=None, image=(self.gui.find('**/CrtAtoon_Btn2_UP'), self.gui.find('**/CrtAtoon_Btn2_DOWN'), self.gui.find('**/CrtAtoon_Btn2_RLLVR')), pos=(0.15, 0, -0.85), command=self.__handleCancel, text=('', TTLocalizer.MakeAToonCancel, TTLocalizer.MakeAToonCancel), text_font=ToontownGlobals.getInterfaceFont(), text_scale=0.08, text_pos=(0, -0.03), text_fg=(1, 1, 1, 1), text_shadow=(0, 0, 0, 1))
self.cancelButton.hide()
self.countFrame = DirectFrame(parent=self.parentFrame, image=self.shuffleFrame, image_scale=(-0.6, 0.6, 0.6), relief=None, pos=(0, 0, -0.125), scale=1.2, frameColor=(1, 1, 1, 1), text=TTLocalizer.ClothesGUICount % (0, 0), text_scale=0.0575, text_pos=(-0.001, -0.015), text_fg=(1, 1, 1, 1))
if self.isOwner:
trashcanGui = loader.loadModel('phase_3/models/gui/trashcan_gui.bam')
trashcanGui = loader.loadModel('phase_3/models/gui/trashcan_gui')
trashImage = (trashcanGui.find('**/TrashCan_CLSD'), trashcanGui.find('**/TrashCan_OPEN'), trashcanGui.find('**/TrashCan_RLVR'))
self.trashPanel = DirectFrame(parent=aspect2d, image=DGG.getDefaultDialogGeom(), image_color=(1, 1, 0.75, 0.8), image_scale=(0.36, 0, 0.75), pos=(-.86, 0, -.05), relief=None)
self.topTrashButton = DirectButton(parent=self.trashPanel, image=trashImage, relief=None, pos=(-0.09, 0, 0.2), command=self.__handleDelete, extraArgs=[ClosetGlobals.SHIRT], scale=(0.5, 0.5, 0.5), text=TTLocalizer.ClosetDeleteShirt, text_font=ToontownGlobals.getInterfaceFont(), text_scale=0.12, text_pos=(0.3, 0), text_fg=(0.8, 0.2, 0.2, 1), text_shadow=(0, 0, 0, 1), textMayChange=0)
self.bottomTrashButton = DirectButton(parent=self.trashPanel, image=trashImage, relief=None, textMayChange=1, pos=(-0.09, 0, -0.2), command=self.__handleDelete, extraArgs=[ClosetGlobals.SHORTS], scale=(0.5, 0.5, 0.5), text=TTLocalizer.ClosetDeleteShorts, text_font=ToontownGlobals.getInterfaceFont(), text_scale=0.12, text_pos=(0.3, 0), text_fg=(0.8, 0.2, 0.2, 1), text_shadow=(0, 0, 0, 1))
self.button = DirectButton(relief=None, image=(self.gui.find('**/CrtAtoon_Btn1_UP'), self.gui.find('**/CrtAtoon_Btn1_DOWN'), self.gui.find('**/CrtAtoon_Btn1_RLLVR')), pos=(-0.15, 0, -0.85), command=self.__handleButton, text=('', TTLocalizer.MakeAToonDone, TTLocalizer.MakeAToonDone), text_font=ToontownGlobals.getInterfaceFont(), text_scale=0.08, text_pos=(0, -0.03), text_fg=(1, 1, 1, 1), text_shadow=(0, 0, 0, 1))
trashcanGui.removeNode()
return
def unload(self):
self.ignore('verifyDone')
ClothesGUI.ClothesGUI.unload(self)
self.cancelButton.destroy()
del self.cancelButton
self.countFrame.destroy()
del self.countFrame
if self.isOwner:
self.topTrashButton.destroy()
self.bottomTrashButton.destroy()
@ -108,7 +110,9 @@ class ClosetGUI(ClothesGUI.ClothesGUI):
if self.isOwner:
self.updateTrashButtons()
self.setupButtons()
return
def updateCount(self, clothes, maxClothes):
self.countFrame['text'] = TTLocalizer.ClothesGUICount % (clothes, maxClothes)
def updateTrashButtons(self):
if len(self.tops) < 2:

View file

@ -13,6 +13,7 @@ from direct.task.Task import Task
import ClosetGlobals
import DistributedFurnitureItem
from toontown.toonbase import TTLocalizer
from toontown.catalog import CatalogFurnitureItem
class DistributedCloset(DistributedFurnitureItem.DistributedFurnitureItem):
notify = directNotify.newCategory('DistributedCloset')
@ -237,6 +238,7 @@ class DistributedCloset(DistributedFurnitureItem.DistributedFurnitureItem):
if not self.closetGUI:
self.closetGUI = ClosetGUI.ClosetGUI(self.isOwner, self.purchaseDoneEvent, self.cancelEvent, self.swapEvent, self.deleteEvent, self.topList, self.botList)
self.closetGUI.load()
self.updateCount()
if self.gender != self.ownerGender:
self.closetGUI.setGender(self.ownerGender)
self.closetGUI.enter(base.localAvatar)
@ -317,17 +319,10 @@ class DistributedCloset(DistributedFurnitureItem.DistributedFurnitureItem):
self.sendUpdate('removeItem', [trashItem, t_or_b])
swapFunc(0)
self.closetGUI.updateTrashButtons()
self.updateCount()
else:
self.notify.warning("cant delete this item(type = %s), since we don't have a replacement" % t_or_b)
def resetItemLists(self):
self.topList = self.oldTopList[0:]
self.botList = self.oldBotList[0:]
self.closetGUI.tops = self.topList
self.closetGUI.bottoms = self.botList
self.topDeleted = 0
self.bottomDeleted = 0
def __proceedToCheckout(self):
if self.topDeleted or self.bottomDeleted:
self.__popupAreYouSurePanel()
@ -360,7 +355,11 @@ class DistributedCloset(DistributedFurnitureItem.DistributedFurnitureItem):
self.av.swapToonTorso(self.av.style.torso, genClothes=0)
self.av.loop('neutral', 0)
self.av.generateToonClothes()
return
def updateCount(self):
maxClothes = CatalogFurnitureItem.ClosetToClothes.get(self.item.furnitureType)
clothes = int(len(self.topList) / 4) + int(len(self.botList) / 2)
self.closetGUI.updateCount(clothes, maxClothes)
def printInfo(self):
print 'avid: %s, gender: %s' % (self.av.doId, self.av.style.gender)
@ -425,7 +424,6 @@ class DistributedCloset(DistributedFurnitureItem.DistributedFurnitureItem):
DirectButton(self.popupInfo, image=okButtonImage, relief=None, text=TTLocalizer.ClosetPopupOK, text_scale=0.05, text_pos=(0.0, -0.1), textMayChange=0, pos=(0.0, 0.0, -0.16), command=self.__handleTimeoutMessageOK)
buttons.removeNode()
self.popupInfo.reparentTo(aspect2d)
return
def __handleTimeoutMessageOK(self):
self.popupInfo.reparentTo(hidden)

View file

@ -206,8 +206,5 @@ class DistributedClosetAI(DistributedFurnitureItemAI):
def setMovie(self, todo0, todo1, todo2):
pass
def resetItemLists(self):
pass
def setCustomerDNA(self, todo0, todo1):
pass

View file

@ -231,20 +231,6 @@ class DistributedTrunk(DistributedCloset.DistributedCloset):
else:
self.notify.warning("cant delete this item(type = %s), since we don't have a replacement" % which)
def resetItemLists(self):
self.hatList = self.oldHatList[0:]
self.glassesList = self.oldGlassesList[0:]
self.backpackList = self.oldBackpackList[0:]
self.shoesList = self.oldShoesList[0:]
self.closetGUI.hat = self.hatList
self.closetGUI.glasses = self.glassesList
self.closetGUI.backpack = self.backpackList
self.closetGUI.shoes = self.shoesList
self.hatDeleted = 0
self.glassesDeleted = 0
self.backpackDeleted = 0
self.shoesDeleted = 0
def __proceedToCheckout(self):
if self.hatDeleted or self.glassesDeleted or self.backpackDeleted or self.shoesDeleted:
self.__popupAreYouSurePanel()

View file

@ -25,20 +25,20 @@ class ClothesGUI(StateData.StateData):
return
def load(self):
self.gui = loader.loadModel('phase_3/models/gui/tt_m_gui_mat_mainGui')
guiRArrowUp = self.gui.find('**/tt_t_gui_mat_arrowUp')
guiRArrowRollover = self.gui.find('**/tt_t_gui_mat_arrowUp')
guiRArrowDown = self.gui.find('**/tt_t_gui_mat_arrowDown')
guiRArrowDisabled = self.gui.find('**/tt_t_gui_mat_arrowDisabled')
shuffleFrame = self.gui.find('**/tt_t_gui_mat_shuffleFrame')
shuffleArrowUp = self.gui.find('**/tt_t_gui_mat_shuffleArrowUp')
shuffleArrowDown = self.gui.find('**/tt_t_gui_mat_shuffleArrowDown')
shuffleArrowRollover = self.gui.find('**/tt_t_gui_mat_shuffleArrowUp')
shuffleArrowDisabled = self.gui.find('**/tt_t_gui_mat_shuffleArrowDisabled')
self.matGui = loader.loadModel('phase_3/models/gui/tt_m_gui_mat_mainGui')
guiRArrowUp = self.matGui.find('**/tt_t_gui_mat_arrowUp')
guiRArrowRollover = self.matGui.find('**/tt_t_gui_mat_arrowUp')
guiRArrowDown = self.matGui.find('**/tt_t_gui_mat_arrowDown')
guiRArrowDisabled = self.matGui.find('**/tt_t_gui_mat_arrowDisabled')
self.shuffleFrame = self.matGui.find('**/tt_t_gui_mat_shuffleFrame')
shuffleArrowUp = self.matGui.find('**/tt_t_gui_mat_shuffleArrowUp')
shuffleArrowDown = self.matGui.find('**/tt_t_gui_mat_shuffleArrowDown')
shuffleArrowRollover = self.matGui.find('**/tt_t_gui_mat_shuffleArrowUp')
shuffleArrowDisabled = self.matGui.find('**/tt_t_gui_mat_shuffleArrowDisabled')
self.parentFrame = DirectFrame(relief=DGG.RAISED, pos=(0.98, 0, 0.416), frameColor=(1, 0, 0, 0))
self.parentFrame.setPos(-0.36, 0, -0.5)
self.parentFrame.reparentTo(base.a2dTopRight)
self.shirtFrame = DirectFrame(parent=self.parentFrame, image=shuffleFrame, image_scale=halfButtonInvertScale, relief=None, pos=(0, 0, -0.4), hpr=(0, 0, 3), scale=1.2, frameColor=(1, 1, 1, 1), text=TTLocalizer.ClothesShopShirt, text_scale=0.0575, text_pos=(-0.001, -0.015), text_fg=(1, 1, 1, 1))
self.shirtFrame = DirectFrame(parent=self.parentFrame, image=self.shuffleFrame, image_scale=halfButtonInvertScale, relief=None, pos=(0, 0, -0.4), hpr=(0, 0, 3), scale=1.2, frameColor=(1, 1, 1, 1), text=TTLocalizer.ClothesShopShirt, text_scale=0.0575, text_pos=(-0.001, -0.015), text_fg=(1, 1, 1, 1))
self.topLButton = DirectButton(parent=self.shirtFrame, relief=None, image=(shuffleArrowUp,
shuffleArrowDown,
shuffleArrowRollover,
@ -47,7 +47,7 @@ class ClothesGUI(StateData.StateData):
shuffleArrowDown,
shuffleArrowRollover,
shuffleArrowDisabled), image_scale=halfButtonInvertScale, image1_scale=halfButtonInvertHoverScale, image2_scale=halfButtonInvertHoverScale, pos=(0.2, 0, 0), command=self.swapTop, extraArgs=[1])
self.bottomFrame = DirectFrame(parent=self.parentFrame, image=shuffleFrame, image_scale=halfButtonInvertScale, relief=None, pos=(0, 0, -0.65), hpr=(0, 0, -2), scale=1.2, frameColor=(1, 1, 1, 1), text=TTLocalizer.ColorShopToon, text_scale=0.0575, text_pos=(-0.001, -0.015), text_fg=(1, 1, 1, 1))
self.bottomFrame = DirectFrame(parent=self.parentFrame, image=self.shuffleFrame, image_scale=halfButtonInvertScale, relief=None, pos=(0, 0, -0.65), hpr=(0, 0, -2), scale=1.2, frameColor=(1, 1, 1, 1), text=TTLocalizer.ColorShopToon, text_scale=0.0575, text_pos=(-0.001, -0.015), text_fg=(1, 1, 1, 1))
self.bottomLButton = DirectButton(parent=self.bottomFrame, relief=None, image=(shuffleArrowUp,
shuffleArrowDown,
shuffleArrowRollover,
@ -59,11 +59,10 @@ class ClothesGUI(StateData.StateData):
self.parentFrame.hide()
self.shuffleFetchMsg = 'ClothesShopShuffle'
self.shuffleButton = ShuffleButton.ShuffleButton(self, self.shuffleFetchMsg)
return
def unload(self):
self.gui.removeNode()
del self.gui
self.matGui.removeNode()
del self.matGui
self.parentFrame.destroy()
self.shirtFrame.destroy()
self.bottomFrame.destroy()
@ -71,6 +70,7 @@ class ClothesGUI(StateData.StateData):
self.topRButton.destroy()
self.bottomLButton.destroy()
self.bottomRButton.destroy()
del self.shuffleFrame
del self.parentFrame
del self.shirtFrame
del self.bottomFrame

View file

@ -8752,6 +8752,8 @@ TeleportPanelNoTeleport = '%s needs some time alone right now.'
InventoryDeleteAll = 'DELETE ALL'
InventoryDeleteConfirm = "Are you sure you want to delete all your gags? Don't worry, your level 7 gags are safe!"
ClothesGUICount = '%s/%s'
Blacklist = [
"$1ut",
"$h1t",