本文整理汇总了Python中otp.nametag.NametagGroup.NametagGroup.setChat方法的典型用法代码示例。如果您正苦于以下问题:Python NametagGroup.setChat方法的具体用法?Python NametagGroup.setChat怎么用?Python NametagGroup.setChat使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类otp.nametag.NametagGroup.NametagGroup
的用法示例。
在下文中一共展示了NametagGroup.setChat方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: Avatar
# 需要导入模块: from otp.nametag.NametagGroup import NametagGroup [as 别名]
# 或者: from otp.nametag.NametagGroup.NametagGroup import setChat [as 别名]
#.........这里部分代码省略.........
# Let's just choose a random one.
if config.GetBool('want-doomsday', False) and self.playerType == NametagGroup.CCSuit:
sfxIndex = random.choice([1, 2, 2, 2, 2, 3, 3, 3]) #Duplicates are Intentional
if sfxIndex != None and sfxIndex < len(dialogueArray) and dialogueArray[sfxIndex] != None:
base.playSfx(dialogueArray[sfxIndex], node=self)
return
def getDialogueSfx(self, type, length):
retval = None
dialogueArray = self.getDialogueArray()
if dialogueArray == None:
return
sfxIndex = None
if type == 'statementA' or type == 'statementB':
if length == 1:
sfxIndex = 0
elif length == 2:
sfxIndex = 1
elif length >= 3:
sfxIndex = 2
elif type == 'question':
sfxIndex = 3
elif type == 'exclamation':
sfxIndex = 4
elif type == 'special':
sfxIndex = 5
else:
notify.error('unrecognized dialogue type: ', type)
if sfxIndex != None and sfxIndex < len(dialogueArray) and dialogueArray[sfxIndex] != None:
retval = dialogueArray[sfxIndex]
return retval
def setChatAbsolute(self, chatString, chatFlags, dialogue = None, interrupt = 1):
self.clearChat()
self.nametag.setChat(chatString, chatFlags)
self.playCurrentDialogue(dialogue, chatFlags, interrupt)
def setChatMuted(self, chatString, chatFlags, dialogue = None, interrupt = 1, quiet = 0):
pass
def displayTalk(self, chatString):
if not base.cr.avatarFriendsManager.checkIgnored(self.doId):
if base.talkAssistant.isThought(chatString):
self.nametag.setChat(base.talkAssistant.removeThoughtPrefix(chatString), CFThought)
else:
self.nametag.setChat(chatString, CFSpeech | CFTimeout)
def clearChat(self):
self.nametag.clearChat()
def isInView(self):
pos = self.getPos(camera)
eyePos = Point3(pos[0], pos[1], pos[2] + self.getHeight())
return base.camNode.isInView(eyePos)
def getNameVisible(self):
return self.__nameVisible
def setNameVisible(self, bool):
self.__nameVisible = bool
if bool:
self.showName()
if not bool:
self.hideName()
示例2: PartyPlanner
# 需要导入模块: from otp.nametag.NametagGroup import NametagGroup [as 别名]
# 或者: from otp.nametag.NametagGroup.NametagGroup import setChat [as 别名]
#.........这里部分代码省略.........
self.invitationPage = self._createInvitationPage()
self.invitationPage.hide()
self.farewellPage = self._createFarewellPage()
self.farewellPage.hide()
return
def _createNavButtons(self):
self.quitButton = DirectButton(parent=self.frame, relief=None, geom=(self.gui.find('**/cancelButton_up'), self.gui.find('**/cancelButton_down'), self.gui.find('**/cancelButton_rollover')), command=self.__acceptExit)
self.nextButton = DirectButton(parent=self.frame, relief=None, geom=(self.gui.find('**/bottomNext_button/nextButton_up'), self.gui.find('**/bottomNext_button/nextButton_down'), self.gui.find('**/bottomNext_button/nextButton_rollover')), command=self.__nextItem, state=DirectGuiGlobals.DISABLED)
self.prevButton = DirectButton(parent=self.frame, relief=None, geom=(self.gui.find('**/bottomPrevious_button/previousButton_up'), self.gui.find('**/bottomPrevious_button/previousButton_down'), self.gui.find('**/bottomPrevious_button/previousButton_rollover')), command=self.__prevItem, state=DirectGuiGlobals.DISABLED)
self.currentItem = None
return
def __createNametag(self, parent):
if self.nametagGroup == None:
self.nametagGroup = NametagGroup()
self.nametagGroup.setFont(ToontownGlobals.getToonFont())
self.nametagGroup.setSpeechFont(ToontownGlobals.getToonFont())
self.nametagGroup.setActive(0)
self.nametagGroup.setAvatar(self.partyPlannerHead)
self.nametagGroup.manage(base.marginManager)
self.nametagGroup.setColorCode(self.nametagGroup.CCNonPlayer)
self.nametagGroup.getNametag2d().setContents(0)
self.nametagNode = NametagFloat2d()
self.nametagNode.setContents(Nametag.CName)
self.nametagGroup.addNametag(self.nametagNode)
self.nametagGroup.setName(base.cr.partyManager.getPartyPlannerName())
self.nametagNP = parent.attachNewNode(self.nametagNode)
nametagPos = self.gui.find('**/step_01_partymanPeteNametag_locator').getPos()
self.nametagNP.setPosHprScale(nametagPos[0], 0, nametagPos[2], 0, 0, 0, 0.1, 1, 0.1)
self.chatNode = NametagFloat2d()
self.chatNode.setContents(Nametag.CSpeech | Nametag.CThought)
self.nametagGroup.addNametag(self.chatNode)
self.nametagGroup.setChat(TTLocalizer.PartyPlannerInstructions, CFSpeech)
self.chatNP = parent.attachNewNode(self.chatNode)
chatPos = self.gui.find('**/step_01_partymanPeteText_locator').getPos()
self.chatNP.setPosHprScale(chatPos[0], 0, chatPos[2], 0, 0, 0, 0.08, 1, 0.08)
return
def clearNametag(self):
if self.nametagGroup != None:
self.nametagGroup.unmanage(base.marginManager)
self.nametagGroup.removeNametag(self.nametagNode)
self.nametagGroup.removeNametag(self.chatNode)
self.nametagNP.removeNode()
self.chatNP.removeNode()
del self.nametagNP
del self.chatNP
del self.nametagNode
del self.chatNode
self.nametagGroup.setAvatar(NodePath())
self.nametagGroup.destroy()
self.nametagGroup = None
return
def _createWelcomePage(self):
self.nametagGroup = None
page = DirectFrame(self.frame)
page.setName('PartyPlannerWelcomePage')
self.welcomeTitleLabel = DirectLabel(parent=page, relief=None, text=TTLocalizer.PartyPlannerWelcomeTitle, pos=self.gui.find('**/title_locator').getPos(), scale=self.titleScale)
self.partyPlannerHead = ToonHead.ToonHead()
partyPlannerStyle = base.cr.partyManager.getPartyPlannerStyle()
self.partyPlannerHead.setupHead(partyPlannerStyle, forGui=True)
self.partyPlannerHead.setPos(self.gui.find('**/step_01_partymanPete_locator').getPos())
animal = partyPlannerStyle.getAnimal()
if animal == 'cat' or animal == 'pig':