SOS page in detail panel

This commit is contained in:
John 2015-08-17 15:55:43 +03:00
parent 81f6895954
commit 2e744ba51f
5 changed files with 55 additions and 10 deletions

View file

@ -3202,7 +3202,7 @@ dclass TTSFriendsManager : DistributedObjectGlobal {
goingOffline(uint32 avId); goingOffline(uint32 avId);
getAvatarDetails(uint32) clsend; getAvatarDetails(uint32) clsend;
friendDetails(uint32, blob, uint16[], int16, int16, uint32, uint32, blob, blob, int8[]); friendDetails(uint32, blob, uint16[], int16, int16, uint32, uint32, blob, blob, int8[], FriendEntry[]);
getPetDetails(uint32) clsend; getPetDetails(uint32) clsend;
petDetails(uint32, uint32, string, uint32, uint32, uint16/1000[], PetTrait[], int8[], uint32); petDetails(uint32, uint32, string, uint32, uint32, uint16/1000[], PetTrait[], int8[], uint32);

View file

@ -27,7 +27,7 @@ class TTSFriendsManager(DistributedObjectGlobal):
def d_getAvatarDetails(self, avId): def d_getAvatarDetails(self, avId):
self.sendUpdate('getAvatarDetails', [avId]) self.sendUpdate('getAvatarDetails', [avId])
def friendDetails(self, avId, inventory, trackAccess, hp, maxHp, defaultShard, lastHood, dnaString, experience, trackBonusLevel): def friendDetails(self, avId, inventory, trackAccess, hp, maxHp, defaultShard, lastHood, dnaString, experience, trackBonusLevel, npcFriends):
fields = [ fields = [
['setExperience' , experience], ['setExperience' , experience],
['setTrackAccess' , trackAccess], ['setTrackAccess' , trackAccess],
@ -38,6 +38,7 @@ class TTSFriendsManager(DistributedObjectGlobal):
['setDefaultShard' , defaultShard], ['setDefaultShard' , defaultShard],
['setLastHood' , lastHood], ['setLastHood' , lastHood],
['setDNAString' , dnaString], ['setDNAString' , dnaString],
['setNPCFriendsDict', npcFriends]
] ]
base.cr.n_handleGetAvatarDetailsResp(avId, fields=fields) base.cr.n_handleGetAvatarDetailsResp(avId, fields=fields)

View file

@ -198,8 +198,9 @@ class TTSFriendsManagerUD(DistributedObjectGlobalUD):
dnaString = fields['setDNAString'][0] dnaString = fields['setDNAString'][0]
experience = fields['setExperience'][0] experience = fields['setExperience'][0]
trackBonusLevel = fields['setTrackBonusLevel'][0] trackBonusLevel = fields['setTrackBonusLevel'][0]
npcFriends = fields['setNPCFriendsDict'][0]
self.sendUpdateToAvatarId(senderId, 'friendDetails', [avId, inventory, trackAccess, hp, maxHp, defaultShard, lastHood, dnaString, experience, trackBonusLevel]) self.sendUpdateToAvatarId(senderId, 'friendDetails', [avId, inventory, trackAccess, hp, maxHp, defaultShard, lastHood, dnaString, experience, trackBonusLevel, npcFriends])
self.air.dbInterface.queryObject(self.air.dbId, avId, handleToon) self.air.dbInterface.queryObject(self.air.dbId, avId, handleToon)
def getPetDetails(self, avId): def getPetDetails(self, avId):

View file

@ -1,6 +1,7 @@
from panda3d.core import * from panda3d.core import *
from toontown.toonbase.ToontownGlobals import * from toontown.toonbase.ToontownGlobals import *
from direct.gui.DirectGui import * from direct.gui.DirectGui import *
from direct.interval.IntervalGlobal import *
from direct.showbase import DirectObject from direct.showbase import DirectObject
from direct.fsm import ClassicFSM, State from direct.fsm import ClassicFSM, State
from direct.fsm import State from direct.fsm import State
@ -8,10 +9,10 @@ from direct.directnotify import DirectNotifyGlobal
import DistributedToon import DistributedToon
from toontown.friends import FriendInviter from toontown.friends import FriendInviter
import ToonTeleportPanel import ToonTeleportPanel
from toontown.toonbase import TTLocalizer from toontown.toonbase import TTLocalizer, ToontownGlobals
from toontown.hood import ZoneUtil from toontown.hood import ZoneUtil
from toontown.toonbase.ToontownBattleGlobals import Tracks, Levels, getAvPropDamage from toontown.toonbase.ToontownBattleGlobals import Tracks, Levels, getAvPropDamage
from toontown.toon import Toon import Toon, NPCFriendPanel
globalAvatarDetail = None globalAvatarDetail = None
def showAvatarDetail(avId, avName): def showAvatarDetail(avId, avName):
@ -44,6 +45,7 @@ class ToonAvatarDetailPanel(DirectFrame):
def __init__(self, avId, avName, parent = base.a2dTopRight, **kw): def __init__(self, avId, avName, parent = base.a2dTopRight, **kw):
buttons = loader.loadModel('phase_3/models/gui/dialog_box_buttons_gui') buttons = loader.loadModel('phase_3/models/gui/dialog_box_buttons_gui')
gui = loader.loadModel('phase_3.5/models/gui/avatar_panel_gui') gui = loader.loadModel('phase_3.5/models/gui/avatar_panel_gui')
sosGui = loader.loadModel('phase_3.5/models/gui/playingCard')
detailPanel = gui.find('**/avatarInfoPanel') detailPanel = gui.find('**/avatarInfoPanel')
textScale = 0.095 textScale = 0.095
textWrap = 16.4 textWrap = 16.4
@ -72,11 +74,20 @@ class ToonAvatarDetailPanel(DirectFrame):
FriendInviter.hideFriendInviter() FriendInviter.hideFriendInviter()
self.bCancel = DirectButton(self, image=(buttons.find('**/CloseBtn_UP'), buttons.find('**/CloseBtn_DN'), buttons.find('**/CloseBtn_Rllvr')), image_scale=1.1, relief=None, text=TTLocalizer.AvatarDetailPanelCancel, text_scale=TTLocalizer.TADPbCancel, text_pos=(0.12, -0.01), pos=TTLocalizer.TADPbCancelPos, scale=2.0, command=self.__handleCancel) self.bCancel = DirectButton(self, image=(buttons.find('**/CloseBtn_UP'), buttons.find('**/CloseBtn_DN'), buttons.find('**/CloseBtn_Rllvr')), image_scale=1.1, relief=None, text=TTLocalizer.AvatarDetailPanelCancel, text_scale=TTLocalizer.TADPbCancel, text_pos=(0.12, -0.01), pos=TTLocalizer.TADPbCancelPos, scale=2.0, command=self.__handleCancel)
self.bCancel.hide() self.bCancel.hide()
self.sosButton = DirectButton(self, relief=None, image=sosGui.find('**/card_back'), scale=0.05, pos=(0.3, 0, -0.76), text=('', TTLocalizer.DetailPanelSOS, TTLocalizer.DetailPanelSOS, ''), text_fg=(1, 1, 0.5, 1), text_shadow=(0, 0, 0, 1), text_scale=2, text_pos=(0, -3.4), text_align=TextNode.ACenter, state=DGG.NORMAL, command=self.__toggleSOSGui)
self.sosButton.hide()
self.sosFrame = DirectFrame(self, relief=None, image=DGG.getDefaultDialogGeom(), image_scale=(2.6, 1, 1.87), image_color=ToontownGlobals.GlobalDialogColor, pos=(0.2, 0, 0.8))
self.sosFrame.setBin('background', 10)
self.sosFrame.setScale(0.5)
self.sosPage = NPCFriendPanel.NPCFriendPanel(parent=self.sosFrame, callable=False)
self.sosPage.setScale(0.18)
self.sosPage.setPos(0, 0, 0.05)
self.initialiseoptions(ToonAvatarDetailPanel) self.initialiseoptions(ToonAvatarDetailPanel)
self.fsm.enterInitialState() self.fsm.enterInitialState()
self.fsm.request('begin') self.fsm.request('begin')
buttons.removeNode() buttons.removeNode()
gui.removeNode() gui.removeNode()
sosGui.removeNode()
def cleanup(self): def cleanup(self):
if self.fsm: if self.fsm:
@ -87,7 +98,6 @@ class ToonAvatarDetailPanel(DirectFrame):
self.avatar.delete() self.avatar.delete()
self.createdAvatar = None self.createdAvatar = None
self.destroy() self.destroy()
return
def enterOff(self): def enterOff(self):
pass pass
@ -110,6 +120,7 @@ class ToonAvatarDetailPanel(DirectFrame):
def enterQuery(self): def enterQuery(self):
self.dataText['text'] = TTLocalizer.AvatarDetailPanelLookup % self.avName self.dataText['text'] = TTLocalizer.AvatarDetailPanelLookup % self.avName
self.sosButton.hide()
self.bCancel.show() self.bCancel.show()
self.avatar = base.cr.doId2do.get(self.avId) self.avatar = base.cr.doId2do.get(self.avId)
if self.avatar != None and not self.avatar.ghostMode: if self.avatar != None and not self.avatar.ghostMode:
@ -165,10 +176,12 @@ class ToonAvatarDetailPanel(DirectFrame):
else: else:
text = TTLocalizer.AvatarDetailPanelOffline % {'identifier': identifier} text = TTLocalizer.AvatarDetailPanelOffline % {'identifier': identifier}
self.dataText['text'] = text self.dataText['text'] = text
self.sosButton.show()
self.__addToonModel() self.__addToonModel()
self.__updateTrackInfo() self.__updateTrackInfo()
self.__updateTrophyInfo() self.__updateTrophyInfo()
self.__updateLaffInfo() self.__updateLaffInfo()
self.__updateSOSPage()
def __addToonModel(self): def __addToonModel(self):
toon = Toon.Toon() toon = Toon.Toon()
@ -191,13 +204,14 @@ class ToonAvatarDetailPanel(DirectFrame):
yOffset = 0.1 yOffset = 0.1
ySpacing = -0.115 ySpacing = -0.115
inventory = self.avatar.inventory inventory = self.avatar.inventory
self.inventoryFrame = DirectFrame(parent=self, relief=None)
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 = DirectFrame(parent=self.inventoryFrame, 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.setBin('gui-popup', 0)
rolloverFrame.hide() 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.inventoryFrame, relief=None, text=TextEncoder.upper(TTLocalizer.BattleGlobalTracks[track]), text_scale=TTLocalizer.TADPtrackLabel, text_align=TextNode.ALeft, pos=(-0.9, 0, TTLocalizer.TADtrackLabelPosZ + track * ySpacing))
if self.avatar.hasTrackAccess(track): if self.avatar.hasTrackAccess(track):
curExp, nextExp = inventory.getCurAndNextExpValues(track) curExp, nextExp = inventory.getCurAndNextExpValues(track)
for item in xrange(0, len(Levels[track])): for item in xrange(0, len(Levels[track])):
@ -215,7 +229,7 @@ class ToonAvatarDetailPanel(DirectFrame):
image_color = Vec4(0, 0.6, 1, 1) image_color = Vec4(0, 0.6, 1, 1)
geom_color = None geom_color = 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 = DirectLabel(parent=self.inventoryFrame, 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.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]) label.bind(DGG.EXIT, self.hideInfo, extraArgs=[rolloverFrame])
else: else:
@ -245,4 +259,31 @@ class ToonAvatarDetailPanel(DirectFrame):
star = gui.find('**/avatarStar') star = gui.find('**/avatarStar')
self.star = DirectLabel(parent=self, image=star, image_color=color, pos=(0.610165, 0, -0.760678), scale=0.9, relief=None) self.star = DirectLabel(parent=self, image=star, image_color=color, pos=(0.610165, 0, -0.760678), scale=0.9, relief=None)
gui.removeNode() gui.removeNode()
return
def __updateSOSPage(self):
self.sosPage.setFriends(self.avatar.NPCFriendsDict)
self.sosPage.update()
def __toggleSOSGui(self):
self.sosButton['state'] = DGG.DISABLED
if self.sosFrame.getScale() == 0.5:
pos = (-0.4, 0, -1.88)
scale = 1.0
else:
pos = (0, 0, 0.05)
scale = 0.5
Sequence(
Parallel(
self.sosFrame.posInterval(1.0, pos, blendType='easeOut'),
self.sosFrame.scaleInterval(1.0, scale, blendType='easeOut')
),
Func(self.__enableSOSButton)
).start()
def __enableSOSButton(self):
try:
self.sosButton['state'] = DGG.NORMAL
except:
pass

View file

@ -8741,6 +8741,8 @@ BattleSOSPopupHeal = 'Heals'
BattleSOSPopupHarm = 'Deals' BattleSOSPopupHarm = 'Deals'
BattleSOSPopupHP = '%s %s HP\n' BattleSOSPopupHP = '%s %s HP\n'
DetailPanelSOS = 'SOS Cards'
Blacklist = [ Blacklist = [
"$1ut", "$1ut",
"$h1t", "$h1t",