コード例 #1
0
ファイル: WhisperPopup.py プロジェクト: MTTPAM/PublicRelease
 def __init__(self, text, font, whisperType, timeout = None):
     Clickable2d.__init__(self, 'WhisperPopup')
     MarginVisible.__init__(self)
     self.text = text
     self.font = font
     self.whisperType = whisperType
     if timeout is None:
         self.timeout = len(text) * 0.33
         if self.timeout < self.WHISPER_TIMEOUT_MIN:
             self.timeout = self.WHISPER_TIMEOUT_MIN
         elif self.timeout > self.WHISPER_TIMEOUT_MAX:
             self.timeout = self.WHISPER_TIMEOUT_MAX
     else:
         self.timeout = timeout
     self.active = False
     self.senderName = ''
     self.fromId = 0
     self.isPlayer = 0
     self.contents.setScale(self.CONTENTS_SCALE)
     self.whisperColor = ChatGlobals.WhisperColors[self.whisperType]
     self.textNode = TextNode('text')
     self.textNode.setWordwrap(self.TEXT_WORD_WRAP)
     self.textNode.setTextColor(self.whisperColor[PGButton.SInactive][0])
     self.textNode.setFont(self.font)
     self.textNode.setText(self.text)
     self.chatBalloon = None
     self.quitButton = None
     self.timeoutTaskName = self.getUniqueName() + '-timeout'
     self.timeoutTask = None
     self.quitEvent = self.getUniqueName() + '-quit'
     self.accept(self.quitEvent, self.destroyAnimation)
     self.setPriority(MarginGlobals.MP_high)
     self.setVisible(True)
     self.update()
     self.accept('MarginVisible-update', self.update)
コード例 #2
0
ファイル: Nametag2d.py プロジェクト: MTTPAM/PublicRelease
 def __init__(self):
     Nametag.__init__(self)
     Clickable2d.__init__(self, 'Nametag2d')
     MarginVisible.__init__(self)
     self.actualChatText = ''
     self.arrow = None
     self.textNodePath = None
     self.contents.setScale(self.CONTENTS_SCALE)
     self.hideThought()
     self.accept('MarginVisible-update', self.update)
コード例 #3
0
    def __init__(self):
        Nametag.__init__(self)
        Clickable2d.__init__(self, 'Nametag2d')
        MarginVisible.__init__(self)

        self.actualChatText = ''

        self.arrow = None
        self.textNodePath = None

        self.contents.setScale(self.CONTENTS_SCALE)
        self.hideThought()

        self.accept('MarginVisible-update', self.update)
コード例 #4
0
ファイル: WhisperPopup.py プロジェクト: CalmBit/ToonboxSource
    def __init__(self, text, font, whisperType, timeout=None):
        Clickable2d.__init__(self, 'WhisperPopup')
        MarginVisible.__init__(self)

        self.text = text
        self.font = font
        self.whisperType = whisperType
        if timeout is None:
            self.timeout = len(text) * 0.33
            if self.timeout < self.WHISPER_TIMEOUT_MIN:
                self.timeout = self.WHISPER_TIMEOUT_MIN
            elif self.timeout > self.WHISPER_TIMEOUT_MAX:
                self.timeout = self.WHISPER_TIMEOUT_MAX
        else:
            self.timeout = timeout

        self.active = False

        self.senderName = ''
        self.fromId = 0
        self.isPlayer = 0

        self.contents.setScale(self.CONTENTS_SCALE)

        self.whisperColor = ChatGlobals.WhisperColors[self.whisperType]

        self.textNode = TextNode('text')
        self.textNode.setWordwrap(self.TEXT_WORD_WRAP)
        self.textNode.setTextColor(self.whisperColor[PGButton.SInactive][0])
        self.textNode.setFont(self.font)
        self.textNode.setText(self.text)

        self.chatBalloon = None
        self.quitButton = None

        self.timeoutTaskName = self.getUniqueName() + '-timeout'
        self.timeoutTask = None

        self.quitEvent = self.getUniqueName() + '-quit'
        self.accept(self.quitEvent, self.destroy)

        self.setPriority(MarginGlobals.MP_high)
        self.setVisible(True)

        self.update()

        self.accept('MarginVisible-update', self.update)
コード例 #5
0
ファイル: WhisperPopup.py プロジェクト: CalmBit/ToonboxSource
    def unmanage(self, marginManager):
        MarginVisible.unmanage(self, marginManager)

        self.destroy()
コード例 #6
0
ファイル: WhisperPopup.py プロジェクト: CalmBit/ToonboxSource
    def manage(self, marginManager):
        MarginVisible.manage(self, marginManager)

        self.timeoutTask = taskMgr.doMethodLater(
            self.timeout, self.unmanage, self.timeoutTaskName, [marginManager])
コード例 #7
0
    def unmanage(self, marginManager):
        MarginVisible.unmanage(self, marginManager)

        self.destroy()
コード例 #8
0
    def manage(self, marginManager):
        MarginVisible.manage(self, marginManager)

        self.timeoutTask = taskMgr.doMethodLater(self.timeout, self.unmanage,
                                                 self.timeoutTaskName,
                                                 [marginManager])
コード例 #9
0
    def unmanage(self, marginManager):
        MarginVisible.unmanage(self, marginManager)

        self.destroyAnimation()