Fix loudrob's issue

This commit is contained in:
John 2015-07-03 18:28:18 +03:00
parent 1c84579924
commit 9b5d51f65f
2 changed files with 15 additions and 16 deletions

View file

@ -66,7 +66,7 @@ class Nametag(ClickablePopup):
pass # Does nothing by default. pass # Does nothing by default.
def clickStateChanged(self): def clickStateChanged(self):
self.update() self.update(False)
def getButton(self): def getButton(self):
cs = self.getClickState() cs = self.getClickState()
@ -77,7 +77,7 @@ class Nametag(ClickablePopup):
else: else:
return self.buttons.get(0) return self.buttons.get(0)
def update(self): def update(self, scale=True):
if self.colorCode in NAMETAG_COLORS: if self.colorCode in NAMETAG_COLORS:
cc = self.colorCode cc = self.colorCode
else: else:
@ -87,11 +87,19 @@ class Nametag(ClickablePopup):
self.innerNP.node().removeAllChildren() self.innerNP.node().removeAllChildren()
if self.contents & self.CThought and self.chatFlags & CFThought: if self.contents & self.CThought and self.chatFlags & CFThought:
self.showThought() balloon = self.showBalloon(self.getThoughtBalloon(), self.chatString)
elif self.contents & self.CSpeech and self.chatFlags&CFSpeech: elif self.contents & self.CSpeech and self.chatFlags&CFSpeech:
self.showSpeech() balloon = self.showBalloon(self.getSpeechBalloon(), self.chatString)
elif self.contents & self.CName and self.displayName: elif self.contents & self.CName and self.displayName:
self.showName() self.showName()
return
else:
return
if scale and self.IS_3D:
balloon.setScale(0)
scaleLerp = Sequence(Wait(0.10), LerpScaleInterval(balloon, 0.2, VBase3(1, 1, 1), VBase3(0, 0, 0), blendType='easeInOut'))
scaleLerp.start()
def showBalloon(self, balloon, text): def showBalloon(self, balloon, text):
if not self.speechFont: if not self.speechFont:
@ -110,17 +118,8 @@ class Nametag(ClickablePopup):
button=self.getButton(), button=self.getButton(),
reversed=reversed) reversed=reversed)
balloon.reparentTo(self.innerNP) balloon.reparentTo(self.innerNP)
if self.IS_3D:
balloon.setScale(0)
scaleLerp = Sequence(Wait(0.10), LerpScaleInterval(balloon, 0.2, VBase3(1, 1, 1), VBase3(0, 0, 0), blendType='easeInOut'))
scaleLerp.start()
self.frame = frame self.frame = frame
return balloon
def showThought(self):
self.showBalloon(self.getThoughtBalloon(), self.chatString)
def showSpeech(self):
self.showBalloon(self.getSpeechBalloon(), self.chatString)
def showName(self): def showName(self):
if not self.font: if not self.font:

View file

@ -67,8 +67,8 @@ class Nametag2d(Nametag, MarginPopup):
self.arrow.setScale(self.ARROW_SCALE) self.arrow.setScale(self.ARROW_SCALE)
self.arrow.setColor(ARROW_COLORS.get(self.colorCode, self.nameFg)) self.arrow.setColor(ARROW_COLORS.get(self.colorCode, self.nameFg))
def update(self): def update(self, scale=True):
Nametag.update(self) Nametag.update(self, scale)
self.considerUpdateClickRegion() self.considerUpdateClickRegion()
def marginVisibilityChanged(self): def marginVisibilityChanged(self):