Пример #1
0
 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
 def __init__(self, whisperPopup):
     Clickable2d.__init__(self, 'WhisperQuitButton')
     self.whisperPopup = whisperPopup
     self.contents.setScale(self.CONTENTS_SCALE)
     self.contents.hide()
     self.nodePath = None
     self.update()
    def setClickState(self, clickState):
        if self.isClickable():
            self.applyClickState(clickState)
        else:
            self.applyClickState(PGButton.SInactive)

        Clickable2d.setClickState(self, clickState)
    def setClickState(self, clickState):
        if self.isClickable():
            self.applyClickState(clickState)
        else:
            self.applyClickState(PGButton.SInactive)

        Clickable2d.setClickState(self, clickState)
Пример #5
0
    def destroy(self):
        self.ignoreAll()

        if self.nodePath is not None:
            self.nodePath.removeNode()
            self.nodePath = None

        Clickable2d.destroy(self)
Пример #6
0
    def destroy(self):
        self.ignoreAll()

        if self.nodePath is not None:
            self.nodePath.removeNode()
            self.nodePath = None

        Clickable2d.destroy(self)
Пример #7
0
 def setClickState(self, clickState):
     self.applyClickState(clickState)
     if self.isHovering() or self.whisperPopup.isHovering():
         self.contents.show()
     elif self.clickState == PGButton.SDepressed:
         self.contents.show()
     else:
         self.contents.hide()
     Clickable2d.setClickState(self, clickState)
Пример #8
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)
Пример #9
0
 def destroy(self):
     self.ignoreAll()
     Nametag.destroy(self)
     if self.textNodePath is not None:
         self.textNodePath.removeNode()
         self.textNodePath = None
     if self.arrow is not None:
         self.arrow.removeNode()
         self.arrow = None
     Clickable2d.destroy(self)
Пример #10
0
    def setClickState(self, clickState):
        self.applyClickState(clickState)

        if self.isHovering() or self.whisperPopup.isHovering():
            self.contents.show()
        elif self.clickState == PGButton.SDepressed:
            self.contents.show()
        else:
            self.contents.hide()

        Clickable2d.setClickState(self, clickState)
Пример #11
0
    def __init__(self, whisperPopup):
        Clickable2d.__init__(self, 'WhisperQuitButton')

        self.whisperPopup = whisperPopup

        self.contents.setScale(self.CONTENTS_SCALE)
        self.contents.hide()

        self.nodePath = None

        self.update()
Пример #12
0
 def setClickState(self, clickState):
     if self.isClickable():
         self.applyClickState(clickState)
     else:
         self.applyClickState(PGButton.SInactive)
     if self.isHovering() or self.quitButton.isHovering():
         self.quitButton.contents.show()
     elif self.quitButton.getClickState() == PGButton.SDepressed:
         self.quitButton.contents.show()
     else:
         self.quitButton.contents.hide()
     Clickable2d.setClickState(self, clickState)
Пример #13
0
 def destroy(self):
     self.ignoreAll()
     if self.timeoutTask is not None:
         taskMgr.remove(self.timeoutTask)
         self.timeoutTask = None
     if self.chatBalloon is not None:
         self.chatBalloon.removeNode()
         self.chatBalloon = None
     if self.quitButton is not None:
         self.quitButton.destroy()
         self.quitButton = None
     self.textNode = None
     Clickable2d.destroy(self)
Пример #14
0
    def setClickState(self, clickState):
        if self.isClickable():
            self.applyClickState(clickState)
        else:
            self.applyClickState(PGButton.SInactive)

        if self.isHovering() or self.quitButton.isHovering():
            self.quitButton.contents.show()
        elif self.quitButton.getClickState() == PGButton.SDepressed:
            self.quitButton.contents.show()
        else:
            self.quitButton.contents.hide()

        Clickable2d.setClickState(self, clickState)
    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)
    def destroy(self):
        self.ignoreAll()

        Nametag.destroy(self)

        if self.textNodePath is not None:
            self.textNodePath.removeNode()
            self.textNodePath = None

        if self.arrow is not None:
            self.arrow.removeNode()
            self.arrow = None

        Clickable2d.destroy(self)
Пример #17
0
    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)
Пример #18
0
    def destroy(self):
        self.ignoreAll()

        if self.timeoutTask is not None:
            taskMgr.remove(self.timeoutTask)
            self.timeoutTask = None

        if self.chatBalloon is not None:
            self.chatBalloon.removeNode()
            self.chatBalloon = None

        if self.quitButton is not None:
            self.quitButton.destroy()
            self.quitButton = None

        self.textNode = None

        Clickable2d.destroy(self)
Пример #19
0
 def isClickable(self):
     if self.getChatText() and self.hasChatButton():
         return True
     return NametagGlobals.wantActiveNametags and Clickable2d.isClickable(self)
 def isClickable(self):
     if self.getChatText() and self.hasChatButton():
         return True
     return NametagGlobals.wantActiveNametags and Clickable2d.isClickable(self)