Gag popup on hover

This commit is contained in:
John 2015-08-04 03:18:12 +03:00
parent 1b6c2c0176
commit a4c9d2957c
2 changed files with 19 additions and 4 deletions

View file

@ -10,7 +10,7 @@ from toontown.friends import FriendInviter
import ToonTeleportPanel import ToonTeleportPanel
from toontown.toonbase import TTLocalizer from toontown.toonbase import TTLocalizer
from toontown.hood import ZoneUtil from toontown.hood import ZoneUtil
from toontown.toonbase.ToontownBattleGlobals import Tracks, Levels from toontown.toonbase.ToontownBattleGlobals import Tracks, Levels, getAvPropDamage
from toontown.toon import Toon from toontown.toon import Toon
globalAvatarDetail = None globalAvatarDetail = None
@ -192,6 +192,9 @@ class ToonAvatarDetailPanel(DirectFrame):
ySpacing = -0.115 ySpacing = -0.115
inventory = self.avatar.inventory inventory = self.avatar.inventory
inventoryModels = loader.loadModel('phase_3.5/models/gui/inventory_gui') inventoryModels = loader.loadModel('phase_3.5/models/gui/inventory_gui')
rolloverFrame = DirectFrame(parent=self, relief=None, geom=DGG.getDefaultDialogGeom(), geom_color=(0, 0.5, 1, 1), geom_scale=(0.5, 0.3, 0.2), text_scale=0.05, text_pos=(0, 0.0125), text='', text_fg=(1, 1, 1, 1))
rolloverFrame.setBin('gui-popup', 0)
rolloverFrame.hide()
buttonModel = inventoryModels.find('**/InventoryButtonUp') buttonModel = inventoryModels.find('**/InventoryButtonUp')
for track in xrange(0, len(Tracks)): for track in xrange(0, len(Tracks)):
DirectLabel(parent=self, relief=None, text=TextEncoder.upper(TTLocalizer.BattleGlobalTracks[track]), text_scale=TTLocalizer.TADPtrackLabel, text_align=TextNode.ALeft, pos=(-0.9, 0, TTLocalizer.TADtrackLabelPosZ + track * ySpacing)) DirectLabel(parent=self, relief=None, text=TextEncoder.upper(TTLocalizer.BattleGlobalTracks[track]), text_scale=TTLocalizer.TADPtrackLabel, text_align=TextNode.ALeft, pos=(-0.9, 0, TTLocalizer.TADtrackLabelPosZ + track * ySpacing))
@ -201,20 +204,30 @@ class ToonAvatarDetailPanel(DirectFrame):
level = Levels[track][item] level = Levels[track][item]
if curExp >= level: if curExp >= level:
numItems = inventory.numItem(track, item) numItems = inventory.numItem(track, item)
organic = self.avatar.checkGagBonus(track, item)
if numItems == 0: if numItems == 0:
image_color = Vec4(0.5, 0.5, 0.5, 1) image_color = Vec4(0.5, 0.5, 0.5, 1)
geom_color = Vec4(0.2, 0.2, 0.2, 0.5) geom_color = Vec4(0.2, 0.2, 0.2, 0.5)
elif self.avatar.getTrackBonusLevel(track) >= item: elif organic:
image_color = Vec4(0, 0.8, 0.4, 1) image_color = Vec4(0, 0.8, 0.4, 1)
geom_color = None geom_color = None
else: else:
image_color = Vec4(0, 0.6, 1, 1) image_color = Vec4(0, 0.6, 1, 1)
geom_color = None geom_color = None
DirectLabel(parent=self, image=buttonModel, image_scale=(0.92, 1, 1), image_color=image_color, geom=inventory.invModels[track][item], geom_color=geom_color, geom_scale=0.6, relief=None, pos=(xOffset + item * xSpacing, 0, yOffset + track * ySpacing)) pos = (xOffset + item * xSpacing, 0, yOffset + track * ySpacing)
label = DirectLabel(parent=self, image=buttonModel, image_scale=(0.92, 1, 1), image_color=image_color, geom=inventory.invModels[track][item], geom_color=geom_color, geom_scale=0.6, relief=None, pos=pos, state=DGG.NORMAL)
label.bind(DGG.ENTER, self.showInfo, extraArgs=[rolloverFrame, track, int(getAvPropDamage(track, item, curExp, organic)), numItems, (pos[0] + 0.37, pos[1], pos[2])])
label.bind(DGG.EXIT, self.hideInfo, extraArgs=[rolloverFrame])
else: else:
break break
return def showInfo(self, frame, track, damage, numItems, pos, extra):
frame.setPos(*pos)
frame.show()
frame['text'] = TTLocalizer.GagPopup % (self.avatar.inventory.getToonupDmgStr(track, 0), damage, numItems)
def hideInfo(self, frame, extra):
frame.hide()
def __updateTrophyInfo(self): def __updateTrophyInfo(self):
if self.createdAvatar: if self.createdAvatar:

View file

@ -8724,6 +8724,8 @@ TVChooseVideo = 'Choose a video to play!'
TVOK = 'The video you selected is now playing!' TVOK = 'The video you selected is now playing!'
TVPacks = ['QuackityHQ'] TVPacks = ['QuackityHQ']
GagPopup = '%s: %s\nGags: %s'
Blacklist = [ Blacklist = [
"$1ut", "$1ut",
"$h1t", "$h1t",