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 pandac.PandaModules import TextNode, VBase4
from direct.interval.IntervalGlobal import *
from toontown.chat.ChatBalloon import ChatBalloon
from toontown.nametag import NametagGlobals
@ -67,17 +67,9 @@ class Nametag:
self.chatButton = NametagGlobals.noButton
if self.chatBalloon is not None:
self.chatBalloon.removeNode()
self.chatBalloon = None
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.removeBalloon()
self.removeIcon()
self.removePanel()
self.avatar = None
@ -265,15 +257,25 @@ class Nametag:
def clearShadow(self):
self.textNode.clearShadow()
def update(self):
if self.chatBalloon is not None:
def removeBalloon(self):
if self.chatBalloon:
self.chatBalloon.removeNode()
self.chatBalloon = None
if self.panel is not None:
def removePanel(self):
if self.panel:
self.panel.removeNode()
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.chatBalloonType == NametagGlobals.CHAT_BALLOON:
if not self.chatHidden:

View file

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

View file

@ -2,7 +2,7 @@ from direct.task.Task import Task
import math
from panda3d.core import BillboardEffect, Vec3, Point3, PGButton, VBase4
from panda3d.core import DepthWriteAttrib
from direct.interval.IntervalGlobal import *
from toontown.chat.ChatBalloon import ChatBalloon
from toontown.nametag import NametagGlobals
from toontown.nametag.Nametag import Nametag
@ -97,10 +97,20 @@ class Nametag3d(Nametag, Clickable3d):
if self.isClickable() and (self.lastClickState != PGButton.SDepressed):
base.playSfx(NametagGlobals.rolloverSound)
def update(self):
def removeContents(self):
if self.contents:
self.contents.node().removeAllChildren()
def update(self):
if not self.chatBalloon:
self.removeContents()
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):
distance = self.contents.getPos(base.cam).length()
@ -138,7 +148,10 @@ class Nametag3d(Nametag, Clickable3d):
foreground=foreground, background=background,
reversed=self.chatReversed,
button=self.chatButton[self.clickState])
self.chatBalloon.setScale(0)
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):
if self.font is None: