mirror of
https://github.com/Sneed-Group/Poodletooth-iLand
synced 2024-10-30 16:27:54 +00:00
SOS page in detail panel
This commit is contained in:
parent
81f6895954
commit
2e744ba51f
5 changed files with 55 additions and 10 deletions
2
dependencies/astron/dclass/stride.dc
vendored
2
dependencies/astron/dclass/stride.dc
vendored
|
@ -3202,7 +3202,7 @@ dclass TTSFriendsManager : DistributedObjectGlobal {
|
|||
goingOffline(uint32 avId);
|
||||
|
||||
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;
|
||||
petDetails(uint32, uint32, string, uint32, uint32, uint16/1000[], PetTrait[], int8[], uint32);
|
||||
|
|
|
@ -27,7 +27,7 @@ class TTSFriendsManager(DistributedObjectGlobal):
|
|||
def d_getAvatarDetails(self, 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 = [
|
||||
['setExperience' , experience],
|
||||
['setTrackAccess' , trackAccess],
|
||||
|
@ -38,6 +38,7 @@ class TTSFriendsManager(DistributedObjectGlobal):
|
|||
['setDefaultShard' , defaultShard],
|
||||
['setLastHood' , lastHood],
|
||||
['setDNAString' , dnaString],
|
||||
['setNPCFriendsDict', npcFriends]
|
||||
]
|
||||
base.cr.n_handleGetAvatarDetailsResp(avId, fields=fields)
|
||||
|
||||
|
|
|
@ -198,8 +198,9 @@ class TTSFriendsManagerUD(DistributedObjectGlobalUD):
|
|||
dnaString = fields['setDNAString'][0]
|
||||
experience = fields['setExperience'][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)
|
||||
|
||||
def getPetDetails(self, avId):
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
from panda3d.core import *
|
||||
from toontown.toonbase.ToontownGlobals import *
|
||||
from direct.gui.DirectGui import *
|
||||
from direct.interval.IntervalGlobal import *
|
||||
from direct.showbase import DirectObject
|
||||
from direct.fsm import ClassicFSM, State
|
||||
from direct.fsm import State
|
||||
|
@ -8,10 +9,10 @@ from direct.directnotify import DirectNotifyGlobal
|
|||
import DistributedToon
|
||||
from toontown.friends import FriendInviter
|
||||
import ToonTeleportPanel
|
||||
from toontown.toonbase import TTLocalizer
|
||||
from toontown.toonbase import TTLocalizer, ToontownGlobals
|
||||
from toontown.hood import ZoneUtil
|
||||
from toontown.toonbase.ToontownBattleGlobals import Tracks, Levels, getAvPropDamage
|
||||
from toontown.toon import Toon
|
||||
import Toon, NPCFriendPanel
|
||||
globalAvatarDetail = None
|
||||
|
||||
def showAvatarDetail(avId, avName):
|
||||
|
@ -44,6 +45,7 @@ class ToonAvatarDetailPanel(DirectFrame):
|
|||
def __init__(self, avId, avName, parent = base.a2dTopRight, **kw):
|
||||
buttons = loader.loadModel('phase_3/models/gui/dialog_box_buttons_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')
|
||||
textScale = 0.095
|
||||
textWrap = 16.4
|
||||
|
@ -72,11 +74,20 @@ class ToonAvatarDetailPanel(DirectFrame):
|
|||
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.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.fsm.enterInitialState()
|
||||
self.fsm.request('begin')
|
||||
buttons.removeNode()
|
||||
gui.removeNode()
|
||||
sosGui.removeNode()
|
||||
|
||||
def cleanup(self):
|
||||
if self.fsm:
|
||||
|
@ -87,7 +98,6 @@ class ToonAvatarDetailPanel(DirectFrame):
|
|||
self.avatar.delete()
|
||||
self.createdAvatar = None
|
||||
self.destroy()
|
||||
return
|
||||
|
||||
def enterOff(self):
|
||||
pass
|
||||
|
@ -110,6 +120,7 @@ class ToonAvatarDetailPanel(DirectFrame):
|
|||
|
||||
def enterQuery(self):
|
||||
self.dataText['text'] = TTLocalizer.AvatarDetailPanelLookup % self.avName
|
||||
self.sosButton.hide()
|
||||
self.bCancel.show()
|
||||
self.avatar = base.cr.doId2do.get(self.avId)
|
||||
if self.avatar != None and not self.avatar.ghostMode:
|
||||
|
@ -165,10 +176,12 @@ class ToonAvatarDetailPanel(DirectFrame):
|
|||
else:
|
||||
text = TTLocalizer.AvatarDetailPanelOffline % {'identifier': identifier}
|
||||
self.dataText['text'] = text
|
||||
self.sosButton.show()
|
||||
self.__addToonModel()
|
||||
self.__updateTrackInfo()
|
||||
self.__updateTrophyInfo()
|
||||
self.__updateLaffInfo()
|
||||
self.__updateSOSPage()
|
||||
|
||||
def __addToonModel(self):
|
||||
toon = Toon.Toon()
|
||||
|
@ -191,13 +204,14 @@ class ToonAvatarDetailPanel(DirectFrame):
|
|||
yOffset = 0.1
|
||||
ySpacing = -0.115
|
||||
inventory = self.avatar.inventory
|
||||
self.inventoryFrame = DirectFrame(parent=self, relief=None)
|
||||
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.hide()
|
||||
buttonModel = inventoryModels.find('**/InventoryButtonUp')
|
||||
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):
|
||||
curExp, nextExp = inventory.getCurAndNextExpValues(track)
|
||||
for item in xrange(0, len(Levels[track])):
|
||||
|
@ -215,7 +229,7 @@ class ToonAvatarDetailPanel(DirectFrame):
|
|||
image_color = Vec4(0, 0.6, 1, 1)
|
||||
geom_color = None
|
||||
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.EXIT, self.hideInfo, extraArgs=[rolloverFrame])
|
||||
else:
|
||||
|
@ -245,4 +259,31 @@ class ToonAvatarDetailPanel(DirectFrame):
|
|||
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)
|
||||
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
|
|
@ -8741,6 +8741,8 @@ BattleSOSPopupHeal = 'Heals'
|
|||
BattleSOSPopupHarm = 'Deals'
|
||||
BattleSOSPopupHP = '%s %s HP\n'
|
||||
|
||||
DetailPanelSOS = 'SOS Cards'
|
||||
|
||||
Blacklist = [
|
||||
"$1ut",
|
||||
"$h1t",
|
||||
|
|
Loading…
Reference in a new issue