mirror of
https://github.com/Sneed-Group/Poodletooth-iLand
synced 2024-12-23 11:42:39 -06:00
Current work
This commit is contained in:
parent
a110fb7a19
commit
cadeff717d
3 changed files with 163 additions and 180 deletions
|
@ -12,9 +12,9 @@ from otp.chat import ChatUtil
|
|||
from otp.otpbase import OTPGlobals
|
||||
from otp.otpbase import OTPLocalizer
|
||||
from otp.otpbase import OTPRender
|
||||
from toontown.chat.ChatGlobals import *
|
||||
from toontown.nametag import NametagGlobals
|
||||
from toontown.nametag.NametagGroup import NametagGroup
|
||||
from otp.nametag.Nametag import Nametag
|
||||
from otp.nametag.NametagGroup import NametagGroup
|
||||
from otp.nametag.NametagConstants import CFSpeech, CFThought, CFTimeout, CFPageButton, CFNoQuitButton, CFQuitButton
|
||||
|
||||
|
||||
teleportNotify = DirectNotifyGlobal.directNotify.newCategory('Teleport')
|
||||
|
@ -43,15 +43,18 @@ class Avatar(Actor, ShadowCaster):
|
|||
Actor.__init__(self, None, None, other, flattenable=0, setFinal=1)
|
||||
ShadowCaster.__init__(self)
|
||||
self.__font = OTPGlobals.getInterfaceFont()
|
||||
self.__speechFont = OTPGlobals.getInterfaceFont()
|
||||
self.soundChatBubble = None
|
||||
self.avatarType = ''
|
||||
self.nametagNodePath = None
|
||||
self.__nameVisible = 1
|
||||
self.nametag = NametagGroup()
|
||||
self.nametag.setAvatar(self)
|
||||
interfaceFont = OTPGlobals.getInterfaceFont()
|
||||
self.nametag.setFont(interfaceFont)
|
||||
self.nametag.setChatFont(interfaceFont)
|
||||
self.nametag.setFont(OTPGlobals.getInterfaceFont())
|
||||
self.nametag.setSpeechFont(OTPGlobals.getInterfaceFont())
|
||||
self.nametag2dContents = Nametag.CName | Nametag.CSpeech
|
||||
self.nametag2dDist = Nametag.CName | Nametag.CSpeech
|
||||
self.nametag2dNormalContents = Nametag.CName | Nametag.CSpeech
|
||||
self.nametag3d = self.attachNewNode('nametag3d')
|
||||
self.nametag3d.setTag('cam', 'nametag')
|
||||
self.nametag3d.setLightOff()
|
||||
|
@ -69,7 +72,7 @@ class Avatar(Actor, ShadowCaster):
|
|||
self.battleTubeRadius = 0.0
|
||||
self.style = None
|
||||
self.understandable = 1
|
||||
self.setPlayerType(NametagGlobals.CCNormal)
|
||||
self.setPlayerType(NametagGroup.CCNormal)
|
||||
self.ghostMode = 0
|
||||
self.__chatParagraph = None
|
||||
self.__chatMessage = None
|
||||
|
@ -79,7 +82,6 @@ class Avatar(Actor, ShadowCaster):
|
|||
self.__chatDialogueList = []
|
||||
self.__chatSet = 0
|
||||
self.__chatLocal = 0
|
||||
self.__chatQuitButton = False
|
||||
self.__currentDialogue = None
|
||||
|
||||
def delete(self):
|
||||
|
@ -92,6 +94,7 @@ class Avatar(Actor, ShadowCaster):
|
|||
self.ignoreNametagAmbientLightChange()
|
||||
self.Avatar_deleted = 1
|
||||
del self.__font
|
||||
del self.__speechFont
|
||||
del self.style
|
||||
del self.soundChatBubble
|
||||
self.nametag.destroy()
|
||||
|
@ -121,50 +124,53 @@ class Avatar(Actor, ShadowCaster):
|
|||
self.notify.warning('no nametag attributed, but would have been used.')
|
||||
return
|
||||
if self.isUnderstandable():
|
||||
nametagColor = NametagGlobals.NametagColors[self.playerType]
|
||||
self.nametag.setNametagColor(nametagColor)
|
||||
chatColor = NametagGlobals.ChatColors[self.playerType]
|
||||
self.nametag.setChatColor(chatColor)
|
||||
self.nametag.setColorCode(self.playerType)
|
||||
else:
|
||||
nametagColor = NametagGlobals.NametagColors[NametagGlobals.CCNonPlayer]
|
||||
self.nametag.setNametagColor(nametagColor)
|
||||
chatColor = NametagGlobals.ChatColors[NametagGlobals.CCNonPlayer]
|
||||
self.nametag.setChatColor(chatColor)
|
||||
self.setNametagName()
|
||||
self.nametag.updateAll()
|
||||
self.nametag.setColorCode(NametagGroup.CCNoChat)
|
||||
|
||||
def considerUnderstandable(self):
|
||||
if self.playerType in (NametagGlobals.CCNormal, NametagGlobals.CCSpeedChat):
|
||||
self.setPlayerType(NametagGlobals.CCSpeedChat)
|
||||
if hasattr(base, 'localAvatar') and (self == base.localAvatar):
|
||||
speed = 0
|
||||
if self.playerType in (NametagGroup.CCNormal, NametagGroup.CCFreeChat, NametagGroup.CCSpeedChat):
|
||||
self.setPlayerType(NametagGroup.CCSpeedChat)
|
||||
speed = 1
|
||||
if hasattr(base, 'localAvatar') and self == base.localAvatar:
|
||||
self.understandable = 1
|
||||
self.setPlayerType(NametagGlobals.CCNormal)
|
||||
elif hasattr(self, 'adminAccess') and self.isAdmin():
|
||||
self.understandable = 2
|
||||
self.setPlayerType(NametagGlobals.CCAdmin)
|
||||
elif self.playerType == NametagGlobals.CCSuit:
|
||||
self.setPlayerType(NametagGroup.CCFreeChat)
|
||||
elif self.playerType == NametagGroup.CCSuit:
|
||||
self.understandable = 1
|
||||
self.setPlayerType(NametagGlobals.CCSuit)
|
||||
elif self.playerType not in (NametagGlobals.CCNormal, NametagGlobals.CCSpeedChat):
|
||||
self.setPlayerType(NametagGroup.CCSuit)
|
||||
elif self.playerType not in (NametagGroup.CCNormal, NametagGroup.CCFreeChat, NametagGroup.CCSpeedChat):
|
||||
self.understandable = 1
|
||||
self.setPlayerType(NametagGlobals.CCNonPlayer)
|
||||
elif settings['trueFriends'] and base.localAvatar.isTrueFriends(self.doId):
|
||||
self.understandable = 2
|
||||
self.setPlayerType(NametagGlobals.CCNormal)
|
||||
elif settings['speedchatPlus']:
|
||||
self.setPlayerType(NametagGroup.CCNoChat)
|
||||
elif hasattr(base, 'localAvatar') and self.commonChatFlags & base.localAvatar.commonChatFlags & OTPGlobals.CommonChat:
|
||||
self.understandable = 1
|
||||
self.setPlayerType(NametagGroup.CCFreeChat)
|
||||
elif self.commonChatFlags & OTPGlobals.SuperChat:
|
||||
self.understandable = 1
|
||||
self.setPlayerType(NametagGroup.CCFreeChat)
|
||||
elif hasattr(base, 'localAvatar') and base.localAvatar.commonChatFlags & OTPGlobals.SuperChat:
|
||||
self.understandable = 1
|
||||
self.setPlayerType(NametagGroup.CCFreeChat)
|
||||
elif base.cr.getFriendFlags(self.doId) & OTPGlobals.FriendChat:
|
||||
self.understandable = 1
|
||||
self.setPlayerType(NametagGroup.CCFreeChat)
|
||||
elif base.cr.playerFriendsManager.findPlayerIdFromAvId(self.doId) is not None:
|
||||
playerInfo = base.cr.playerFriendsManager.findPlayerInfoFromAvId(self.doId)
|
||||
if playerInfo.openChatFriendshipYesNo:
|
||||
self.understandable = 1
|
||||
self.nametag.setColorCode(NametagGroup.CCFreeChat)
|
||||
elif playerInfo.isUnderstandable():
|
||||
self.understandable = 1
|
||||
else:
|
||||
self.understandable = 0
|
||||
elif hasattr(base, 'localAvatar') and self.whitelistChatFlags & base.localAvatar.whitelistChatFlags:
|
||||
self.understandable = 1
|
||||
self.setPlayerType(NametagGlobals.CCSpeedChat)
|
||||
else:
|
||||
self.understandable = 0
|
||||
self.setPlayerType(NametagGlobals.CCSpeedChat)
|
||||
if not hasattr(self, 'nametag'):
|
||||
self.notify.warning('no nametag attributed, but would have been used')
|
||||
else:
|
||||
nametagColor = NametagGlobals.NametagColors[self.playerType]
|
||||
self.nametag.setNametagColor(nametagColor)
|
||||
chatColor = NametagGlobals.ChatColors[self.playerType]
|
||||
self.nametag.setChatColor(chatColor)
|
||||
self.nametag.updateAll()
|
||||
self.nametag.setColorCode(self.playerType)
|
||||
|
||||
def isUnderstandable(self):
|
||||
return self.understandable
|
||||
|
@ -222,25 +228,13 @@ class Avatar(Actor, ShadowCaster):
|
|||
return
|
||||
self.name = name
|
||||
if hasattr(self, 'nametag'):
|
||||
self.setNametagName()
|
||||
self.nametag.setName(name)
|
||||
|
||||
def setDisplayName(self, str):
|
||||
if hasattr(self, 'isDisguised'):
|
||||
if self.isDisguised:
|
||||
return
|
||||
self.setNametagName(str)
|
||||
|
||||
def setNametagName(self, name=None):
|
||||
if not name:
|
||||
name = self.name
|
||||
|
||||
if hasattr(self, 'adminAccess') and self.isAdmin():
|
||||
access = self.getAdminAccess()
|
||||
|
||||
if access in OTPLocalizer.AccessToString:
|
||||
name += '\n\x01shadow\x01%s\x02' % OTPLocalizer.AccessToString[access]
|
||||
|
||||
self.nametag.setText(name)
|
||||
self.nametag.setDisplayName(str)
|
||||
|
||||
def getFont(self):
|
||||
return self.__font
|
||||
|
@ -248,7 +242,13 @@ class Avatar(Actor, ShadowCaster):
|
|||
def setFont(self, font):
|
||||
self.__font = font
|
||||
self.nametag.setFont(font)
|
||||
self.nametag.setChatFont(font)
|
||||
|
||||
def getSpeechFont(self):
|
||||
return self.__speechFont
|
||||
|
||||
def setSpeechFont(self, font):
|
||||
self.__speechFont = font
|
||||
self.nametag.setSpeechFont(font)
|
||||
|
||||
def getStyle(self):
|
||||
return self.style
|
||||
|
@ -266,7 +266,7 @@ class Avatar(Actor, ShadowCaster):
|
|||
if dialogue:
|
||||
base.playSfx(dialogue, node=self)
|
||||
elif chatFlags & CFSpeech != 0 and self.nametag.getNumChatPages() > 0:
|
||||
self.playDialogueForString(self.nametag.getChatText())
|
||||
self.playDialogueForString(self.nametag.getChat())
|
||||
if self.soundChatBubble != None:
|
||||
base.playSfx(self.soundChatBubble, node=self)
|
||||
|
||||
|
@ -344,28 +344,7 @@ class Avatar(Actor, ShadowCaster):
|
|||
|
||||
def setChatAbsolute(self, chatString, chatFlags, dialogue=None, interrupt=1):
|
||||
self.clearChat()
|
||||
|
||||
if chatFlags & CFQuicktalker:
|
||||
self.nametag.setChatType(NametagGlobals.SPEEDCHAT)
|
||||
else:
|
||||
self.nametag.setChatType(NametagGlobals.CHAT)
|
||||
|
||||
if chatFlags & CFThought:
|
||||
self.nametag.setChatBalloonType(NametagGlobals.THOUGHT_BALLOON)
|
||||
else:
|
||||
self.nametag.setChatBalloonType(NametagGlobals.CHAT_BALLOON)
|
||||
|
||||
if chatFlags & CFPageButton:
|
||||
self.nametag.setChatButton(NametagGlobals.pageButton)
|
||||
else:
|
||||
self.nametag.setChatButton(NametagGlobals.noButton)
|
||||
|
||||
if chatFlags & CFReversed:
|
||||
self.nametag.setChatReversed(True)
|
||||
else:
|
||||
self.nametag.setChatReversed(False)
|
||||
|
||||
self.nametag.setChatText(chatString, timeout=(chatFlags & CFTimeout))
|
||||
self.nametag.setChat(chatString, chatFlags)
|
||||
self.playCurrentDialogue(dialogue, chatFlags, interrupt)
|
||||
|
||||
def setChatMuted(self, chatString, chatFlags, dialogue = None, interrupt = 1, quiet = 0):
|
||||
|
@ -374,18 +353,14 @@ class Avatar(Actor, ShadowCaster):
|
|||
def displayTalk(self, chatString):
|
||||
if not base.localAvatar.isIgnored(self.doId):
|
||||
self.clearChat()
|
||||
self.nametag.setChatType(NametagGlobals.CHAT)
|
||||
self.nametag.setChatButton(NametagGlobals.noButton)
|
||||
if ChatUtil.isThought(chatString):
|
||||
chatString = ChatUtil.removeThoughtPrefix(chatString)
|
||||
self.nametag.setChatBalloonType(NametagGlobals.THOUGHT_BALLOON)
|
||||
self.nametag.setChatText(chatString)
|
||||
self.nametag.setChat(chatString, CFThought)
|
||||
else:
|
||||
self.nametag.setChatBalloonType(NametagGlobals.CHAT_BALLOON)
|
||||
self.nametag.setChatText(chatString, timeout=True)
|
||||
self.nametag.setChat(chatString, CFSpeech | CFTimeout)
|
||||
|
||||
def clearChat(self):
|
||||
self.nametag.clearChatText()
|
||||
self.nametag.clearChat()
|
||||
|
||||
def isInView(self):
|
||||
pos = self.getPos(camera)
|
||||
|
@ -404,62 +379,44 @@ class Avatar(Actor, ShadowCaster):
|
|||
|
||||
def hideName(self):
|
||||
nametag3d = self.nametag.getNametag3d()
|
||||
nametag3d.hideNametag()
|
||||
nametag3d.showChat()
|
||||
nametag3d.showThought()
|
||||
nametag3d.update()
|
||||
nametag3d.setContents(Nametag.CSpeech | Nametag.CThought)
|
||||
|
||||
def showName(self):
|
||||
if self.__nameVisible and (not self.ghostMode):
|
||||
nametag3d = self.nametag.getNametag3d()
|
||||
nametag3d.showNametag()
|
||||
nametag3d.showChat()
|
||||
nametag3d.showThought()
|
||||
nametag3d.update()
|
||||
nametag3d.setContents(Nametag.CName | Nametag.CSpeech | Nametag.CThought)
|
||||
|
||||
def hideNametag2d(self):
|
||||
nametag2d = self.nametag.getNametag2d()
|
||||
nametag2d.hideNametag()
|
||||
nametag2d.hideChat()
|
||||
nametag2d.update()
|
||||
self.nametag2dContents = 0
|
||||
nametag2d.setContents(self.nametag2dContents & self.nametag2dDist)
|
||||
|
||||
def showNametag2d(self):
|
||||
nametag2d = self.nametag.getNametag2d()
|
||||
if not self.ghostMode:
|
||||
nametag2d.showNametag()
|
||||
nametag2d.showChat()
|
||||
else:
|
||||
nametag2d.hideNametag()
|
||||
nametag2d.hideChat()
|
||||
nametag2d.update()
|
||||
self.nametag2dContents = self.nametag2dNormalContents
|
||||
if self.ghostMode:
|
||||
self.nametag2dContents = Nametag.CSpeech
|
||||
nametag2d.setContents(self.nametag2dContents & self.nametag2dDist)
|
||||
|
||||
def hideNametag3d(self):
|
||||
nametag3d = self.nametag.getNametag3d()
|
||||
nametag3d.hideNametag()
|
||||
nametag3d.hideChat()
|
||||
nametag3d.hideThought()
|
||||
nametag3d.update()
|
||||
nametag3d.setContents(0)
|
||||
|
||||
def showNametag3d(self):
|
||||
nametag3d = self.nametag.getNametag3d()
|
||||
if self.__nameVisible and (not self.ghostMode):
|
||||
nametag3d.showNametag()
|
||||
nametag3d.showChat()
|
||||
nametag3d.showThought()
|
||||
nametag3d.setContents(Nametag.CName | Nametag.CSpeech | Nametag.CThought)
|
||||
else:
|
||||
nametag3d.hideNametag()
|
||||
nametag3d.hideChat()
|
||||
nametag3d.hideThought()
|
||||
nametag3d.update()
|
||||
nametag3d.setContents(0)
|
||||
|
||||
def setPickable(self, flag):
|
||||
self.nametag.setActive(flag)
|
||||
|
||||
def clickedNametag(self):
|
||||
MagicWordManager.lastClickedNametag = self
|
||||
if self.nametag.getChatText() and self.nametag.hasChatButton():
|
||||
if self.nametag.hasButton():
|
||||
self.advancePageNumber()
|
||||
elif self.nametag.getActive():
|
||||
elif self.nametag.isActive():
|
||||
messenger.send('clickedNametag', [self])
|
||||
|
||||
def setPageChat(self, addressee, paragraph, message, quitButton,
|
||||
|
@ -468,9 +425,10 @@ class Avatar(Actor, ShadowCaster):
|
|||
self.__chatPageNumber = None
|
||||
self.__chatParagraph = paragraph
|
||||
self.__chatMessage = message
|
||||
self.__chatFlags = CFSpeech
|
||||
if extraChatFlags is not None:
|
||||
self.__chatFlags |= extraChatFlags
|
||||
if extraChatFlags is None:
|
||||
self.__chatFlags = CFSpeech
|
||||
else:
|
||||
self.__chatFlags = CFSpeech | extraChatFlags
|
||||
self.__chatDialogueList = dialogueList
|
||||
self.__chatSet = 0
|
||||
self.__chatLocal = 0
|
||||
|
@ -478,7 +436,10 @@ class Avatar(Actor, ShadowCaster):
|
|||
if addressee == base.localAvatar.doId:
|
||||
if pageButton:
|
||||
self.__chatFlags |= CFPageButton
|
||||
self.__chatQuitButton = quitButton
|
||||
if quitButton == None:
|
||||
self.__chatFlags |= CFNoQuitButton
|
||||
elif quitButton:
|
||||
self.__chatFlags |= CFQuitButton
|
||||
self.b_setPageNumber(self.__chatParagraph, 0)
|
||||
|
||||
def setLocalPageChat(self, message, quitButton, extraChatFlags=None,
|
||||
|
@ -487,14 +448,18 @@ class Avatar(Actor, ShadowCaster):
|
|||
self.__chatPageNumber = None
|
||||
self.__chatParagraph = None
|
||||
self.__chatMessage = message
|
||||
self.__chatFlags = CFSpeech
|
||||
if extraChatFlags is not None:
|
||||
self.__chatFlags |= extraChatFlags
|
||||
if extraChatFlags is None:
|
||||
self.__chatFlags = CFSpeech
|
||||
else:
|
||||
self.__chatFlags = CFSpeech | extraChatFlags
|
||||
self.__chatDialogueList = dialogueList
|
||||
self.__chatSet = 1
|
||||
self.__chatLocal = 1
|
||||
self.__chatFlags |= CFPageButton
|
||||
self.__chatQuitButton = quitButton
|
||||
if quitButton == None:
|
||||
self.__chatFlags |= CFNoQuitButton
|
||||
elif quitButton:
|
||||
self.__chatFlags |= CFQuitButton
|
||||
if len(dialogueList) > 0:
|
||||
dialogue = dialogueList[0]
|
||||
else:
|
||||
|
@ -529,9 +494,6 @@ class Avatar(Actor, ShadowCaster):
|
|||
pageNumber += 1
|
||||
if pageNumber >= self.nametag.getNumChatPages():
|
||||
pageNumber = -1
|
||||
if self.__chatQuitButton:
|
||||
if pageNumber == self.nametag.getNumChatPages() - 1:
|
||||
self.nametag.setChatButton(NametagGlobals.quitButton)
|
||||
if self.__chatLocal:
|
||||
self.setPageNumber(self.__chatParagraph, pageNumber)
|
||||
else:
|
||||
|
@ -550,10 +512,7 @@ class Avatar(Actor, ShadowCaster):
|
|||
self.setChatAbsolute(self.__chatMessage, self.__chatFlags, dialogue)
|
||||
self.__chatSet = 1
|
||||
if pageNumber < self.nametag.getNumChatPages():
|
||||
if (self.__chatAddressee == base.localAvatar.doId) and self.__chatQuitButton:
|
||||
if pageNumber == self.nametag.getNumChatPages() - 1:
|
||||
self.nametag.setChatButton(NametagGlobals.quitButton)
|
||||
self.nametag.setChatPageIndex(pageNumber)
|
||||
self.nametag.setPageNumber(pageNumber)
|
||||
if pageNumber > 0:
|
||||
if len(self.__chatDialogueList) > pageNumber:
|
||||
dialogue = self.__chatDialogueList[pageNumber]
|
||||
|
@ -573,7 +532,7 @@ class Avatar(Actor, ShadowCaster):
|
|||
self.deleteNametag3d()
|
||||
nametagNode = self.nametag.getNametag3d()
|
||||
self.nametagNodePath = self.nametag3d.attachNewNode(nametagNode)
|
||||
iconNodePath = self.nametag.getIcon()
|
||||
iconNodePath = self.nametag.getNameIcon()
|
||||
for cJoint in self.getNametagJoints():
|
||||
cJoint.clearNetTransforms()
|
||||
cJoint.addNetTransform(nametagNode)
|
||||
|
@ -622,7 +581,7 @@ class Avatar(Actor, ShadowCaster):
|
|||
|
||||
Avatar.ActiveAvatars.append(self)
|
||||
self.nametag.manage(base.marginManager)
|
||||
self.accept(self.nametag.getUniqueName(), self.clickedNametag)
|
||||
self.accept(self.nametag.getUniqueId(), self.clickedNametag)
|
||||
|
||||
def removeActive(self):
|
||||
if base.wantNametags:
|
||||
|
@ -632,7 +591,7 @@ class Avatar(Actor, ShadowCaster):
|
|||
pass
|
||||
|
||||
self.nametag.unmanage(base.marginManager)
|
||||
self.ignore(self.nametag.getUniqueName())
|
||||
self.ignore(self.nametag.getUniqueId())
|
||||
|
||||
def loop(self, animName, restart = 1, partName = None, fromFrame = None, toFrame = None):
|
||||
return Actor.loop(self, animName, restart, partName, fromFrame, toFrame)
|
||||
|
|
|
@ -5,7 +5,7 @@ import sys, os
|
|||
|
||||
import ToonDNA
|
||||
from toontown.hood import ZoneUtil
|
||||
from toontown.nametag import NametagGlobals
|
||||
from otp.nametag.NametagGroup import *
|
||||
from toontown.toonbase import TTLocalizer
|
||||
from toontown.toonbase import ToontownBattleGlobals
|
||||
from toontown.toonbase import ToontownGlobals
|
||||
|
@ -177,7 +177,7 @@ def createLocalNPC(npcId):
|
|||
npc = Toon.Toon()
|
||||
npc.setName(name)
|
||||
npc.setPickable(0)
|
||||
npc.setPlayerType(NametagGlobals.CCNonPlayer)
|
||||
npc.setPlayerType(NametagGroup.CCNonPlayer)
|
||||
dna = ToonDNA.ToonDNA()
|
||||
if dnaType == 'r':
|
||||
dnaList = getRandomDNA(npcId, gender)
|
||||
|
|
|
@ -20,9 +20,9 @@ import ToontownGlobals
|
|||
import ToontownLoader
|
||||
from otp.otpbase import OTPBase
|
||||
from otp.otpbase import OTPGlobals
|
||||
from toontown.margins import MarginGlobals
|
||||
from toontown.margins.MarginManager import MarginManager
|
||||
from toontown.nametag import NametagGlobals
|
||||
from otp.nametag.ChatBalloon import ChatBalloon
|
||||
from otp.nametag import NametagGlobals
|
||||
from otp.margins.MarginManager import MarginManager
|
||||
from toontown.toonbase import TTLocalizer
|
||||
from toontown.toonbase import ToontownBattleGlobals
|
||||
from toontown.toontowngui import TTDialog
|
||||
|
@ -155,8 +155,6 @@ class ToonBase(OTPBase.OTPBase):
|
|||
def windowEvent(self, win):
|
||||
OTPBase.OTPBase.windowEvent(self, win)
|
||||
|
||||
MarginGlobals.updateMarginVisibles()
|
||||
|
||||
def setCursorAndIcon(self):
|
||||
tempdir = tempfile.mkdtemp()
|
||||
atexit.register(shutil.rmtree, tempdir)
|
||||
|
@ -247,54 +245,80 @@ class ToonBase(OTPBase.OTPBase):
|
|||
self.screenshotStr += str
|
||||
|
||||
def initNametagGlobals(self):
|
||||
NametagGlobals.setMe(base.cam)
|
||||
|
||||
NametagGlobals.setCardModel('phase_3/models/props/panel.bam')
|
||||
NametagGlobals.setArrowModel('phase_3/models/props/arrow.bam')
|
||||
NametagGlobals.setChatBalloon3dModel('phase_3/models/props/chatbox.bam')
|
||||
NametagGlobals.setChatBalloon2dModel('phase_3/models/props/chatbox_noarrow.bam')
|
||||
NametagGlobals.setThoughtBalloonModel('phase_3/models/props/chatbox_thought_cutout.bam')
|
||||
|
||||
chatButtonGui = loader.loadModel('phase_3/models/gui/chat_button_gui.bam')
|
||||
NametagGlobals.setPageButton(
|
||||
chatButtonGui.find('**/Horiz_Arrow_UP'), chatButtonGui.find('**/Horiz_Arrow_DN'),
|
||||
chatButtonGui.find('**/Horiz_Arrow_Rllvr'), chatButtonGui.find('**/Horiz_Arrow_UP'))
|
||||
NametagGlobals.setQuitButton(
|
||||
chatButtonGui.find('**/CloseBtn_UP'), chatButtonGui.find('**/CloseBtn_DN'),
|
||||
chatButtonGui.find('**/CloseBtn_Rllvr'), chatButtonGui.find('**/CloseBtn_UP'))
|
||||
chatButtonGui.removeNode()
|
||||
|
||||
arrow = loader.loadModel('phase_3/models/props/arrow')
|
||||
card = loader.loadModel('phase_3/models/props/panel')
|
||||
speech3d = ChatBalloon(loader.loadModel('phase_3/models/props/chatbox'))
|
||||
thought3d = ChatBalloon(loader.loadModel('phase_3/models/props/chatbox_thought_cutout'))
|
||||
speech2d = ChatBalloon(loader.loadModel('phase_3/models/props/chatbox_noarrow'))
|
||||
chatButtonGui = loader.loadModel('phase_3/models/gui/chat_button_gui')
|
||||
NametagGlobals.setCamera(self.cam)
|
||||
NametagGlobals.setArrowModel(arrow)
|
||||
NametagGlobals.setNametagCard(card, VBase4(-0.5, 0.5, -0.5, 0.5))
|
||||
if self.mouseWatcherNode:
|
||||
NametagGlobals.setMouseWatcher(self.mouseWatcherNode)
|
||||
NametagGlobals.setSpeechBalloon3d(speech3d)
|
||||
NametagGlobals.setThoughtBalloon3d(thought3d)
|
||||
NametagGlobals.setSpeechBalloon2d(speech2d)
|
||||
NametagGlobals.setThoughtBalloon2d(thought3d)
|
||||
NametagGlobals.setPageButton(PGButton.SReady, chatButtonGui.find('**/Horiz_Arrow_UP'))
|
||||
NametagGlobals.setPageButton(PGButton.SDepressed, chatButtonGui.find('**/Horiz_Arrow_DN'))
|
||||
NametagGlobals.setPageButton(PGButton.SRollover, chatButtonGui.find('**/Horiz_Arrow_Rllvr'))
|
||||
NametagGlobals.setQuitButton(PGButton.SReady, chatButtonGui.find('**/CloseBtn_UP'))
|
||||
NametagGlobals.setQuitButton(PGButton.SDepressed, chatButtonGui.find('**/CloseBtn_DN'))
|
||||
NametagGlobals.setQuitButton(PGButton.SRollover, chatButtonGui.find('**/CloseBtn_Rllvr'))
|
||||
rolloverSound = DirectGuiGlobals.getDefaultRolloverSound()
|
||||
if rolloverSound is not None:
|
||||
if rolloverSound:
|
||||
NametagGlobals.setRolloverSound(rolloverSound)
|
||||
clickSound = DirectGuiGlobals.getDefaultClickSound()
|
||||
if clickSound is not None:
|
||||
if clickSound:
|
||||
NametagGlobals.setClickSound(clickSound)
|
||||
NametagGlobals.setToon(self.cam)
|
||||
|
||||
self.marginManager = MarginManager()
|
||||
self.margins = self.aspect2d.attachNewNode(
|
||||
self.marginManager, DirectGuiGlobals.MIDGROUND_SORT_INDEX + 1)
|
||||
self.margins = self.aspect2d.attachNewNode(self.marginManager, DirectGuiGlobals.MIDGROUND_SORT_INDEX + 1)
|
||||
mm = self.marginManager
|
||||
|
||||
# TODO: Dynamicaly add more and reposition cells
|
||||
padding = 0.0225
|
||||
|
||||
# Order: Top to bottom
|
||||
self.leftCells = [
|
||||
self.marginManager.addCell(0.1, -0.6, self.a2dTopLeft),
|
||||
self.marginManager.addCell(0.1, -1.0, self.a2dTopLeft),
|
||||
self.marginManager.addCell(0.1, -1.4, self.a2dTopLeft)
|
||||
]
|
||||
self.bottomCells = [
|
||||
self.marginManager.addCell(0.4, 0.1, self.a2dBottomCenter),
|
||||
self.marginManager.addCell(-0.4, 0.1, self.a2dBottomCenter),
|
||||
self.marginManager.addCell(-1.0, 0.1, self.a2dBottomCenter),
|
||||
self.marginManager.addCell(1.0, 0.1, self.a2dBottomCenter)
|
||||
]
|
||||
self.rightCells = [
|
||||
self.marginManager.addCell(-0.1, -0.6, self.a2dTopRight),
|
||||
self.marginManager.addCell(-0.1, -1.0, self.a2dTopRight),
|
||||
self.marginManager.addCell(-0.1, -1.4, self.a2dTopRight)
|
||||
mm.addGridCell(0.2 + padding, -0.45, base.a2dTopLeft), # Above boarding groups
|
||||
mm.addGridCell(0.2 + padding, -0.9, base.a2dTopLeft), # 1
|
||||
mm.addGridCell(0.2 + padding, -1.35, base.a2dTopLeft) # Below Boarding Groups
|
||||
]
|
||||
|
||||
def setCellsActive(self, cells, active):
|
||||
for cell in cells:
|
||||
cell.setActive(active)
|
||||
self.marginManager.reorganize()
|
||||
# Order: Left to right
|
||||
self.bottomCells = [
|
||||
mm.addGridCell(-0.87, 0.2 + padding, base.a2dBottomCenter), # To the right of the laff meter
|
||||
mm.addGridCell(-0.43, 0.2 + padding, base.a2dBottomCenter), # 1
|
||||
mm.addGridCell(0.01, 0.2 + padding, base.a2dBottomCenter), # 2
|
||||
mm.addGridCell(0.45, 0.2 + padding, base.a2dBottomCenter), # 3
|
||||
mm.addGridCell(0.89, 0.2 + padding, base.a2dBottomCenter) # To the left of the shtiker book
|
||||
]
|
||||
|
||||
# Order: Bottom to top
|
||||
self.rightCells = [
|
||||
mm.addGridCell(-0.2 - padding, -1.35, base.a2dTopRight), # Above the street map
|
||||
mm.addGridCell(-0.2 - padding, -0.9, base.a2dTopRight), # Below the friends list
|
||||
mm.addGridCell(-0.2 - padding, -0.45, base.a2dTopRight) # Behind the friends list
|
||||
]
|
||||
|
||||
def hideFriendMargins(self):
|
||||
middleCell = self.rightCells[1]
|
||||
topCell = self.rightCells[2]
|
||||
|
||||
self.setCellsAvailable([middleCell, topCell], False)
|
||||
|
||||
def showFriendMargins(self):
|
||||
middleCell = self.rightCells[1]
|
||||
topCell = self.rightCells[2]
|
||||
|
||||
self.setCellsAvailable([middleCell, topCell], True)
|
||||
|
||||
def setCellsAvailable(self, cell_list, available):
|
||||
for cell in cell_list:
|
||||
self.marginManager.setCellAvailable(cell, available)
|
||||
|
||||
def startShow(self, cr):
|
||||
self.cr = cr
|
||||
|
|
Loading…
Reference in a new issue