chat balloons

This commit is contained in:
Zach 2015-05-10 05:51:55 -05:00
parent 7a498feefd
commit ad4eab559f
3 changed files with 35 additions and 20 deletions

View file

@ -1,6 +1,6 @@
from direct.task.Task import Task from direct.task.Task import Task
from pandac.PandaModules import TextNode, VBase4 from pandac.PandaModules import TextNode, VBase4
from direct.interval.IntervalGlobal import *
from toontown.chat.ChatBalloon import ChatBalloon from toontown.chat.ChatBalloon import ChatBalloon
from toontown.nametag import NametagGlobals from toontown.nametag import NametagGlobals
@ -67,17 +67,9 @@ class Nametag:
self.chatButton = NametagGlobals.noButton self.chatButton = NametagGlobals.noButton
if self.chatBalloon is not None: self.removeBalloon()
self.chatBalloon.removeNode() self.removeIcon()
self.chatBalloon = None self.removePanel()
if self.icon is not None:
self.icon.removeAllChildren()
self.icon = None
if self.panel is not None:
self.panel.removeNode()
self.panel = None
self.avatar = None self.avatar = None
@ -265,15 +257,25 @@ class Nametag:
def clearShadow(self): def clearShadow(self):
self.textNode.clearShadow() self.textNode.clearShadow()
def update(self): def removeBalloon(self):
if self.chatBalloon is not None: if self.chatBalloon:
self.chatBalloon.removeNode() self.chatBalloon.removeNode()
self.chatBalloon = None self.chatBalloon = None
if self.panel is not None: def removePanel(self):
if self.panel:
self.panel.removeNode() self.panel.removeNode()
self.panel = None self.panel = None
def removeIcon(self):
if self.icon:
self.icon.removeAllChildren()
self.icon = None
def update(self):
self.removeBalloon()
self.removePanel()
if self.getChatText(): if self.getChatText():
if self.chatBalloonType == NametagGlobals.CHAT_BALLOON: if self.chatBalloonType == NametagGlobals.CHAT_BALLOON:
if not self.chatHidden: if not self.chatHidden:

View file

@ -1,7 +1,7 @@
from direct.task.Task import Task from direct.task.Task import Task
import math import math
from panda3d.core import PGButton, VBase4, DepthWriteAttrib, Point3 from panda3d.core import PGButton, VBase4, DepthWriteAttrib, Point3
from direct.interval.IntervalGlobal import *
from toontown.chat.ChatBalloon import ChatBalloon from toontown.chat.ChatBalloon import ChatBalloon
from toontown.margins import MarginGlobals from toontown.margins import MarginGlobals
from toontown.margins.MarginVisible import MarginVisible from toontown.margins.MarginVisible import MarginVisible

View file

@ -2,7 +2,7 @@ from direct.task.Task import Task
import math import math
from panda3d.core import BillboardEffect, Vec3, Point3, PGButton, VBase4 from panda3d.core import BillboardEffect, Vec3, Point3, PGButton, VBase4
from panda3d.core import DepthWriteAttrib from panda3d.core import DepthWriteAttrib
from direct.interval.IntervalGlobal import *
from toontown.chat.ChatBalloon import ChatBalloon from toontown.chat.ChatBalloon import ChatBalloon
from toontown.nametag import NametagGlobals from toontown.nametag import NametagGlobals
from toontown.nametag.Nametag import Nametag from toontown.nametag.Nametag import Nametag
@ -97,10 +97,20 @@ class Nametag3d(Nametag, Clickable3d):
if self.isClickable() and (self.lastClickState != PGButton.SDepressed): if self.isClickable() and (self.lastClickState != PGButton.SDepressed):
base.playSfx(NametagGlobals.rolloverSound) base.playSfx(NametagGlobals.rolloverSound)
def update(self): def removeContents(self):
if self.contents:
self.contents.node().removeAllChildren() self.contents.node().removeAllChildren()
def update(self):
if not self.chatBalloon:
self.removeContents()
Nametag.update(self) Nametag.update(self)
else:
scaleLerp = Sequence(LerpScaleInterval(self.chatBalloon, 0.25, VBase3(0, 0, 0), blendType='easeInOut'),
Wait(0.25),
Func(self.removeContents),
Func(Nametag.update, self))
scaleLerp.start()
def tick(self, task): def tick(self, task):
distance = self.contents.getPos(base.cam).length() distance = self.contents.getPos(base.cam).length()
@ -138,7 +148,10 @@ class Nametag3d(Nametag, Clickable3d):
foreground=foreground, background=background, foreground=foreground, background=background,
reversed=self.chatReversed, reversed=self.chatReversed,
button=self.chatButton[self.clickState]) button=self.chatButton[self.clickState])
self.chatBalloon.setScale(0)
self.chatBalloon.reparentTo(self.contents) self.chatBalloon.reparentTo(self.contents)
scaleLerp = Sequence(Wait(0.15), LerpScaleInterval(self.chatBalloon, 0.25, VBase3(1, 1, 1), blendType='easeInOut'))
scaleLerp.start()
def drawNametag(self): def drawNametag(self):
if self.font is None: if self.font is None: