Cog hover panel improvements

This commit is contained in:
John 2015-08-27 13:13:37 +03:00
parent 1c01fddd82
commit 3a5e708396
5 changed files with 59 additions and 15 deletions

View file

@ -336,9 +336,12 @@ class SuitPage(ShtikerPage.ShtikerPage):
yStart = -0.18
xOffset = 0.199
yOffset = 0.284
self.rolloverFrame = DirectFrame(parent=self.panelNode, relief=None, geom=DGG.getDefaultDialogGeom(), geom_color=(0.5, 0.5, 0.5, 1), geom_scale=(0.8, 0, 0.77), text_scale=0.06, text_pos=(0, 0.32), text='', text_fg=(1, 1, 1, 1), pos=(0.44, 0, 0))
gui = loader.loadModel('phase_3.5/models/gui/suit_detail_panel')
gui.find('**/avatar_panel/shadow').setColor(1, 1, 1, 0.5)
self.rolloverFrame = DirectFrame(parent=self.panelNode, relief=None, geom=gui.find('**/avatar_panel'), geom_color=(0.5, 0.5, 0.5, 1), geom_scale=(0.59, 0, 0.21), text_scale=0.06, text_pos=(0, 0.35), text='', text_fg=(1, 1, 1, 1), text_font=ToontownGlobals.getSuitFont(), pos=(0.8, 0, 0))
self.rolloverFrame.setBin('gui-popup', 0)
self.rolloverFrame.hide()
gui.removeNode()
for dept in xrange(0, len(SuitDNA.suitDepts)):
row = []
color = PANEL_COLORS[dept]
@ -419,7 +422,6 @@ class SuitPage(ShtikerPage.ShtikerPage):
index = self.panels.index(panel)
if not base.localAvatar.hasCogSummons(index):
panel.summonButton.hide()
return
def addBuildingRadarLabel(self, button):
gui = loader.loadModel('phase_3.5/models/gui/suit_detail_panel')
@ -427,7 +429,6 @@ class SuitPage(ShtikerPage.ShtikerPage):
buildingRadarLabel = DirectLabel(parent=button, relief=None, pos=(0.225, 0.0, zPos), state=DGG.DISABLED, image=gui.find('**/avatar_panel'), image_hpr=(0, 0, 90), image_scale=(0.05, 1, 0.1), image_pos=(0, 0, 0.015), text=TTLocalizer.SuitPageBuildingRadarP % '0', text_scale=0.05, text_fg=(1, 0, 0, 1), text_font=ToontownGlobals.getSuitFont())
gui.removeNode()
button.buildingRadarLabel = buildingRadarLabel
return
def resetPanel(self, dept, type):
panel = self.panels[dept * SuitDNA.suitsPerDept + type]
@ -602,4 +603,3 @@ class SuitPage(ShtikerPage.ShtikerPage):
taskMgr.doMethodLater(RADAR_DELAY * SuitDNA.suitsPerDept, showLabel, 'showBuildingRadarLater', extraArgs=(button,))
else:
button.buildingRadarLabel.hide()
return

View file

@ -6,7 +6,7 @@ RPskipScale = 0.2
RPskipPos = (0, -.28)
RPmeritLabelPosX = 0.55
RPmeritBarsPosX = 0.825
BBbattleInputTimeout = 20.0
BBbattleInputTimeout = 999.0
FCPtextFrame = 0.08
DHQInamePath = 0.9
DHQInamePathPos = (-4, 0, 0)
@ -298,3 +298,33 @@ SellbotFactoryPosPart1 = (0, -0.25)
SellbotFactoryScalePart1 = 0.075
SellbotFactoryPosPart2 = (0, -0.34)
SellbotFactoryScalePart2 = 0.12
BattleHoverCog = 0
BattleHoverGag = 1
BattleHoverSos = 2
BattleHoverAttributes = {
BattleHoverCog: {
'geom_scale': (0.4, 0, 0.18),
'text_pos': (0, 0.29),
'geom_color': (0.5, 0.5, 0.5, 1),
'pos': (0.6, 0, 0.05),
'text_fg': (1, 1, 1, 1),
'suit': True
},
BattleHoverGag: {
'geom_scale': (0.5, 0, 0.2),
'text_pos': (0, 0.0125),
'geom_color': (0.6, 1.0, 0.4, 1),
'pos': (0.4, 0, 0),
'text_fg': (0, 0, 0, 1),
'suit': False
},
BattleHoverSos: {
'geom_scale': (0.5, 0, 0.3),
'text_pos': (0, 0.08),
'geom_color': (0.6, 1.0, 0.4, 1),
'pos': (0.4, 0, 0.1),
'text_fg': (0, 0, 0, 1),
'suit': False
}
}

View file

