예제 #1
0
        def addMenu(graph, menuDef):
            name = menuDef[0]
            if len(menuDef) == 2:
                subMenuName = menuDef[0]
                menuType = menuDef[1]
                if menuType == QTNode.QT_QUEST_ROOT_NODE:
                    menuNode = QTQuestNode.QTQuestNode(name)
                    graph[name] = menuNode
                    return None
                elif menuType == QTNode.QT_CUSTOM_ROOT_NODE:
                    menuNode = QTCustomNode.QTCustomNode(name)
                    graph[name] = menuNode
                    return None
                elif menuType == QTNode.QT_EMOTE_NODE:
                    menuNode = QTEmoteNode.QTEmoteNode(0)
                    graph[name] = menuNode
                    return None
                elif type(menuType) == type(0):
                    menuNode = QTEmoteNode.QTEmoteNode(menuType, speaking=1)
                    graph[name] = menuNode
                    return None

            elif len(menuDef) == 3:
                subMenuName = menuDef[0]
                menuType = menuDef[1]
                menuEntries = menuDef[2]
                if menuType == QTNode.QT_EMOTE_ROOT_NODE:
                    menuNode = QTEmoteNode.QTEmoteNode(0,
                                                       emoteRoot=menuEntries)
                    graph[name] = menuNode
                    return None
                elif menuType == QTNode.QT_EMOTE_SPEAK_ROOT_NODE:
                    menuNode = QTEmoteNode.QTEmoteNode(
                        Localizer.EmoteFuncDict[string.lower(name)],
                        emoteRoot=menuEntries,
                        speaking=1,
                        emoteAnim=subMenuName)
                    graph[name] = menuNode
                    return None

            entries = menuDef[-1]
            menuNode = QTNode.QTNode(name)
            graph[name] = menuNode
            for i in entries:
                if type(i) == type(''):
                    menuNode[i] = QTNode.QTSend
                else:
                    addMenu(graph, i)
                    subMenuName = i[0]
                    graph[name] = menuNode
                    if len(i) == 3:
                        menuNode.addMenu(subMenuName, graph[subMenuName], i[1])
                    elif len(i) == 2 and type(i[1]) == type(0):
                        menuNode.addMenu(subMenuName, graph[subMenuName],
                                         QTNode.QT_TEXT_NODE)
                    else:
                        menuNode.addMenu(subMenuName, graph[subMenuName])
예제 #2
0
 def setWhisperQTCustomFrom(self, fromId, qtSequence):
     sender = toonbase.tcr.identifyAvatar(fromId)
     if sender == None:
         return
     if fromId in self.ignoreList:
         sender.d_setWhisperIgnored(self.doId)
         return
     chatString = QTCustomNode.decodeQTCustomMsg(qtSequence)
     if chatString:
         self.displayWhisper(fromId, chatString, WhisperPopup.WTQuickTalker)
     return
예제 #3
0
 def setWhisperQTCustomFrom(self, fromId, qtSequence):
     sender = toonbase.tcr.identifyAvatar(fromId)
     if sender == None:
         return None
     
     if fromId in self.ignoreList:
         sender.d_setWhisperIgnored(self.doId)
         return None
     
     chatString = QTCustomNode.decodeQTCustomMsg(qtSequence)
     if chatString:
         self.displayWhisper(fromId, chatString, WhisperPopup.WTQuickTalker)
예제 #4
0
 def setQTCustom(self, qtSequence):
     chatString = QTCustomNode.decodeQTCustomMsg(qtSequence)
     if chatString:
         self.setChatAbsolute(chatString, CFSpeech | CFQuicktalker | CFTimeout)
예제 #5
0
 def setQTCustom(self, qtSequence):
     chatString = QTCustomNode.decodeQTCustomMsg(qtSequence)
     if chatString:
         self.setChatAbsolute(chatString,
                              CFSpeech | CFQuicktalker | CFTimeout)