def announceWinner(self, winString, avId): if avId == base.localAvatar.getDoId(): sound = Sequence(Wait(2.0), Parallel(SoundInterval(self.winSound), SoundInterval(self.happyDance))) sound.start() base.cr.playGame.getPlace().setState('walk') if winString == 'Chinese Checkers': whisper = WhisperPopup(TTLocalizer.ChineseCheckersYouWon, OTPGlobals.getInterfaceFont(), WhisperPopup.WTNormal) elif winString == 'Checkers': whisper = WhisperPopup(TTLocalizer.RegularCheckersYouWon, OTPGlobals.getInterfaceFont(), WhisperPopup.WTNormal) elif winString == 'Find Four': whisper = WhisperPopup('You won a game of Find Four!', OTPGlobals.getInterfaceFont(), WhisperPopup.WTNormal) elif avId in self.cr.doId2do: stateString = self.fsm.getCurrentState().getName() if stateString == 'sitting' or stateString == 'observing': base.cr.playGame.getPlace().setState('walk') av = self.cr.doId2do[avId] if winString == 'Chinese Checkers': whisper = WhisperPopup(av.getName() + TTLocalizer.ChineseCheckersGameOf + TTLocalizer.ChineseCheckers, OTPGlobals.getInterfaceFont(), WhisperPopup.WTNormal) elif winString == 'Checkers': whisper = WhisperPopup(av.getName() + TTLocalizer.RegularCheckersGameOf + TTLocalizer.RegularCheckers, OTPGlobals.getInterfaceFont(), WhisperPopup.WTNormal) elif winString == 'Find Four': whisper = WhisperPopup(av.getName() + ' has won a game of' + ' Find Four!', OTPGlobals.getInterfaceFont(), WhisperPopup.WTNormal) if avId in self.cr.doId2do: toon = self.cr.doId2do[avId] self.winTrack = Sequence(autoFinish=1) if self.outTrack.isPlaying(): self.winTrack.append(Wait(2.0)) if avId == base.localAvatar.getDoId(): self.winTrack.append(Func(self.stopToWalk)) self.winTrack.append(ActorInterval(toon, 'happy-dance')) if avId == base.localAvatar.getDoId(): self.winTrack.append(Func(self.allowToWalk)) self.winTrack.start() whisper.manage(base.marginManager)
def announceWinner(self, winString, avId): if avId == base.localAvatar.getDoId(): sound = Sequence(Wait(2.0), Parallel(SoundInterval(self.winSound), SoundInterval(self.happyDance))) sound.start() base.cr.playGame.getPlace().setState('walk') if winString == 'Chinese Checkers': whisper = WhisperPopup(TTLocalizer.ChineseCheckersYouWon, OTPGlobals.getInterfaceFont(), WhisperPopup.WTNormal) elif winString == 'Checkers': whisper = WhisperPopup(TTLocalizer.RegularCheckersYouWon, OTPGlobals.getInterfaceFont(), WhisperPopup.WTNormal) elif winString == 'Find Four': whisper = WhisperPopup('You won a game of Find Four!', OTPGlobals.getInterfaceFont(), WhisperPopup.WTNormal) elif self.cr.doId2do.has_key(avId): stateString = self.fsm.getCurrentState().getName() if stateString == 'sitting' or stateString == 'observing': base.cr.playGame.getPlace().setState('walk') av = self.cr.doId2do[avId] if winString == 'Chinese Checkers': whisper = WhisperPopup(av.getName() + TTLocalizer.ChineseCheckersGameOf + TTLocalizer.ChineseCheckers, OTPGlobals.getInterfaceFont(), WhisperPopup.WTNormal) elif winString == 'Checkers': whisper = WhisperPopup(av.getName() + TTLocalizer.RegularCheckersGameOf + TTLocalizer.RegularCheckers, OTPGlobals.getInterfaceFont(), WhisperPopup.WTNormal) elif winString == 'Find Four': whisper = WhisperPopup(av.getName() + ' has won a game of' + ' Find Four!', OTPGlobals.getInterfaceFont(), WhisperPopup.WTNormal) if self.cr.doId2do.has_key(avId): toon = self.cr.doId2do[avId] self.winTrack = Sequence(autoFinish=1) if self.outTrack.isPlaying(): self.winTrack.append(Wait(2.0)) if avId == base.localAvatar.getDoId(): self.winTrack.append(Func(self.stopToWalk)) self.winTrack.append(ActorInterval(toon, 'happy-dance')) if avId == base.localAvatar.getDoId(): self.winTrack.append(Func(self.allowToWalk)) self.winTrack.start() whisper.manage(base.marginManager)
def __init__(self, other=None): self._name = '' try: self.Avatar_initialized return except: self.Avatar_initialized = 1 Actor.__init__(self, None, None, other, flattenable=0, setFinal=0) 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) 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() if self.ManagesNametagAmbientLightChanged: self.acceptNametagAmbientLightChange() OTPRender.renderReflection(False, self.nametag3d, 'otp_avatar_nametag', None) self.getGeomNode().showThrough(OTPRender.ShadowCameraBitmask) self.nametag3d.hide(OTPRender.ShadowCameraBitmask) self.collTube = None self.battleTube = None self.scale = 1.0 self.nametagScale = 1.0 self.height = 0.0 self.battleTubeHeight = 0.0 self.battleTubeRadius = 0.0 self.style = None self.commonChatFlags = 0 self.understandable = 1 self.setPlayerType(NametagGroup.CCNormal) self.ghostMode = 0 self.__chatParagraph = None self.__chatMessage = None self.__chatFlags = 0 self.__chatPageNumber = None self.__chatAddressee = None self.__chatDialogueList = [] self.__chatSet = 0 self.__chatLocal = 0 self.__currentDialogue = None self.whitelistChatFlags = 0 self.setBlend( frameBlend=config.GetBool('interpolate-animations', True)) return
def showHpText(self, number, bonus=0, scale=1, isBoss=0): if self.HpTextEnabled and not self.ghostMode: if number != 0: if self.hpText: self.hideHpText() self.HpTextGenerator.setFont(OTPGlobals.getSignFont()) if number < 0: self.HpTextGenerator.setText(str(number)) else: self.HpTextGenerator.setText('+' + str(number)) self.HpTextGenerator.clearShadow() self.HpTextGenerator.setAlign(TextNode.ACenter) if bonus == 1: r = 1.0 g = 1.0 b = 0 a = 1 elif bonus == 2: r = 1.0 g = 0.5 b = 0 a = 1 elif number < 0: r = 0.9 g = 0 b = 0 a = 1 else: r = 0 g = 0.9 b = 0 a = 1 elif number == 0 and isBoss == 1: if self.hpText: self.hideHpText() self.HpTextGenerator.setFont(OTPGlobals.getSignFont()) self.HpTextGenerator.setText(TTLocalizer.BossCogDoStunned) self.HpTextGenerator.clearShadow() self.HpTextGenerator.setAlign(TextNode.ACenter) r = 1.0 g = 0.5 b = 0 a = 1 self.HpTextGenerator.setTextColor(r, g, b, a) self.hpTextNode = self.HpTextGenerator.generate() self.hpText = self.attachNewNode(self.hpTextNode) self.hpText.setScale(scale) self.hpText.setBillboardPointEye() self.hpText.setBin('fixed', 100) self.hpText.setPos(0, 0, self.height / 2) self.hpTextSeq = Sequence( self.hpText.posInterval(1.0, Point3(0, 0, self.height + 1.5), blendType='easeOut'), Wait(0.85), self.hpText.colorInterval(0.1, Vec4(r, g, b, 0)), Func(self.hideHpText)) self.hpTextSeq.start()
def getFontByName(self, fontname): if fontname == 'default': return TextNode.getDefaultFont() elif fontname == 'interface': return OTPGlobals.getInterfaceFont() elif fontname == 'sign': return OTPGlobals.getSignFont() else: return None
def __init__(self, other=None): try: self.Avatar_initialized return except: self.Avatar_initialized = 1 Actor.__init__(self, None, None, other, flattenable=0, setFinal=1) self.setBlend(frameBlend=base.wantSmoothAnims) self.setLODAnimation(base.lodMaxRange, base.lodMinRange, base.lodDelayFactor) ShadowCaster.__init__(self) self.name = '' self.npcType = None self.__font = 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.nametag3d = self.attachNewNode('nametag3d') self.nametag3d.setTag('cam', 'nametag') self.nametag3d.setLightOff() if self.ManagesNametagAmbientLightChanged: self.acceptNametagAmbientLightChange() OTPRender.renderReflection(False, self.nametag3d, 'otp_avatar_nametag', None) self.getGeomNode().showThrough(OTPRender.ShadowCameraBitmask) self.nametag3d.hide(OTPRender.ShadowCameraBitmask) self.collTube = None self.battleTube = None self.scale = 1.0 self.nametagScale = 1.0 self.height = 0.0 self.battleTubeHeight = 0.0 self.battleTubeRadius = 0.0 self.style = None self.commonChatFlags = 0 self.understandable = 1 self.setPlayerType(NametagGlobals.CCNormal) self.ghostMode = 0 self.__chatParagraph = None self.__chatMessage = None self.__chatFlags = 0 self.__chatPageNumber = None self.__chatAddressee = None self.__chatDialogueList = [] self.__chatSet = 0 self.__chatLocal = 0 self.__chatQuitButton = False self.__currentDialogue = None self.whitelistChatFlags = 0
def getFontByName(self, fontname): if fontname == "default": return TextNode.getDefaultFont() elif fontname == "interface": return OTPGlobals.getInterfaceFont() elif fontname == "sign": return OTPGlobals.getSignFont() else: return None
def getFontByName(self, fontname): if fontname == "default": return TextNode.getDefaultFont() elif fontname == "interface": return OTPGlobals.getInterfaceFont() elif fontname == "sign": return OTPGlobals.getSignFont() else: return None return None
def __init__(self, other = None): self.name = '' try: self.Avatar_initialized return except: self.Avatar_initialized = 1 Actor.__init__(self, None, None, other, flattenable=0, setFinal=0) 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) 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() if self.ManagesNametagAmbientLightChanged: self.acceptNametagAmbientLightChange() OTPRender.renderReflection(False, self.nametag3d, 'otp_avatar_nametag', None) self.getGeomNode().showThrough(OTPRender.ShadowCameraBitmask) self.nametag3d.hide(OTPRender.ShadowCameraBitmask) self.collTube = None self.battleTube = None self.scale = 1.0 self.nametagScale = 1.0 self.height = 0.0 self.battleTubeHeight = 0.0 self.battleTubeRadius = 0.0 self.style = None self.commonChatFlags = 0 self.understandable = 1 self.setPlayerType(NametagGroup.CCNormal) self.ghostMode = 0 self.__chatParagraph = None self.__chatMessage = None self.__chatFlags = 0 self.__chatPageNumber = None self.__chatAddressee = None self.__chatDialogueList = [] self.__chatSet = 0 self.__chatLocal = 0 self.__currentDialogue = None self.whitelistChatFlags = 0 self.wantAdminTag = True return
def load(self): self.notify.debug('load') masterScale = 0.8 textScale = 0.1 * masterScale entryScale = 0.08 * masterScale lineHeight = 0.21 * masterScale buttonScale = 1.15 * masterScale buttonLineHeight = 0.14 * masterScale self.frame = DirectFrame(parent=aspect2d, relief=None, sortOrder=20) self.frame.hide() linePos = -0.26 self.nameLabel = DirectLabel(parent=self.frame, relief=None, pos=(-0.21, 0, linePos), text=OTPLocalizer.LoginScreenUserName, text_scale=textScale, text_align=TextNode.ARight) self.nameEntry = DirectEntry(parent=self.frame, relief=DGG.SUNKEN, borderWidth=(0.1, 0.1), scale=entryScale, pos=(-0.125, 0.0, linePos), width=OTPGlobals.maxLoginWidth, numLines=1, focus=0, cursorKeys=1) linePos -= lineHeight self.passwordLabel = DirectLabel(parent=self.frame, relief=None, pos=(-0.21, 0, linePos), text=OTPLocalizer.LoginScreenPassword, text_scale=textScale, text_align=TextNode.ARight) self.passwordEntry = DirectEntry(parent=self.frame, relief=DGG.SUNKEN, borderWidth=(0.1, 0.1), scale=entryScale, pos=(-0.125, 0.0, linePos), width=OTPGlobals.maxLoginWidth, numLines=1, focus=0, cursorKeys=1, obscured=1, command=self.__handleLoginPassword) linePos -= lineHeight buttonImageScale = (1.7, 1.1, 1.1) self.loginButton = DirectButton(parent=self.frame, relief=DGG.RAISED, borderWidth=(0.01, 0.01), pos=(0, 0, linePos), scale=buttonScale, text=OTPLocalizer.LoginScreenLogin, text_scale=0.06, text_pos=(0, -0.02), command=self.__handleLoginButton) linePos -= buttonLineHeight self.createAccountButton = DirectButton(parent=self.frame, relief=DGG.RAISED, borderWidth=(0.01, 0.01), pos=(0, 0, linePos), scale=buttonScale, text=OTPLocalizer.LoginScreenCreateAccount, text_scale=0.06, text_pos=(0, -0.02), command=self.__handleCreateAccount) linePos -= buttonLineHeight self.quitButton = DirectButton(parent=self.frame, relief=DGG.RAISED, borderWidth=(0.01, 0.01), pos=(0, 0, linePos), scale=buttonScale, text=OTPLocalizer.LoginScreenQuit, text_scale=0.06, text_pos=(0, -0.02), command=self.__handleQuit) linePos -= buttonLineHeight self.dialogDoneEvent = 'loginDialogAck' dialogClass = OTPGlobals.getGlobalDialogClass() self.dialog = dialogClass(dialogName='loginDialog', doneEvent=self.dialogDoneEvent, message='', style=OTPDialog.Acknowledge, sortOrder=NO_FADE_SORT_INDEX + 100) self.dialog.hide() self.failDialog = DirectFrame(parent=aspect2dp, relief=DGG.RAISED, borderWidth=(0.01, 0.01), pos=(0, 0.1, 0), text='', text_scale=0.08, text_pos=(0.0, 0.3), text_wordwrap=15, sortOrder=NO_FADE_SORT_INDEX) linePos = -0.05 self.failTryAgainButton = DirectButton(parent=self.failDialog, relief=DGG.RAISED, borderWidth=(0.01, 0.01), pos=(0, 0, linePos), scale=0.9, text=OTPLocalizer.LoginScreenTryAgain, text_scale=0.06, text_pos=(0, -0.02), command=self.__handleFailTryAgain) linePos -= buttonLineHeight self.failCreateAccountButton = DirectButton(parent=self.failDialog, relief=DGG.RAISED, borderWidth=(0.01, 0.01), pos=(0, 0, linePos), scale=0.9, text=OTPLocalizer.LoginScreenCreateAccount, text_scale=0.06, text_pos=(0, -0.02), command=self.__handleFailCreateAccount) linePos -= buttonLineHeight self.failDialog.hide() self.connectionProblemDialogDoneEvent = 'loginConnectionProblemDlgAck' dialogClass = OTPGlobals.getGlobalDialogClass() self.connectionProblemDialog = dialogClass(dialogName='connectionProblemDialog', doneEvent=self.connectionProblemDialogDoneEvent, message='', style=OTPDialog.Acknowledge, sortOrder=NO_FADE_SORT_INDEX + 100) self.connectionProblemDialog.hide() return
def __createNametag(self, parent): if self.nametagGroup == None: self.nametagGroup = NametagGroup() interfaceFont = OTPGlobals.getInterfaceFont() self.nametagGroup.setFont(interfaceFont) self.nametagGroup.setChatFont(interfaceFont) self.nametagGroup.setActive(False) self.nametagGroup.setAvatar(self.partyPlannerHead) self.nametagGroup.manage(base.marginManager) nametagColor = NametagGlobals.NametagColors[NametagGlobals.CCNonPlayer] self.nametagGroup.setNametagColor(nametagColor) self.nametagGroup.setArrowColor(nametagColor) chatColor = NametagGlobals.ChatColors[NametagGlobals.CCNonPlayer] self.nametagGroup.setChatColor(chatColor) nametag2d = self.nametagGroup.getNametag2d() nametag2d.hideNametag() nametag2d.hideChat() self.nametagNode = NametagFloat2d() self.nametagNode.hideChat() self.nametagGroup.add(self.nametagNode) self.nametagGroup.setText(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.hideNametag() self.chatNode.showThought() self.nametagGroup.add(self.chatNode) self.nametagGroup.setChatText(TTLocalizer.PartyPlannerInstructions) 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) self.nametagGroup.updateAll()
def showHpString(self, text, duration=0.84999999999999998, scale=0.69999999999999996): if self.HpTextEnabled and not (self.ghostMode): if text != "": if self.hpText: self.hideHpText() self.HpTextGenerator.setFont(OTPGlobals.getSignFont()) self.HpTextGenerator.setText(text) self.HpTextGenerator.clearShadow() self.HpTextGenerator.setAlign(TextNode.ACenter) r = 1.0 a = 1.0 g = 0.0 b = 0.0 self.HpTextGenerator.setTextColor(r, g, b, a) self.hpTextNode = self.HpTextGenerator.generate() self.hpText = self.attachNewNode(self.hpTextNode) self.hpText.setScale(scale) self.hpText.setBillboardAxis() self.hpText.setPos(0, 0, self.height / 2) seq = Task.sequence( self.hpText.lerpPos(Point3(0, 0, self.height + 1.5), 1.0, blendType="easeOut"), Task.pause(duration), self.hpText.lerpColor(Vec4(r, g, b, a), Vec4(r, g, b, 0), 0.10000000000000001), Task.Task(self.hideHpTextTask), ) taskMgr.add(seq, self.uniqueName("hpText"))
def showScoreText(self, number, scale = 1.25): if not number == 0: if self.scoreText: self.hideScoreText() self.ScoreTextGenerator.setFont(OTPGlobals.getSignFont()) if number < 0: self.ScoreTextGenerator.setText(str(number)) else: self.ScoreTextGenerator.setText('+' + str(number)) self.ScoreTextGenerator.clearShadow() self.ScoreTextGenerator.setAlign(TextNode.ACenter) if number < 0: r, g, b, a = (0.9, 0, 0, 1) else: r, g, b, a = (0.9, 0.9, 0, 1) self.scoreTextNode = self.ScoreTextGenerator.generate() self.scoreText = self.toon.attachNewNode(self.scoreTextNode) self.scoreText.setScale(scale) self.scoreText.setBillboardPointEye() self.scoreText.setBin('fixed', 100) self.scoreText.setPos(0, 0, self.toon.height / 2) self.scoreText.setTransparency(1) self.scoreText.setColor(r, g, b, a) self.scoreText.setDepthTest(0) self.scoreText.setDepthWrite(0) seq = Task.sequence(self.scoreText.lerpPos(Point3(0, 0, self.toon.height + 2), 0.5, blendType='easeOut'), self.scoreText.lerpColor(Vec4(r, g, b, a), Vec4(r, g, b, 0), 0.25), Task(self.hideScoreTextTask)) taskMgr.add(seq, self.game.uniqueName('scoreText'))
def tie(self): self.tieSequence = Sequence(autoFinish=1) self.clockNode.stop() self.clockNode.hide() self.isMyTurn = False self.moveSequence.finish() if self.turnText: self.turnText.hide() for x in range(41): self.tieSequence.append( Parallel( LerpColorInterval( self.locatorList[x], 0.14999999999999999, Vec4(0.5, 0.5, 0.5, 0.5), Vec4(1, 1, 1, 1) ), LerpColorInterval( self.locatorList[x], 0.14999999999999999, Vec4(1, 1, 1, 1), Vec4(0.5, 0.5, 0.5, 0.5) ), ) ) whisper = WhisperPopup( "This Find Four game has resulted in a Tie!", OTPGlobals.getInterfaceFont(), WhisperPopup.WTNormal ) whisper.manage(base.marginManager) self.tieSequence.start()
def showHpString(self, text, duration=0.85, scale=0.7): if self.HpTextEnabled and not self.ghostMode: if text != '': if self.hpText: self.hideHpText() self.HpTextGenerator.setFont(OTPGlobals.getSignFont()) self.HpTextGenerator.setText(text) self.HpTextGenerator.clearShadow() self.HpTextGenerator.setAlign(TextNode.ACenter) r = a = 1.0 g = b = 0.0 self.HpTextGenerator.setTextColor(r, g, b, a) self.hpTextNode = self.HpTextGenerator.generate() self.hpText = self.attachNewNode(self.hpTextNode) self.hpText.setScale(scale) self.hpText.setBillboardAxis() self.hpText.setPos(0, 0, self.height / 2) seq = Task.sequence( self.hpText.lerpPos(Point3(0, 0, self.height + 1.5), 1.0, blendType='easeOut'), Task.pause(duration), self.hpText.lerpColor(Vec4(r, g, b, a), Vec4(r, g, b, 0), 0.1), Task.Task(self.hideHpTextTask)) taskMgr.add(seq, self.uniqueName('hpText'))
def whisperFrom(self, fromId, message): assert self.notify.debugCall() #messenger.send("chat", [fromId, message, chatFlags]) if base.cr.wantSwitchboardHacks: print("received whisper on avatar: %s" % message) whisper = WhisperPopup(message,OTPGlobals.getInterfaceFont(),WhisperPopup.WTNormal) whisper.manage(base.marginManager)
def __init__(self, entryOptions, parent = None, **kw): FSM.FSM.__init__(self, 'ChatInputWhiteListFrame') self.receiverId = None DirectFrame.__init__(self, parent=aspect2dp, pos=(0, 0, 0.3), relief=None, image=DGG.getDefaultDialogGeom(), image_scale=(1.6, 1, 1.4), image_pos=(0, 0, -0.05), image_color=OTPGlobals.GlobalDialogColor, borderWidth=(0.01, 0.01)) optiondefs = {'parent': self, 'relief': DGG.SUNKEN, 'scale': 0.05, 'frameSize': (-0.2, 25.3, -0.5, 1.2), 'borderWidth': (0.1, 0.1), 'frameColor': (0.9, 0.9, 0.85, 0.8), 'pos': (-0.2, 0, 0.11), 'entryFont': OTPGlobals.getInterfaceFont(), 'width': 8.6, 'numLines': 3, 'cursorKeys': 1, 'backgroundFocus': 0, 'suppressKeys': 1, 'suppressMouse': 1, 'command': self.sendChat, 'focus': 0, 'text': '', 'sortOrder': DGG.FOREGROUND_SORT_INDEX} entryOptions['parent'] = self self.chatEntry = DirectEntry(**entryOptions) self.whisperId = None self.chatEntry.bind(DGG.OVERFLOW, self.chatOverflow) self.active = 0 self.autoOff = 0 self.sendBy = 'Mode' from direct.gui import DirectGuiGlobals self.chatEntry.bind(DirectGuiGlobals.TYPE, self.applyFilter) self.chatEntry.bind(DirectGuiGlobals.ERASE, self.applyFilter)
def loadSign(self): self.sign = self.root.attachNewNode('%sSign' % self.activityName) self.defaultSignModel = loader.loadModel( 'phase_13/models/parties/eventSign') self.signModel = self.defaultSignModel.copyTo(self.sign) self.signFlat = self.signModel.find('**/sign_flat') self.signFlatWithNote = self.signModel.find('**/sign_withNote') self.signTextLocator = self.signModel.find('**/signText_locator') self.activityIconsModel = loader.loadModel( 'phase_4/models/parties/eventSignIcons') textureNodePath = self.activityIconsModel.find('**/PartyJukebox40Icon') textureNodePath.setPos(0.0, -0.02, 2.2) textureNodePath.setScale(2.35) textureNodePath.copyTo(self.signFlat) textureNodePath.copyTo(self.signFlatWithNote) text = TextNode('noteText') text.setTextColor(0.2, 0.1, 0.7, 1.0) text.setAlign(TextNode.ACenter) text.setFont(OTPGlobals.getInterfaceFont()) text.setWordwrap(10.0) text.setText('') self.noteText = self.signFlatWithNote.attachNewNode(text) self.noteText.setPosHpr(self.signTextLocator, 0.0, 0.0, 0.2, 0.0, 0.0, 0.0) self.noteText.setScale(0.2) self.signFlatWithNote.stash() self.signTextLocator.stash()
def systemMessage(self, message): whisper = WhisperPopup(message, OTPGlobals.getInterfaceFont(), WTSystem) whisper.manage(base.marginManager) # play the system message sound effect base.playSfx(base.loader.loadSfx('phase_3/audio/sfx/clock03.ogg'))
def showHpString(self, text, duration=0.85, scale=0.7): if self.HpTextEnabled and not self.ghostMode: if text != '': if self.hpText: self.hideHpText() self.HpTextGenerator.setFont(OTPGlobals.getSignFont()) self.HpTextGenerator.setText(text) self.HpTextGenerator.clearShadow() self.HpTextGenerator.setAlign(TextNode.ACenter) r = a = 1.0 g = b = 0.0 self.HpTextGenerator.setTextColor(r, g, b, a) self.hpTextNode = self.HpTextGenerator.generate() self.hpText = self.attachNewNode(self.hpTextNode) self.hpText.setScale(scale) self.hpText.setBillboardAxis() self.hpText.setPos(0, 0, self.height / 2) seq = Sequence( self.hpText.posInterval(1.0, Point3(0, 0, self.height + 1.5), blendType='easeOut'), Wait(duration), self.hpText.colorInterval(0.1, Vec4(r, g, b, 0)), Func(self.hideHpText)) seq.start()
def __init__(self, useImage=True, highlightNearEnd=True): if useImage: image = self.getImage() else: image = None DirectFrame.__init__(self, state=DGG.DISABLED, relief=None, scale=0.45, image=image, image_pos=(0, 0, 0), text='0', text_fg=(0, 0, 0, 1), text_font=OTPGlobals.getInterfaceFont(), text_pos=(-0.01, -0.15), text_scale=0.35) self.initialiseoptions(OTPTimer) self.timerId = OTPTimer.TimerId OTPTimer.TimerId += 1 self.highlightNearEnd = highlightNearEnd self.countdownTask = None self.currentTime = 0 self.taskTime = 0.0 self.setFontColor(Vec4(0, 0, 0, 1)) return
def avatarListFailed(self, reason): self.ignore('avatarListFailed') self.ignore('avatarList') dialogClass = OTPGlobals.getGlobalDialogClass() self.avatarListFailedBox = dialogClass(message = PLocalizer.CRAvatarListFailed, doneEvent = 'avatarListFailedAck', text_wordwrap = 18, style = OTPDialog.Acknowledge) self.avatarListFailedBox.show() self.acceptOnce('avatarListFailedAck', self._PiratesClientRepository__handleAvatarListFailedAck)
def showScoreText(self, number, scale=1.25): if not number == 0: if self.scoreText: self.hideScoreText() self.ScoreTextGenerator.setFont(OTPGlobals.getSignFont()) if number < 0: self.ScoreTextGenerator.setText(str(number)) else: self.ScoreTextGenerator.setText('+' + str(number)) self.ScoreTextGenerator.clearShadow() self.ScoreTextGenerator.setAlign(TextNode.ACenter) if number < 0: r, g, b, a = (0.9, 0, 0, 1) else: r, g, b, a = (0.9, 0.9, 0, 1) self.scoreTextNode = self.ScoreTextGenerator.generate() self.scoreText = self.toon.attachNewNode(self.scoreTextNode) self.scoreText.setScale(scale) self.scoreText.setBillboardPointEye() self.scoreText.setBin('fixed', 100) self.scoreText.setPos(0, 0, self.toon.height / 2) self.scoreText.setTransparency(1) self.scoreText.setColor(r, g, b, a) self.scoreText.setDepthTest(0) self.scoreText.setDepthWrite(0) seq = Sequence( self.scoreText.posInterval(0.5, Point3(0, 0, self.toon.height + 2), blendType='easeOut'), self.scoreText.colorInterval(0.25, Vec4(r, g, b, 0)), Func(self.hideScoreText)) seq.start()
def showScoreText(self, number, scale=1.25): if not number == 0: if self.scoreText: self.hideScoreText() self.ScoreTextGenerator.setFont(OTPGlobals.getSignFont()) if number < 0: self.ScoreTextGenerator.setText(str(number)) else: self.ScoreTextGenerator.setText('+' + str(number)) self.ScoreTextGenerator.clearShadow() self.ScoreTextGenerator.setAlign(TextNode.ACenter) if number < 0: (r, g, b, a) = (0.90000000000000002, 0, 0, 1) else: (r, g, b, a) = (0.90000000000000002, 0.90000000000000002, 0, 1) self.scoreTextNode = self.ScoreTextGenerator.generate() self.scoreText = self.toon.attachNewNode(self.scoreTextNode) self.scoreText.setScale(scale) self.scoreText.setBillboardPointEye() self.scoreText.setBin('fixed', 100) self.scoreText.setPos(0, 0, self.toon.height / 2) self.scoreText.setTransparency(1) self.scoreText.setColor(r, g, b, a) self.scoreText.setDepthTest(0) self.scoreText.setDepthWrite(0) seq = Task.sequence( self.scoreText.lerpPos(Point3(0, 0, self.toon.height + 2), 0.5, blendType='easeOut'), self.scoreText.lerpColor(Vec4(r, g, b, a), Vec4(r, g, b, 0), 0.25), Task(self.hideScoreTextTask)) taskMgr.add(seq, self.game.uniqueName('scoreText'))
def __showWaitingForDatabase(self, requestName): GuiScreen.notify.info('timed out waiting for %s at %s' % (requestName, globalClock.getFrameTime())) dialogClass = OTPGlobals.getDialogClass() self.waitingForDatabase = dialogClass(text=OTPLocalizer.GuiScreenToontownUnavailable, dialogName='WaitingForDatabase', buttonTextList=[OTPLocalizer.GuiScreenCancel], style=OTPDialog.Acknowledge, command=self.__handleCancelWaiting) self.waitingForDatabase.show() taskMgr.doMethodLater(OTPGlobals.DatabaseGiveupTimeout, self.__giveUpWaitingForDatabase, 'waitingForDatabase', extraArgs=[requestName]) return Task.done
def showScoreText(self, number, scale = 1.25): if not number == 0: if self.scoreText: self.hideScoreText() self.ScoreTextGenerator.setFont(OTPGlobals.getSignFont()) if number < 0: self.ScoreTextGenerator.setText(str(number)) else: self.ScoreTextGenerator.setText('+' + str(number)) self.ScoreTextGenerator.clearShadow() self.ScoreTextGenerator.setAlign(TextNode.ACenter) if number < 0: r, g, b, a = (0.9, 0, 0, 1) else: r, g, b, a = (0.9, 0.9, 0, 1) self.scoreTextNode = self.ScoreTextGenerator.generate() self.scoreText = self.toon.attachNewNode(self.scoreTextNode) self.scoreText.setScale(scale) self.scoreText.setBillboardPointEye() self.scoreText.setBin('fixed', 100) self.scoreText.setPos(0, 0, self.toon.height / 2) self.scoreText.setTransparency(1) self.scoreText.setColor(r, g, b, a) self.scoreText.setDepthTest(0) self.scoreText.setDepthWrite(0) seq = Sequence(self.scoreText.posInterval(0.5, Point3(0, 0, self.toon.height + 2), blendType='easeOut'), self.scoreText.colorInterval(0.25, Vec4(r, g, b, 0)), Func(self.hideScoreText)) seq.start()
def __createNametag(self, parent): if self.nametagGroup == None: self.nametagGroup = NametagGroup() self.nametagGroup.setFont(OTPGlobals.getInterfaceFont()) 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.upcastToPandaNode()) 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.upcastToPandaNode()) 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 loadSign(self): actNameForSign = self.activityName if self.activityId == PartyGlobals.ActivityIds.PartyJukebox40: actNameForSign = PartyGlobals.ActivityIds.getString(PartyGlobals.ActivityIds.PartyJukebox) elif self.activityId == PartyGlobals.ActivityIds.PartyDance20: actNameForSign = PartyGlobals.ActivityIds.getString(PartyGlobals.ActivityIds.PartyDance) self.sign = self.root.attachNewNode('%sSign' % self.activityName) self.signModel = self.party.defaultSignModel.copyTo(self.sign) self.signFlat = self.signModel.find('**/sign_flat') self.signFlatWithNote = self.signModel.find('**/sign_withNote') self.signTextLocator = self.signModel.find('**/signText_locator') textureNodePath = getPartyActivityIcon(self.party.activityIconsModel, actNameForSign) textureNodePath.setPos(0.0, -0.02, 2.2) textureNodePath.setScale(2.35) textureNodePath.copyTo(self.signFlat) textureNodePath.copyTo(self.signFlatWithNote) text = TextNode('noteText') text.setTextColor(0.2, 0.1, 0.7, 1.0) text.setAlign(TextNode.ACenter) text.setFont(OTPGlobals.getInterfaceFont()) text.setWordwrap(10.0) text.setText('') self.noteText = self.signFlatWithNote.attachNewNode(text) self.noteText.setPosHpr(self.signTextLocator, 0.0, 0.0, 0.2, 0.0, 0.0, 0.0) self.noteText.setScale(0.2) self.signFlatWithNote.stash() self.signTextLocator.stash()
def __init__(self, parent, minSat, maxSat, minVal, maxVal, callback, pos=(0, 0, 0)): NodePath.__init__(self, 'colorPicker') self.reparentTo(parent) self.setPos(pos) self.minSat = minSat self.maxSat = maxSat self.minVal = minVal self.maxVal = maxVal self.callback = callback self.lastColor = None self.image = PNMImage(int((self.maxSat - self.minSat) * 100), int((self.maxVal - self.minVal) * 100)) self.slider = DirectSlider(self, relief=None, image='phase_3/maps/color_picker_hue.jpg', scale=0.3, pos=(0.2, 0, 0), image_scale=(0.1, 1.0, 1.0), pageSize=5, orientation=DGG.VERTICAL, command=self.__chooseHue) self.button = DirectButton(self, relief=None, image=OTPGlobals.getTransparentTexture(), scale=0.3, pos=(-0.2, 0, 0), frameColor=(1, 1, 1, 0.1), pressEffect=0) self.button.bind(DGG.B1PRESS, self.__startPick) self.button.bind(DGG.B1RELEASE, self.__stopPick) self.__chooseHue() return
def load(self): self.notify.debug('load') masterScale = 0.80000000000000004 textScale = 0.10000000000000001 * masterScale entryScale = 0.080000000000000002 * masterScale lineHeight = 0.20999999999999999 * masterScale buttonScale = 1.3 * masterScale buttonLineHeight = 0.16 * masterScale self.frame = DirectFrame(parent = aspect2d, relief = None) self.frame.hide() linePos = 0.5 linePos -= lineHeight self.nameLabel = DirectLabel(parent = self.frame, relief = None, pos = (-0.20999999999999999, 0, linePos), text = OTPLocalizer.CreateAccountScreenUserName, text_scale = textScale, text_align = TextNode.ARight, text_fg = self.labelFg, text_shadow = (0, 0, 0, 1), text_shadowOffset = (0.080000000000000002, 0.080000000000000002)) self.nameEntry = DirectEntry(parent = self.frame, relief = DGG.SUNKEN, borderWidth = (0.10000000000000001, 0.10000000000000001), scale = entryScale, pos = (-0.125, 0.0, linePos), width = OTPGlobals.maxLoginWidth, numLines = 1, focus = 0, cursorKeys = 1) self.nameEntry.label = self.nameLabel linePos -= lineHeight self.passwordLabel = DirectLabel(parent = self.frame, relief = None, pos = (-0.20999999999999999, 0, linePos), text = OTPLocalizer.CreateAccountScreenPassword, text_scale = textScale, text_align = TextNode.ARight, text_fg = self.labelFg, text_shadow = (0, 0, 0, 1), text_shadowOffset = (0.080000000000000002, 0.080000000000000002)) self.passwordEntry = DirectEntry(parent = self.frame, relief = DGG.SUNKEN, borderWidth = (0.10000000000000001, 0.10000000000000001), scale = entryScale, pos = (-0.125, 0.0, linePos), width = OTPGlobals.maxLoginWidth, numLines = 1, focus = 0, cursorKeys = 1, obscured = 1) self.passwordEntry.label = self.passwordLabel linePos -= lineHeight self.passwordConfirmLabel = DirectLabel(parent = self.frame, relief = None, pos = (-0.20999999999999999, 0, linePos), text = OTPLocalizer.CreateAccountScreenConfirmPassword, text_scale = textScale, text_align = TextNode.ARight, text_fg = self.labelFg, text_shadow = (0, 0, 0, 1), text_shadowOffset = (0.080000000000000002, 0.080000000000000002)) self.passwordConfirmEntry = DirectEntry(parent = self.frame, relief = DGG.SUNKEN, borderWidth = (0.10000000000000001, 0.10000000000000001), scale = entryScale, pos = (-0.125, 0.0, linePos), width = OTPGlobals.maxLoginWidth, numLines = 1, focus = 0, cursorKeys = 1, obscured = 1) self.passwordConfirmEntry.label = self.passwordConfirmLabel linePos -= lineHeight linePos -= lineHeight self.submitButton = DirectButton(parent = self.frame, relief = DGG.RAISED, borderWidth = (0.01, 0.01), pos = (0, 0, linePos), scale = buttonScale, text = OTPLocalizer.CreateAccountScreenSubmit, text_scale = 0.059999999999999998, text_pos = (0, -0.02), command = self._CreateAccountScreen__handleSubmit) linePos -= buttonLineHeight self.cancelButton = DirectButton(parent = self.frame, relief = DGG.RAISED, borderWidth = (0.01, 0.01), pos = (0, 0, linePos), scale = buttonScale, text = OTPLocalizer.CreateAccountScreenCancel, text_scale = 0.059999999999999998, text_pos = (0, -0.02), command = self._CreateAccountScreen__handleCancel) linePos -= buttonLineHeight self.dialogDoneEvent = 'createAccountDialogAck' dialogClass = OTPGlobals.getGlobalDialogClass() self.dialog = dialogClass(dialogName = 'createAccountDialog', doneEvent = self.dialogDoneEvent, message = '', style = OTPDialog.Acknowledge, sortOrder = NO_FADE_SORT_INDEX + 100) self.dialog.hide()
def loadSign(self): actNameForSign = self.activityName if self.activityId == PartyGlobals.ActivityIds.PartyJukebox40: actNameForSign = PartyGlobals.ActivityIds.getString( PartyGlobals.ActivityIds.PartyJukebox) elif self.activityId == PartyGlobals.ActivityIds.PartyDance20: actNameForSign = PartyGlobals.ActivityIds.getString( PartyGlobals.ActivityIds.PartyDance) self.sign = self.root.attachNewNode('%sSign' % self.activityName) self.signModel = self.party.defaultSignModel.copyTo(self.sign) self.signFlat = self.signModel.find('**/sign_flat') self.signFlatWithNote = self.signModel.find('**/sign_withNote') self.signTextLocator = self.signModel.find('**/signText_locator') textureNodePath = getPartyActivityIcon(self.party.activityIconsModel, actNameForSign) textureNodePath.setPos(0.0, -0.02, 2.2) textureNodePath.setScale(2.35) textureNodePath.copyTo(self.signFlat) textureNodePath.copyTo(self.signFlatWithNote) text = TextNode('noteText') text.setTextColor(0.2, 0.1, 0.7, 1.0) text.setAlign(TextNode.ACenter) text.setFont(OTPGlobals.getInterfaceFont()) text.setWordwrap(10.0) text.setText('') self.noteText = self.signFlatWithNote.attachNewNode(text) self.noteText.setPosHpr(self.signTextLocator, 0.0, 0.0, 0.2, 0.0, 0.0, 0.0) self.noteText.setScale(0.2) self.signFlatWithNote.stash() self.signTextLocator.stash()
def load(self): self.notify.debug('load') masterScale = 0.8 textScale = 0.1 * masterScale entryScale = 0.08 * masterScale lineHeight = 0.21 * masterScale buttonScale = 1.3 * masterScale buttonLineHeight = 0.16 * masterScale self.frame = DirectFrame(parent=aspect2d, relief=None) self.frame.hide() linePos = 0.5 linePos -= lineHeight self.nameLabel = DirectLabel(parent=self.frame, relief=None, pos=(-0.21, 0, linePos), text=OTPLocalizer.CreateAccountScreenUserName, text_scale=textScale, text_align=TextNode.ARight, text_fg=self.labelFg, text_shadow=(0, 0, 0, 1), text_shadowOffset=(0.08, 0.08)) self.nameEntry = DirectEntry(parent=self.frame, relief=DGG.SUNKEN, borderWidth=(0.1, 0.1), scale=entryScale, pos=(-0.125, 0.0, linePos), width=OTPGlobals.maxLoginWidth, numLines=1, focus=0, cursorKeys=1) self.nameEntry.label = self.nameLabel linePos -= lineHeight self.passwordLabel = DirectLabel(parent=self.frame, relief=None, pos=(-0.21, 0, linePos), text=OTPLocalizer.CreateAccountScreenPassword, text_scale=textScale, text_align=TextNode.ARight, text_fg=self.labelFg, text_shadow=(0, 0, 0, 1), text_shadowOffset=(0.08, 0.08)) self.passwordEntry = DirectEntry(parent=self.frame, relief=DGG.SUNKEN, borderWidth=(0.1, 0.1), scale=entryScale, pos=(-0.125, 0.0, linePos), width=OTPGlobals.maxLoginWidth, numLines=1, focus=0, cursorKeys=1, obscured=1) self.passwordEntry.label = self.passwordLabel linePos -= lineHeight self.passwordConfirmLabel = DirectLabel(parent=self.frame, relief=None, pos=(-0.21, 0, linePos), text=OTPLocalizer.CreateAccountScreenConfirmPassword, text_scale=textScale, text_align=TextNode.ARight, text_fg=self.labelFg, text_shadow=(0, 0, 0, 1), text_shadowOffset=(0.08, 0.08)) self.passwordConfirmEntry = DirectEntry(parent=self.frame, relief=DGG.SUNKEN, borderWidth=(0.1, 0.1), scale=entryScale, pos=(-0.125, 0.0, linePos), width=OTPGlobals.maxLoginWidth, numLines=1, focus=0, cursorKeys=1, obscured=1) self.passwordConfirmEntry.label = self.passwordConfirmLabel linePos -= lineHeight linePos -= lineHeight self.submitButton = DirectButton(parent=self.frame, relief=DGG.RAISED, borderWidth=(0.01, 0.01), pos=(0, 0, linePos), scale=buttonScale, text=OTPLocalizer.CreateAccountScreenSubmit, text_scale=0.06, text_pos=(0, -0.02), command=self.__handleSubmit) linePos -= buttonLineHeight self.cancelButton = DirectButton(parent=self.frame, relief=DGG.RAISED, borderWidth=(0.01, 0.01), pos=(0, 0, linePos), scale=buttonScale, text=OTPLocalizer.CreateAccountScreenCancel, text_scale=0.06, text_pos=(0, -0.02), command=self.__handleCancel) linePos -= buttonLineHeight self.dialogDoneEvent = 'createAccountDialogAck' dialogClass = OTPGlobals.getGlobalDialogClass() self.dialog = dialogClass(dialogName='createAccountDialog', doneEvent=self.dialogDoneEvent, message='', style=OTPDialog.Acknowledge, sortOrder=NO_FADE_SORT_INDEX + 100) self.dialog.hide() return
def systemMessage(self, message): whisper = WhisperPopup(message, OTPGlobals.getInterfaceFont(), WTSystem) whisper.manage(base.marginManager) if self.systemMessageSfx is None: self.systemMessageSfx = base.loadSfx('phase_3/audio/sfx/clock03.ogg') base.playSfx(self.systemMessageSfx)
def systemMessage(self, message): whisper = WhisperPopup(message, OTPGlobals.getInterfaceFont(), WTSystem) whisper.manage(base.marginManager) if hasattr(base.cr, 'chatLog'): base.cr.chatLog.addToLog( '\x01orangeText\x01System Message: %s\x02' % message) base.playSfx(base.loader.loadSfx('phase_3/audio/sfx/clock03.ogg'))
def __init__(self, listOfNames, doneEvent, usedNames): StateData.StateData.__init__(self, doneEvent) self.listOfNames = listOfNames self.doneEvent = doneEvent self.avId = -1 self.tumblerList = {} # Keep Track of Used Names self.usedNames = usedNames # Get Appropriate Font self.interfaceFont = OTPGlobals.getInterfaceFont() self.signFont = OTPGlobals.getSignFont() self.nameEntryFont = OTPGlobals.getInterfaceFont() # Stores the Current Name String self.name = "" self.nameIsChecked = 0 # nameAction is used later in NameShop # 0 = DefaultName Mode # 1 = PickAName Mode # 2 = TypeAName Mode self.nameAction = 0 # Add an fsm to NameShop to handle PayState, PickAName, TypeAName, # NameAccepted, NameRejected, and NameCouncil self.fsm = ClassicFSM.ClassicFSM( 'NameShop', [ State.State('Init', self.enterInit, self.exitInit, ['PickAName']), State.State('PickAName', self.enterPickANameState, self.exitPickANameState, ['TypeAName', 'Done']), State.State('TypeAName', self.enterTypeANameState, self.exitTypeANameState, ['PickAName', 'Done']), State.State('Done', self.enterDone, self.exitDone, ['Init']) ], # Initial state 'Init', # Final state 'Done', )
def showHpText(self, number, bonus = 0, scale = 1, attackTrack = -1): if self.HpTextEnabled and not self.ghostMode: if number != 0: if self.hpText: self.hideHpText() self.HpTextGenerator.setFont(OTPGlobals.getSignFont()) if number < 0: self.HpTextGenerator.setText(str(number)) if config.GetBool('silly-surge-text', True) and random.randrange(0, 100) < config.GetInt('silly-surge-chance', 10): self.sillySurgeText = True absNumber = int(abs(number) / 10) if len(TTLocalizer.SillySurgeTerms) > absNumber: self.HpTextGenerator.setText(str(number) + '\n' + TTLocalizer.SillySurgeTerms[absNumber]) else: self.HpTextGenerator.setText(str(number) + '\n' + random.choice(TTLocalizer.SillySurgeTerms)) if self.interactivePropTrackBonus > -1 and self.interactivePropTrackBonus == attackTrack: self.sillySurgeText = True if attackTrack in TTLocalizer.InteractivePropTrackBonusTerms: self.HpTextGenerator.setText(str(number) + '\n' + TTLocalizer.InteractivePropTrackBonusTerms[attackTrack]) else: self.HpTextGenerator.setText('+' + str(number)) self.HpTextGenerator.clearShadow() self.HpTextGenerator.setAlign(TextNode.ACenter) if bonus == 1: color = [1, 1, 0, 1] elif bonus == 2: color = [1, 0.5, 0, 1] elif number < 0: color = [0.9, 0, 0, 1] if self.interactivePropTrackBonus > -1 and self.interactivePropTrackBonus == attackTrack: color = [0, 0, 1, 1] else: color = [0, 0.9, 0, 1] self.HpTextGenerator.setTextColor(*color) self.hpTextNode = self.HpTextGenerator.generate() self.hpText = self.attachNewNode(self.hpTextNode) self.hpText.setScale(scale) self.hpText.setBillboardPointEye() self.hpText.setBin('fixed', 100) if self.sillySurgeText: self.nametag3d.setDepthTest(0) self.nametag3d.setBin('fixed', 99) self.hpText.setPos(0, 0, self.height / 2) color[3] = 0 Sequence(self.hpText.posInterval(1.0, Point3(0, 0, self.height + 1.5), blendType='easeOut'), Wait(0.85), self.hpText.colorInterval(0.1, Vec4(*color), 0.1), Func(self.hideHpText)).start()
def __init__(self, parent=None, **kw): FSM.FSM.__init__(self, 'ChatInputWhiteList') optiondefs = ( ('parent', parent, None), ('relief', DGG.SUNKEN, None), ('text_scale', 0.03, None), ('frameSize', (-0.2, 25.3, -0.5, 1.2), None), ('borderWidth', (0.003, 0.003), None), ('frameColor', (0.9, 0.9, 0.85, 0.8), None), ('entryFont', OTPGlobals.getInterfaceFont(), None), ('width', 25, None), ('numLines', 1, None), ('cursorKeys', 1, None), ('backgroundFocus', 0, None), ('suppressKeys', 1, None), ('suppressMouse', 1, None), ('command', self.sendChat, None), ('failedCommand', self.sendFailed, None), ('focus', 0, None), ('text', '', None), ) self.defineoptions(kw, optiondefs) DirectEntry.__init__(self, parent=parent, **kw) self.initialiseoptions(ChatInputWhiteList) self.whisperId = None #self.bind(DGG.OVERFLOW, self.chatOverflow) wantHistory = 0 if __dev__: wantHistory = 1 self.wantHistory = base.config.GetBool('want-chat-history', wantHistory) self.history = [''] self.historySize = base.config.GetInt('chat-history-size', 10) self.historyIndex = 0 self.whiteList = None self.active = 0 self.autoOff = 0 self.alwaysSubmit = False from direct.gui import DirectGuiGlobals self.bind(DirectGuiGlobals.TYPE, self.applyFilter) self.bind(DirectGuiGlobals.ERASE, self.applyFilter) tpMgr = TextPropertiesManager.getGlobalPtr() Red = tpMgr.getProperties('red') Red.setTextColor(1.0, 0.0, 0.0, 1) tpMgr.setProperties('WLRed', Red) del tpMgr self.origFrameColor = self['frameColor'] self.origTextScale = self['text_scale'] self.origFrameSize = self['frameSize']
def __init__(self, secretType): GuiPanel.GuiPanel.__init__(self, 'Secret Codes!!! Arg!!', 1.6000000000000001, 1.2) StateData.StateData.__init__(self, 'friend-secret-done') self.initialiseoptions(FriendSecret) self.prefix = OTPGlobals.getDefaultProductPrefix() self.secretType = secretType self.notify.debug('### secretType = %s' % self.secretType) self.requestedSecretType = secretType self.notify.debug('### requestedSecretType = %s' % self.requestedSecretType)
def __init__(self, secretType): DirectFrame.__init__(self, parent=aspect2dp, pos=(0, 0, 0.3), relief=None, image=DGG.getDefaultDialogGeom(), image_scale=(1.6, 1, 1.4), image_pos=(0, 0, -0.05), image_color=OTPGlobals.GlobalDialogColor, borderWidth=(0.01, 0.01)) StateData.StateData.__init__(self, 'friend-secret-done') self.initialiseoptions(FriendSecret) self.prefix = OTPGlobals.getDefaultProductPrefix() self.secretType = secretType self.notify.debug('### secretType = %s' % self.secretType) self.requestedSecretType = secretType self.notify.debug('### requestedSecretType = %s' % self.requestedSecretType)
def __init__(self, secretType): DirectFrame.__init__(self, parent = aspect2dp, pos = (0, 0, 0.29999999999999999), relief = None, image = DGG.getDefaultDialogGeom(), image_scale = (1.6000000000000001, 1, 1.3999999999999999), image_pos = (0, 0, -0.050000000000000003), image_color = OTPGlobals.GlobalDialogColor, borderWidth = (0.01, 0.01)) StateData.StateData.__init__(self, 'friend-secret-done') self.initialiseoptions(FriendSecret) self.prefix = OTPGlobals.getDefaultProductPrefix() self.secretType = secretType self.notify.debug('### secretType = %s' % self.secretType) self.requestedSecretType = secretType self.notify.debug('### requestedSecretType = %s' % self.requestedSecretType)
def avatarListFailed(self, reason): dialogClass = OTPGlobals.getGlobalDialogClass() self.avatarListFailedBox = dialogClass( message=PLocalizer.CRAvatarListFailed, doneEvent='avatarListFailedAck', text_wordwrap=18, style=OTPDialog.Acknowledge) self.avatarListFailedBox.show() self.acceptOnce('avatarListFailedAck', self.__handleAvatarListFailedAck)
def __init__(self, entryOptions, parent = None, **kw): FSM.FSM.__init__(self, 'ChatInputWhiteListFrame') self.okayToSubmit = True self.receiverId = None DirectFrame.__init__(self, parent = aspect2dp, pos = (0, 0, 0.29999999999999999), relief = None, image = DGG.getDefaultDialogGeom(), image_scale = (1.6000000000000001, 1, 1.3999999999999999), image_pos = (0, 0, -0.050000000000000003), image_color = OTPGlobals.GlobalDialogColor, borderWidth = (0.01, 0.01)) optiondefs = { 'parent': self, 'relief': DGG.SUNKEN, 'scale': 0.050000000000000003, 'frameSize': (-0.20000000000000001, 25.300000000000001, -0.5, 1.2), 'borderWidth': (0.10000000000000001, 0.10000000000000001), 'frameColor': (0.90000000000000002, 0.90000000000000002, 0.84999999999999998, 0.80000000000000004), 'pos': (-0.20000000000000001, 0, 0.11), 'entryFont': OTPGlobals.getInterfaceFont(), 'width': 8.5999999999999996, 'numLines': 3, 'cursorKeys': 1, 'backgroundFocus': 0, 'suppressKeys': 1, 'suppressMouse': 1, 'command': self.sendChat, 'failedCommand': self.sendFailed, 'focus': 0, 'text': '', 'sortOrder': DGG.FOREGROUND_SORT_INDEX } entryOptions['parent'] = self self.chatEntry = DirectEntry(**None) self.whisperId = None self.chatEntry.bind(DGG.OVERFLOW, self.chatOverflow) wantHistory = 0 if __dev__: wantHistory = 1 self.wantHistory = base.config.GetBool('want-chat-history', wantHistory) self.history = [ ''] self.historySize = base.config.GetInt('chat-history-size', 10) self.historyIndex = 0 self.promoteWhiteList = 0 self.checkBeforeSend = base.config.GetBool('white-list-check-before-send', 0) self.whiteList = None self.active = 0 self.autoOff = 0 self.sendBy = 'Mode' self.prefilter = 1 DirectGuiGlobals = DirectGuiGlobals import direct.gui self.chatEntry.bind(DirectGuiGlobals.TYPE, self.applyFilter) self.chatEntry.bind(DirectGuiGlobals.ERASE, self.applyFilter) tpMgr = TextPropertiesManager.getGlobalPtr() Red = tpMgr.getProperties('red') Red.setTextColor(1.0, 0.0, 0.0, 1) tpMgr.setProperties('WLRed', Red) del tpMgr self.origFrameColor = self.chatEntry['frameColor']
def displayWhisper(self, fromId, chatString, whisperType): sender = None sfx = self.soundWhisper if whisperType == WTNormal or whisperType == WTQuickTalker: if sender == None: return chatString = sender.getName() + ': ' + chatString whisper = WhisperPopup(chatString, OTPGlobals.getInterfaceFont(), whisperType) if sender != None: whisper.setClickable(sender.getName(), fromId) whisper.manage(base.marginManager) base.playSfx(sfx)
def load(self): self.notify.debug('load') masterScale = 0.8 textScale = 0.1 * masterScale entryScale = 0.08 * masterScale lineHeight = 0.21 * masterScale buttonScale = 1.15 * masterScale buttonLineHeight = 0.14 * masterScale self.frame = DirectFrame(parent=aspect2d, relief=None, sortOrder=20) self.frame.hide() linePos = -0.26 self.nameLabel = DirectLabel(parent=self.frame, relief=None, pos=(-0.21, 0, linePos), text=OTPLocalizer.LoginScreenUserName, text_scale=textScale, text_align=TextNode.ARight) self.nameEntry = DirectEntry(parent=self.frame, relief=DGG.SUNKEN, borderWidth=(0.1, 0.1), scale=entryScale, pos=(-0.125, 0.0, linePos), width=OTPGlobals.maxLoginWidth, numLines=1, focus=0, cursorKeys=1) linePos -= lineHeight self.passwordLabel = DirectLabel(parent=self.frame, relief=None, pos=(-0.21, 0, linePos), text=OTPLocalizer.LoginScreenPassword, text_scale=textScale, text_align=TextNode.ARight) self.passwordEntry = DirectEntry(parent=self.frame, relief=DGG.SUNKEN, borderWidth=(0.1, 0.1), scale=entryScale, pos=(-0.125, 0.0, linePos), width=OTPGlobals.maxLoginWidth, numLines=1, focus=0, cursorKeys=1, obscured=1, command=self.__handleLoginPassword) linePos -= lineHeight buttonImageScale = (1.7, 1.1, 1.1) self.loginButton = DirectButton(parent=self.frame, relief=DGG.RAISED, borderWidth=(0.01, 0.01), pos=(0, 0, linePos), scale=buttonScale, text=OTPLocalizer.LoginScreenLogin, text_scale=0.06, text_pos=(0, -0.02), command=self.__handleLoginButton) linePos -= buttonLineHeight self.createAccountButton = DirectButton(parent=self.frame, relief=DGG.RAISED, borderWidth=(0.01, 0.01), pos=(0, 0, linePos), scale=buttonScale, text=OTPLocalizer.LoginScreenCreateAccount, text_scale=0.06, text_pos=(0, -0.02), command=self.__handleCreateAccount) linePos -= buttonLineHeight self.quitButton = DirectButton(parent=self.frame, relief=DGG.RAISED, borderWidth=(0.01, 0.01), pos=(0, 0, linePos), scale=buttonScale, text=OTPLocalizer.LoginScreenQuit, text_scale=0.06, text_pos=(0, -0.02), command=self.__handleQuit) linePos -= buttonLineHeight self.dialogDoneEvent = 'loginDialogAck' dialogClass = OTPGlobals.getGlobalDialogClass() self.dialog = dialogClass(dialogName='loginDialog', doneEvent=self.dialogDoneEvent, message='', style=OTPDialog.Acknowledge, sortOrder=NO_FADE_SORT_INDEX + 100) self.dialog.hide() self.failDialog = DirectFrame(parent=aspect2dp, relief=DGG.RAISED, borderWidth=(0.01, 0.01), pos=(0, 0.1, 0), text='', text_scale=0.08, text_pos=(0.0, 0.3), text_wordwrap=15, sortOrder=NO_FADE_SORT_INDEX) linePos = -.05 self.failTryAgainButton = DirectButton(parent=self.failDialog, relief=DGG.RAISED, borderWidth=(0.01, 0.01), pos=(0, 0, linePos), scale=0.9, text=OTPLocalizer.LoginScreenTryAgain, text_scale=0.06, text_pos=(0, -.02), command=self.__handleFailTryAgain) linePos -= buttonLineHeight self.failCreateAccountButton = DirectButton(parent=self.failDialog, relief=DGG.RAISED, borderWidth=(0.01, 0.01), pos=(0, 0, linePos), scale=0.9, text=OTPLocalizer.LoginScreenCreateAccount, text_scale=0.06, text_pos=(0, -.02), command=self.__handleFailCreateAccount) linePos -= buttonLineHeight self.failDialog.hide() self.connectionProblemDialogDoneEvent = 'loginConnectionProblemDlgAck' dialogClass = OTPGlobals.getGlobalDialogClass() self.connectionProblemDialog = dialogClass(dialogName='connectionProblemDialog', doneEvent=self.connectionProblemDialogDoneEvent, message='', style=OTPDialog.Acknowledge, sortOrder=NO_FADE_SORT_INDEX + 100) self.connectionProblemDialog.hide() return
def __init__(self, chatMgr): ChatInputNormal.ChatInputNormal.__init__(self, chatMgr) gui = loader.loadModel('phase_3.5/models/gui/chat_input_gui') self.chatFrame = DirectFrame( parent=aspect2dp, image=gui.find('**/Chat_Bx_FNL'), relief=None, pos=(-1.083, 0, 0.804), state=DGG.NORMAL, sortOrder=DGG.FOREGROUND_SORT_INDEX) self.chatFrame.hide() self.chatButton = DirectButton( parent=self.chatFrame, image=(gui.find('**/ChtBx_ChtBtn_UP'), gui.find('**/ChtBx_ChtBtn_DN'), gui.find('**/ChtBx_ChtBtn_RLVR')), pos=(0.182, 0, -0.088), relief=None, text=('', OTPLocalizer.ChatInputNormalSayIt, OTPLocalizer. ChatInputNormalSayIt), text_scale=0.06, text_fg=Vec4(1, 1, 1, 1), text_shadow=Vec4(0, 0, 0, 1), text_pos=(0, -0.09), textMayChange=0, command=self.chatButtonPressed) self.cancelButton = DirectButton( parent=self.chatFrame, image=(gui.find('**/CloseBtn_UP'), gui.find('**/CloseBtn_DN'), gui.find('**/CloseBtn_Rllvr')), pos=(-0.151, 0, -0.088), relief=None, text=('', OTPLocalizer.ChatInputNormalCancel, OTPLocalizer. ChatInputNormalCancel), text_scale=0.06, text_fg=Vec4(1, 1, 1, 1), text_shadow=Vec4(0, 0, 0, 1), text_pos=(0, -0.09), textMayChange=0, command=self.cancelButtonPressed) self.whisperLabel = DirectLabel( parent=self.chatFrame, pos=(0.02, 0, 0.23), relief=DGG.FLAT, frameColor=(1, 1, 0.5, 1), frameSize=(-0.23, 0.23, -0.07, 0.05), text=OTPLocalizer.ChatInputNormalWhisper, text_scale=0.04, text_fg=Vec4(0, 0, 0, 1), text_wordwrap=9.5, textMayChange=1) self.whisperLabel.hide() self.chatEntry = DirectEntry( parent=self.chatFrame, relief=None, scale=0.05, pos=(-0.2, 0, 0.11), entryFont=OTPGlobals.getInterfaceFont(), width=8.6, numLines=3, cursorKeys=0, backgroundFocus=0, command=self.sendChat) self.chatEntry.bind(DGG.OVERFLOW, self.chatOverflow) self.chatEntry.bind(DGG.TYPE, self.typeCallback) return
def __init__(self, other = None): Actor.__init__(self, None, None, other, flattenable=0, setFinal=1) ShadowCaster.__init__(self) self.__font = OTPGlobals.getInterfaceFont() self.name = '' self.soundChatBubble = None self.avatarType = '' self.nametagNodePath = None self.__nameVisible = 1 self.nametag = NametagGroup() self.nametag.setAvatar(self) 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() self.getGeomNode().showThrough(OTPRender.ShadowCameraBitmask) self.nametag3d.hide(OTPRender.ShadowCameraBitmask) self.collTube = None self.scale = 1.0 self.height = 0.0 self.style = None self.understandable = 1 self.setPlayerType(NametagGroup.CCNormal) self.ghostMode = 0 self.__chatParagraph = None self.__chatMessage = None self.__chatFlags = 0 self.__chatPageNumber = None self.__chatAddressee = None self.__chatDialogueList = [] self.__chatSet = 0 self.__chatLocal = 0 self.__currentDialogue = None self.wantAdminTag = True
def submitSecret(self, secret): productPrefix = OTPGlobals.getDefaultProductPrefix() print secret if not self.tfCodes.has_key(secret): self.submitSecretResponse(0, 0) return secretInfo = self.tfCodes[secret] avId = self.air.getAvatarIdFromSender() av = self.air.doId2do.get(avId) friendAvId = secretInfo[0] friendAv = self.air.doId2do.get(friendAvId) if av: if friendAv: if avId == friendAvId: self.submitSecretResponse(3, 0) self.removeSecret(secret) return elif len(friendAv.getFriendsList()) == OTPGlobals.MaxFriends or len(av.getFriendsList()) == OTPGlobals.MaxFriends: self.submitSecretResponse(2, friendAvId) return else: friendAv.extendFriendsList(av.getDoId(), 1) friendAv.d_setFriendsList(friendAv.getFriendsList()) av.extendFriendsList(friendAvId, 1) av.d_setFriendsList(av.getFriendsList()) self.submitSecretResponse(1, friendAvId) self.removeSecret(secret) return else: # Friend is offline! def handleQuery(dclass, fields): if dclass != self.air.dclassesByName['DistributedToonAI']: return newFriendsList = [] oldFriendsList = fields['setFriendsList'][0] if len(oldFriendsList) == OTPGlobals.MaxFriends: self.submitSecretResponse(2, friendAvId) return for friend in oldFriendsList: newFriendsList.append(friend) newFriendsList.append((avId, 1)) self.air.dbInterface.updateObject(self.air.dbId, friendAvId, self.air.dclassesByName['DistributedToonAI'], {'setFriendsList' : [newFriendsList]}) av.extendFriendsList(friendAvId, 1) av.d_setFriendsList(av.getFriendsList()) self.submitSecretResponse(1, friendAvId) self.removeSecret(secret) self.air.dbInterface.queryObject(self.air.dbId, friendAvId, handleQuery)
def displayWhisperPlayer(self, fromId, chatString, whisperType): sender = None playerInfo = None sfx = self.soundWhisper playerInfo = base.cr.playerFriendsManager.playerId2Info.get(fromId, None) if playerInfo == None: return senderName = playerInfo.playerName if whisperType == WTNormal or whisperType == WTQuickTalker: chatString = senderName + ': ' + chatString whisper = WhisperPopup(chatString, OTPGlobals.getInterfaceFont(), whisperType) if sender != None: whisper.setClickable(senderName, fromId) whisper.manage(base.marginManager) base.playSfx(sfx)
def displayWhisper(self, fromId, chatString, whisperType): sender = None if isinstance(fromId, numbers.Number): sender = base.cr.identifyAvatar(fromId) if whisperType == WTNormal: chatString = '%s: %s' % (sender.getName(), chatString) whisper = WhisperPopup(chatString, OTPGlobals.getInterfaceFont(), whisperType) if sender or isinstance(fromId, basestring): whisper.setClickable(fromId) whisper.manage(base.marginManager) base.playSfx(self.soundSystemMessage if whisperType == WTSystem else self.soundWhisper)
def showHpText(self, number, bonus=0, scale=1): if self.HpTextEnabled and not (self.ghostMode): if number != 0: if self.hpText: self.hideHpText() self.HpTextGenerator.setFont(OTPGlobals.getSignFont()) if number < 0: self.HpTextGenerator.setText(str(number)) else: self.HpTextGenerator.setText("+" + str(number)) self.HpTextGenerator.clearShadow() self.HpTextGenerator.setAlign(TextNode.ACenter) if bonus == 1: r = 1.0 g = 1.0 b = 0 a = 1 elif bonus == 2: r = 1.0 g = 0.5 b = 0 a = 1 elif number < 0: r = 0.90000000000000002 g = 0 b = 0 a = 1 else: r = 0 g = 0.90000000000000002 b = 0 a = 1 self.HpTextGenerator.setTextColor(r, g, b, a) self.hpTextNode = self.HpTextGenerator.generate() self.hpText = self.attachNewNode(self.hpTextNode) self.hpText.setScale(scale) self.hpText.setBillboardPointEye() self.hpText.setBin("fixed", 100) self.hpText.setPos(0, 0, self.height / 2) seq = Task.sequence( self.hpText.lerpPos(Point3(0, 0, self.height + 1.5), 1.0, blendType="easeOut"), Task.pause(0.84999999999999998), self.hpText.lerpColor(Vec4(r, g, b, a), Vec4(r, g, b, 0), 0.10000000000000001), Task.Task(self.hideHpTextTask), ) taskMgr.add(seq, self.uniqueName("hpText"))
def finalize(self, dbArgs = { }): if not self.isDirty(): return None SCObject.finalize(self) if hasattr(self, 'button'): self.button.destroy() del self.button halfHeight = self.height / 2.0 textX = 0 if dbArgs.has_key('text_align'): if dbArgs['text_align'] == TextNode.ACenter: textX = self.width / 2.0 args = { 'text': self.getDisplayText(), 'frameColor': (0, 0, 0, 0), 'rolloverColor': self.getColorScheme().getRolloverColor() + (1,), 'pressedColor': self.getColorScheme().getPressedColor() + (1,), 'text_font': OTPGlobals.getInterfaceFont(), 'text_align': TextNode.ALeft, 'text_fg': self.getColorScheme().getTextColor() + (1,), 'text_pos': (textX, -0.25 - halfHeight, 0), 'relief': DGG.FLAT, 'pressEffect': 0 } args.update(dbArgs) rolloverColor = args['rolloverColor'] pressedColor = args['pressedColor'] del args['rolloverColor'] del args['pressedColor'] btn = DirectButton(parent = self, frameSize = (0, self.width, -(self.height), 0), **None) btn.frameStyle[DGG.BUTTON_ROLLOVER_STATE].setColor(*rolloverColor) btn.frameStyle[DGG.BUTTON_DEPRESSED_STATE].setColor(*pressedColor) btn.updateFrameStyle() btn.bind(DGG.ENTER, self.onMouseEnter) btn.bind(DGG.EXIT, self.onMouseLeave) btn.bind(DGG.B1PRESS, self.onMouseClick) self.button = btn self.lastWidth = self.width self.lastHeight = self.height self.validate()
def showHpString(self, text, duration = 0.85, scale = 0.7): if self.HpTextEnabled and not self.ghostMode: if text != '': if self.hpText: self.hideHpText() self.HpTextGenerator.setFont(OTPGlobals.getSignFont()) self.HpTextGenerator.setText(text) self.HpTextGenerator.clearShadow() self.HpTextGenerator.setAlign(TextNode.ACenter) r = a = 1.0 g = b = 0.0 self.HpTextGenerator.setTextColor(r, g, b, a) self.hpTextNode = self.HpTextGenerator.generate() self.hpText = self.attachNewNode(self.hpTextNode) self.hpText.setScale(scale) self.hpText.setBillboardAxis() self.hpText.setPos(0, 0, self.height / 2) seq = Sequence(self.hpText.posInterval(1.0, Point3(0, 0, self.height + 1.5), blendType='easeOut'), Wait(duration), self.hpText.colorInterval(0.1, Vec4(r, g, b, 0)), Func(self.hideHpText)) seq.start()
def __init__(self, parent = None, **kw): entryOptions = {'parent': self, 'relief': DGG.SUNKEN, 'scale': 0.05, 'frameColor': (0.9, 0.9, 0.85, 0.0), 'pos': (-0.2, 0, 0.11), 'entryFont': OTPGlobals.getInterfaceFont(), 'width': 8.6, 'numLines': 3, 'cursorKeys': 0, 'backgroundFocus': 0, 'suppressKeys': 0, 'suppressMouse': 1, 'command': self.sendChat, 'failedCommand': self.sendFailed, 'focus': 0, 'text': '', 'sortOrder': DGG.FOREGROUND_SORT_INDEX} ChatInputWhiteListFrame.__init__(self, entryOptions, parent, **kw) self.whiteList = TTWhiteList() base.whiteList = self.whiteList base.ttwl = self self.autoOff = 1 self.sendBy = 'Data' self.prefilter = 0 self.promoteWhiteList = 1 self.typeGrabbed = 0 self.deactivate() gui = loader.loadModel('phase_3.5/models/gui/chat_input_gui') self.chatFrame = DirectFrame(parent=self, image=gui.find('**/Chat_Bx_FNL'), relief=None, pos=(0.0, 0, 0.0), state=DGG.NORMAL) self.chatButton = DirectButton(parent=self.chatFrame, image=(gui.find('**/ChtBx_ChtBtn_UP'), gui.find('**/ChtBx_ChtBtn_DN'), gui.find('**/ChtBx_ChtBtn_RLVR')), pos=(0.182, 0, -0.088), relief=None, text=('', OTPLocalizer.ChatInputNormalSayIt, OTPLocalizer.ChatInputNormalSayIt), text_scale=0.06, text_fg=Vec4(1, 1, 1, 1), text_shadow=Vec4(0, 0, 0, 1), text_pos=(0, -0.09), textMayChange=0, command=self.chatButtonPressed) self.cancelButton = DirectButton(parent=self.chatFrame, image=(gui.find('**/CloseBtn_UP'), gui.find('**/CloseBtn_DN'), gui.find('**/CloseBtn_Rllvr')), pos=(-0.151, 0, -0.088), relief=None, text=('', OTPLocalizer.ChatInputNormalCancel, OTPLocalizer.ChatInputNormalCancel), text_scale=0.06, text_fg=Vec4(1, 1, 1, 1), text_shadow=Vec4(0, 0, 0, 1), text_pos=(0, -0.09), textMayChange=0, command=self.cancelButtonPressed) self.whisperLabel = DirectLabel(parent=self.chatFrame, pos=(0.02, 0, 0.23), relief=DGG.FLAT, frameColor=(1, 1, 0.5, 1), frameSize=(-0.23, 0.23, -0.07, 0.05), text=OTPLocalizer.ChatInputNormalWhisper, text_scale=0.04, text_fg=Vec4(0, 0, 0, 1), text_wordwrap=9.5, textMayChange=1) self.chatEntry.bind(DGG.OVERFLOW, self.chatOverflow) self.chatEntry.bind(DGG.TYPE, self.typeCallback) self.trueFriendChat = 0 if base.config.GetBool('whisper-to-nearby-true-friends', 1): self.accept(self.TFToggleKey, self.shiftPressed) return