@ -14,9 +14,8 @@ import TownBattleCogPanel
from toontown.toontowngui import TTDialog
from direct.directnotify import DirectNotifyGlobal
from toontown.battle import BattleBase
from toontown.toonbase import ToontownTimer
from direct.showbase import PythonUtil
from toontown.toonbase import TTLocalizer
from toontown.toonbase import TTLocalizer, ToontownGlobals, ToontownTimer
from toontown.pets import PetConstants
from direct.gui.DirectGui import *
from toontown.battle import FireCogPanel
@ -125,6 +124,8 @@ class TownBattle(StateData.StateData):
self.rolloverFrame = DirectFrame(aspect2d, relief=None, geom=DGG.getDefaultDialogGeom(), geom_color=(0.6, 1.0, 0.4, 1), geom_scale=(0.5, 0.3, 0.2), text_scale=0.05, text_pos=(0, 0.0125), text='', text_fg=(0, 0, 0, 1), pos=(0.4, 0, 0))
self.rolloverFrame.setBin('gui-popup', 0)
self.rolloverFrame.hide()
self.suitGui = loader.loadModel('phase_3.5/models/gui/suit_detail_panel')
self.suitGui.find('**/avatar_panel/shadow').setColor(1, 1, 1, 0.5)
self.toonPanels = [TownBattleToonPanel.TownBattleToonPanel(self) for i in xrange(4)]
self.cogPanels = [TownBattleCogPanel.TownBattleCogPanel(self) for i in xrange(4)]
self.timer = ToontownTimer.ToontownTimer()
@ -154,6 +155,8 @@ class TownBattle(StateData.StateData):
del self.toonPanels
del self.cogPanels
self.timer.destroy()
self.suitGui.removeNode()
del self.suitGui
del self.timer
del self.toons
@ -219,11 +222,22 @@ class TownBattle(StateData.StateData):
self.timer.setTime(time)
return None
def showRolloverFrame(self, parent, scale, textPos, color, pos, text, extra=None):
self.rolloverFrame['geom_scale'] = scale
self.rolloverFrame['text_pos'] = textPos
self.rolloverFrame['geom_color'] = color
self.rolloverFrame.setPos(pos)
def showRolloverFrame(self, parent, type, text, extra=None):
dict = TTLocalizer.BattleHoverAttributes[type]
for key, value in dict.iteritems():
if key == 'pos':
self.rolloverFrame.setPos(value)
elif key == 'suit':
if value:
self.rolloverFrame['text_font'] = ToontownGlobals.getSuitFont()
self.rolloverFrame['geom'] = self.suitGui.find('**/avatar_panel')
else:
self.rolloverFrame['text_font'] = ToontownGlobals.getInterfaceFont()
self.rolloverFrame['geom'] = DGG.getDefaultDialogGeom()
else:
self.rolloverFrame[key] = value
self.rolloverFrame.reparentTo(parent)
self.rolloverFrame.show()
self.rolloverFrame['text'] = text

View file

@ -67,7 +67,7 @@ class TownBattleCogPanel(DirectFrame):
if TTLocalizer.BattleCogPopupDangerColor in info:
info = TTLocalizer.BattleCogPopupDanger + info
self.hoverButton.bind(DGG.ENTER, self.battle.showRolloverFrame, extraArgs=[self, (0.73, 0, 0.65), (0, 0.26), (0.5, 0.5, 0.5, 1), (0.6, 0, 0.1), info])
self.hoverButton.bind(DGG.ENTER, self.battle.showRolloverFrame, extraArgs=[self, TTLocalizer.BattleHoverCog, info])
def getAttackStrings(self, attacks, level):
attackStrings = []

View file

@ -136,7 +136,7 @@ class TownBattleToonPanel(DirectFrame):
sosType = TextEncoder.upper(sosType)
count = max(0, self.avatar.getNPCFriendCount(targetIndex) - 1)
info = TTLocalizer.BattleSOSPopup % (sosType, NPCToons.getNPCName(targetIndex), hpString if hp else '', rarity, count)
self.hoverButton.bind(DGG.ENTER, self.battle.showRolloverFrame, extraArgs=[self, (0.5, 0.3, 0.3), (0, 0.08), (0.6, 1.0, 0.4, 1), (0.4, 0, 0.1), info])
self.hoverButton.bind(DGG.ENTER, self.battle.showRolloverFrame, extraArgs=[self, TTLocalizer.BattleHoverSos, info])
elif track == BattleBase.SOS or track == BattleBase.PETSOS:
self.sosText.show()
elif track >= MIN_TRACK_INDEX and track <= MAX_TRACK_INDEX:
@ -154,7 +154,7 @@ class TownBattleToonPanel(DirectFrame):
damage = int(getAvPropDamage(track, level, curExp, organic))
numItems = max(0, self.avatar.inventory.numItem(track, level) - 1)
info = TTLocalizer.BattleGagPopup % (self.avatar.inventory.getToonupDmgStr(track, 0), damage, numItems)
self.hoverButton.bind(DGG.ENTER, self.battle.showRolloverFrame, extraArgs=[self, (0.5, 0.3, 0.2), (0, 0.0125), (0.6, 1.0, 0.4, 1), (0.4, 0, 0), info])
self.hoverButton.bind(DGG.ENTER, self.battle.showRolloverFrame, extraArgs=[self, TTLocalizer.BattleHoverGag, info])
if self.avatar.checkGagBonus(track, level):
self.gag.setColor((1, 0, 0, 1) if track == 1 and level == 5 else (0, 1, 0, 1))