def _press_select(self, gamepad=False): base.assume_gamepad = gamepad if self._selected is None: self._press_down() else: self.buttons[self._selected]['command']() DGG.getDefaultClickSound().play()
def initNametagGlobals(self): arrow = loader.loadModel('phase_3/models/props/arrow') card = loader.loadModel('phase_3/models/props/panel') speech3d = ChatBalloon(loader.loadModel('phase_3/models/props/chatbox')) thought3d = ChatBalloon(loader.loadModel('phase_3/models/props/chatbox_thought_cutout')) speech2d = ChatBalloon(loader.loadModel('phase_3/models/props/chatbox_noarrow')) chatButtonGui = loader.loadModel('phase_3/models/gui/chat_button_gui') NametagGlobals.setCamera(self.cam) NametagGlobals.setArrowModel(arrow) NametagGlobals.setNametagCard(card, VBase4(-0.5, 0.5, -0.5, 0.5)) if self.mouseWatcherNode: NametagGlobals.setMouseWatcher(self.mouseWatcherNode) NametagGlobals.setSpeechBalloon3d(speech3d) NametagGlobals.setThoughtBalloon3d(thought3d) NametagGlobals.setSpeechBalloon2d(speech2d) NametagGlobals.setThoughtBalloon2d(thought3d) NametagGlobals.setPageButton(PGButton.SReady, chatButtonGui.find('**/Horiz_Arrow_UP')) NametagGlobals.setPageButton(PGButton.SDepressed, chatButtonGui.find('**/Horiz_Arrow_DN')) NametagGlobals.setPageButton(PGButton.SRollover, chatButtonGui.find('**/Horiz_Arrow_Rllvr')) NametagGlobals.setQuitButton(PGButton.SReady, chatButtonGui.find('**/CloseBtn_UP')) NametagGlobals.setQuitButton(PGButton.SDepressed, chatButtonGui.find('**/CloseBtn_DN')) NametagGlobals.setQuitButton(PGButton.SRollover, chatButtonGui.find('**/CloseBtn_Rllvr')) rolloverSound = DirectGuiGlobals.getDefaultRolloverSound() if rolloverSound: NametagGlobals.setRolloverSound(rolloverSound) clickSound = DirectGuiGlobals.getDefaultClickSound() if clickSound: NametagGlobals.setClickSound(clickSound) NametagGlobals.setToon(self.cam) self.marginManager = MarginManager() self.margins = self.aspect2d.attachNewNode(self.marginManager, DirectGuiGlobals.MIDGROUND_SORT_INDEX + 1) mm = self.marginManager # TODO: Dynamicaly add more and reposition cells padding = 0.0225 # Order: Top to bottom self.leftCells = [ mm.addGridCell(0.2 + padding, -0.45, base.a2dTopLeft), # Above boarding groups mm.addGridCell(0.2 + padding, -0.9, base.a2dTopLeft), # 1 mm.addGridCell(0.2 + padding, -1.35, base.a2dTopLeft) # Below Boarding Groups ] # Order: Left to right self.bottomCells = [ mm.addGridCell(-0.87, 0.2 + padding, base.a2dBottomCenter), # To the right of the laff meter mm.addGridCell(-0.43, 0.2 + padding, base.a2dBottomCenter), # 1 mm.addGridCell(0.01, 0.2 + padding, base.a2dBottomCenter), # 2 mm.addGridCell(0.45, 0.2 + padding, base.a2dBottomCenter), # 3 mm.addGridCell(0.89, 0.2 + padding, base.a2dBottomCenter) # To the left of the shtiker book ] # Order: Bottom to top self.rightCells = [ mm.addGridCell(-0.2 - padding, -1.35, base.a2dTopRight), # Above the street map mm.addGridCell(-0.2 - padding, -0.9, base.a2dTopRight), # Below the friends list mm.addGridCell(-0.2 - padding, -0.45, base.a2dTopRight) # Behind the friends list ]
def initNametagGlobals(self): arrow = loader.loadModel('phase_3/models/props/arrow') card = loader.loadModel('phase_3/models/props/panel') speech3d = ChatBalloon(loader.loadModel('phase_3/models/props/chatbox')) thought3d = ChatBalloon(loader.loadModel('phase_3/models/props/chatbox_thought_cutout')) speech2d = ChatBalloon(loader.loadModel('phase_3/models/props/chatbox_noarrow')) chatButtonGui = loader.loadModel('phase_3/models/gui/chat_button_gui') NametagGlobals.setCamera(self.cam) NametagGlobals.setArrowModel(arrow) NametagGlobals.setNametagCard(card, VBase4(-0.5, 0.5, -0.5, 0.5)) if self.mouseWatcherNode: NametagGlobals.setMouseWatcher(self.mouseWatcherNode) NametagGlobals.setSpeechBalloon3d(speech3d) NametagGlobals.setThoughtBalloon3d(thought3d) NametagGlobals.setSpeechBalloon2d(speech2d) NametagGlobals.setThoughtBalloon2d(thought3d) NametagGlobals.setPageButton(PGButton.SReady, chatButtonGui.find('**/Horiz_Arrow_UP')) NametagGlobals.setPageButton(PGButton.SDepressed, chatButtonGui.find('**/Horiz_Arrow_DN')) NametagGlobals.setPageButton(PGButton.SRollover, chatButtonGui.find('**/Horiz_Arrow_Rllvr')) NametagGlobals.setQuitButton(PGButton.SReady, chatButtonGui.find('**/CloseBtn_UP')) NametagGlobals.setQuitButton(PGButton.SDepressed, chatButtonGui.find('**/CloseBtn_DN')) NametagGlobals.setQuitButton(PGButton.SRollover, chatButtonGui.find('**/CloseBtn_Rllvr')) rolloverSound = DirectGuiGlobals.getDefaultRolloverSound() if rolloverSound: NametagGlobals.setRolloverSound(rolloverSound) clickSound = DirectGuiGlobals.getDefaultClickSound() if clickSound: NametagGlobals.setClickSound(clickSound) NametagGlobals.setToon(self.cam) self.marginManager = MarginManager() self.margins = self.aspect2d.attachNewNode(self.marginManager, DirectGuiGlobals.MIDGROUND_SORT_INDEX + 1) mm = self.marginManager # TODO: Dynamicaly add more and reposition cells padding = 0.0225 # Order: Top to bottom self.leftCells = [ mm.addGridCell(0.2 + padding, -0.45, base.a2dTopLeft), # Above boarding groups mm.addGridCell(0.2 + padding, -0.9, base.a2dTopLeft), # 1 mm.addGridCell(0.2 + padding, -1.35, base.a2dTopLeft) # Below Boarding Groups ] # Order: Left to right self.bottomCells = [ mm.addGridCell(-0.87, 0.2 + padding, base.a2dBottomCenter), # To the right of the laff meter mm.addGridCell(-0.43, 0.2 + padding, base.a2dBottomCenter), # 1 mm.addGridCell(0.01, 0.2 + padding, base.a2dBottomCenter), # 2 mm.addGridCell(0.45, 0.2 + padding, base.a2dBottomCenter), # 3 mm.addGridCell(0.89, 0.2 + padding, base.a2dBottomCenter) # To the left of the shtiker book ] # Order: Bottom to top self.rightCells = [ mm.addGridCell(-0.2 - padding, -1.35, base.a2dTopRight), # Above the street map mm.addGridCell(-0.2 - padding, -0.9, base.a2dTopRight), # Below the friends list mm.addGridCell(-0.2 - padding, -0.45, base.a2dTopRight) # Behind the friends list ]
def initNametagGlobals(self): arrow = loader.loadModel('phase_3/models/props/arrow') card = loader.loadModel('phase_3/models/props/panel') speech3d = ChatBalloon( loader.loadModel('phase_3/models/props/chatbox')) thought3d = ChatBalloon( loader.loadModel('phase_3/models/props/chatbox_thought_cutout')) speech2d = ChatBalloon( loader.loadModel('phase_3/models/props/chatbox_noarrow')) chatButtonGui = loader.loadModel('phase_3/models/gui/chat_button_gui') NametagGlobals.setCamera(self.cam) NametagGlobals.setArrowModel(arrow) NametagGlobals.setNametagCard(card, VBase4(-0.5, 0.5, -0.5, 0.5)) if self.mouseWatcherNode: NametagGlobals.setMouseWatcher(self.mouseWatcherNode) NametagGlobals.setSpeechBalloon3d(speech3d) NametagGlobals.setThoughtBalloon3d(thought3d) NametagGlobals.setSpeechBalloon2d(speech2d) NametagGlobals.setThoughtBalloon2d(thought3d) NametagGlobals.setPageButton(PGButton.SReady, chatButtonGui.find('**/Horiz_Arrow_UP')) NametagGlobals.setPageButton(PGButton.SDepressed, chatButtonGui.find('**/Horiz_Arrow_DN')) NametagGlobals.setPageButton( PGButton.SRollover, chatButtonGui.find('**/Horiz_Arrow_Rllvr')) NametagGlobals.setQuitButton(PGButton.SReady, chatButtonGui.find('**/CloseBtn_UP')) NametagGlobals.setQuitButton(PGButton.SDepressed, chatButtonGui.find('**/CloseBtn_DN')) NametagGlobals.setQuitButton(PGButton.SRollover, chatButtonGui.find('**/CloseBtn_Rllvr')) rolloverSound = DirectGuiGlobals.getDefaultRolloverSound() if rolloverSound: NametagGlobals.setRolloverSound(rolloverSound) clickSound = DirectGuiGlobals.getDefaultClickSound() if clickSound: NametagGlobals.setClickSound(clickSound) NametagGlobals.setToon(self.cam) self.marginManager = MarginManager() self.margins = self.aspect2d.attachNewNode( self.marginManager, DirectGuiGlobals.MIDGROUND_SORT_INDEX + 1) mm = self.marginManager self.leftCells = [ mm.addGridCell(0.25, -0.6, base.a2dTopLeft), mm.addGridCell(0.25, -1.0, base.a2dTopLeft), mm.addGridCell(0.25, -1.4, base.a2dTopLeft) ] self.bottomCells = [ mm.addGridCell(0.4, 0.2, base.a2dBottomCenter), mm.addGridCell(-0.4, 0.2, base.a2dBottomCenter), mm.addGridCell(-1.0, 0.2, base.a2dBottomCenter), mm.addGridCell(1.0, 0.2, base.a2dBottomCenter) ] self.rightCells = [ mm.addGridCell(-0.25, -0.6, base.a2dTopRight), mm.addGridCell(-0.25, -1.0, base.a2dTopRight), mm.addGridCell(-0.25, -1.4, base.a2dTopRight) ]
def initNametagGlobals(self): NametagGlobals.setMe(base.cam) NametagGlobals.setCardModel('phase_3/models/props/panel.bam') NametagGlobals.setArrowModel('phase_3/models/props/arrow.bam') NametagGlobals.setChatBalloon3dModel( 'phase_3/models/props/chatbox.bam') NametagGlobals.setChatBalloon2dModel( 'phase_3/models/props/chatbox_noarrow.bam') NametagGlobals.setThoughtBalloonModel( 'phase_3/models/props/chatbox_thought_cutout.bam') chatButtonGui = loader.loadModel( 'phase_3/models/gui/chat_button_gui.bam') NametagGlobals.setPageButton( chatButtonGui.find('**/Horiz_Arrow_UP'), chatButtonGui.find('**/Horiz_Arrow_DN'), chatButtonGui.find('**/Horiz_Arrow_Rllvr'), chatButtonGui.find('**/Horiz_Arrow_UP')) NametagGlobals.setQuitButton(chatButtonGui.find('**/CloseBtn_UP'), chatButtonGui.find('**/CloseBtn_DN'), chatButtonGui.find('**/CloseBtn_Rllvr'), chatButtonGui.find('**/CloseBtn_UP')) chatButtonGui.removeNode() rolloverSound = DirectGuiGlobals.getDefaultRolloverSound() if rolloverSound is not None: NametagGlobals.setRolloverSound(rolloverSound) clickSound = DirectGuiGlobals.getDefaultClickSound() if clickSound is not None: NametagGlobals.setClickSound(clickSound) self.marginManager = MarginManager() self.margins = self.aspect2d.attachNewNode( self.marginManager, DirectGuiGlobals.MIDGROUND_SORT_INDEX + 1) self.leftCells = [ self.marginManager.addCell(0.1, -0.6, self.a2dTopLeft, 1), self.marginManager.addCell(0.1, -1.0, self.a2dTopLeft, 2), self.marginManager.addCell(0.1, -1.4, self.a2dTopLeft, 3) ] self.bottomCells = [ self.marginManager.addCell(0.4, 0.1, self.a2dBottomCenter, 4), self.marginManager.addCell(-0.4, 0.1, self.a2dBottomCenter, 5), self.marginManager.addCell(-1.0, 0.1, self.a2dBottomCenter, 6), self.marginManager.addCell(1.0, 0.1, self.a2dBottomCenter, 7) ] self.rightCells = [ self.marginManager.addCell(-0.1, -0.6, self.a2dTopRight, 8), self.marginManager.addCell(-0.1, -1.0, self.a2dTopRight, 9), self.marginManager.addCell(-0.1, -1.4, self.a2dTopRight, 10) ]
def initNametagGlobals(self): NametagGlobals.setMe(base.cam) NametagGlobals.setCardModel('phase_3/models/props/panel.bam') NametagGlobals.setArrowModel('phase_3/models/props/arrow.bam') NametagGlobals.setChatBalloon3dModel('phase_3/models/props/chatbox.bam') NametagGlobals.setChatBalloon2dModel( 'phase_3/models/props/chatbox_noarrow.bam') NametagGlobals.setThoughtBalloonModel( 'phase_3/models/props/chatbox_thought_cutout.bam') chatButtonGui = loader.loadModel( 'phase_3/models/gui/chat_button_gui.bam') NametagGlobals.setPageButton( chatButtonGui.find('**/Horiz_Arrow_UP'), chatButtonGui.find('**/Horiz_Arrow_DN'), chatButtonGui.find('**/Horiz_Arrow_Rllvr'), chatButtonGui.find('**/Horiz_Arrow_UP')) NametagGlobals.setQuitButton( chatButtonGui.find('**/CloseBtn_UP'), chatButtonGui.find('**/CloseBtn_DN'), chatButtonGui.find('**/CloseBtn_Rllvr'), chatButtonGui.find('**/CloseBtn_UP')) chatButtonGui.removeNode() rolloverSound = DirectGuiGlobals.getDefaultRolloverSound() if rolloverSound is not None: NametagGlobals.setRolloverSound(rolloverSound) clickSound = DirectGuiGlobals.getDefaultClickSound() if clickSound is not None: NametagGlobals.setClickSound(clickSound) self.marginManager = MarginManager() self.margins = self.aspect2d.attachNewNode( self.marginManager, DirectGuiGlobals.MIDGROUND_SORT_INDEX + 1) self.leftCells = [ self.marginManager.addCell(0.1, -0.6, self.a2dTopLeft), self.marginManager.addCell(0.1, -1.0, self.a2dTopLeft), self.marginManager.addCell(0.1, -1.4, self.a2dTopLeft) ] self.bottomCells = [ self.marginManager.addCell(0.4, 0.1, self.a2dBottomCenter), self.marginManager.addCell(-0.4, 0.1, self.a2dBottomCenter), self.marginManager.addCell(-1.0, 0.1, self.a2dBottomCenter), self.marginManager.addCell(1.0, 0.1, self.a2dBottomCenter) ] self.rightCells = [ self.marginManager.addCell(-0.1, -0.6, self.a2dTopRight), self.marginManager.addCell(-0.1, -1.0, self.a2dTopRight), self.marginManager.addCell(-0.1, -1.4, self.a2dTopRight) ]
def initNametagGlobals(self): arrow = loader.loadModel('phase_3/models/props/arrow') card = loader.loadModel('phase_3/models/props/panel') speech3d = ChatBalloon(loader.loadModel('phase_3/models/props/chatbox')) thought3d = ChatBalloon(loader.loadModel('phase_3/models/props/chatbox_thought_cutout')) speech2d = ChatBalloon(loader.loadModel('phase_3/models/props/chatbox_noarrow')) chatButtonGui = loader.loadModel('phase_3/models/gui/chat_button_gui') NametagGlobals.setCamera(self.cam) NametagGlobals.setArrowModel(arrow) NametagGlobals.setNametagCard(card, VBase4(-0.5, 0.5, -0.5, 0.5)) if self.mouseWatcherNode: NametagGlobals.setMouseWatcher(self.mouseWatcherNode) NametagGlobals.setSpeechBalloon3d(speech3d) NametagGlobals.setThoughtBalloon3d(thought3d) NametagGlobals.setSpeechBalloon2d(speech2d) NametagGlobals.setThoughtBalloon2d(thought3d) NametagGlobals.setPageButton(PGButton.SReady, chatButtonGui.find('**/Horiz_Arrow_UP')) NametagGlobals.setPageButton(PGButton.SDepressed, chatButtonGui.find('**/Horiz_Arrow_DN')) NametagGlobals.setPageButton(PGButton.SRollover, chatButtonGui.find('**/Horiz_Arrow_Rllvr')) NametagGlobals.setQuitButton(PGButton.SReady, chatButtonGui.find('**/CloseBtn_UP')) NametagGlobals.setQuitButton(PGButton.SDepressed, chatButtonGui.find('**/CloseBtn_DN')) NametagGlobals.setQuitButton(PGButton.SRollover, chatButtonGui.find('**/CloseBtn_Rllvr')) rolloverSound = DirectGuiGlobals.getDefaultRolloverSound() if rolloverSound: NametagGlobals.setRolloverSound(rolloverSound) clickSound = DirectGuiGlobals.getDefaultClickSound() if clickSound: NametagGlobals.setClickSound(clickSound) NametagGlobals.setToon(self.cam) self.marginManager = MarginManager() self.margins = self.aspect2d.attachNewNode(self.marginManager, DirectGuiGlobals.MIDGROUND_SORT_INDEX + 1) mm = self.marginManager self.leftCells = [ mm.addGridCell(0.25, -0.6, base.a2dTopLeft), mm.addGridCell(0.25, -1.0, base.a2dTopLeft), mm.addGridCell(0.25, -1.4, base.a2dTopLeft) ] self.bottomCells = [ mm.addGridCell(0.4, 0.2, base.a2dBottomCenter), mm.addGridCell(-0.4, 0.2, base.a2dBottomCenter), mm.addGridCell(-1.0, 0.2, base.a2dBottomCenter), mm.addGridCell(1.0, 0.2, base.a2dBottomCenter) ] self.rightCells = [ mm.addGridCell(-0.25, -0.6, base.a2dTopRight), mm.addGridCell(-0.25, -1.0, base.a2dTopRight), mm.addGridCell(-0.25, -1.4, base.a2dTopRight) ]
def __init__(self, parent=None, **kw): optiondefs = ( # Define type of DirectGuiWidget ('pgFunc', PGButton, None), ('numStates', 4, None), ('state', DGG.NORMAL, None), ('relief', None, None), ('invertedFrames', (1, ), None), ('frameSize', (-1, 1, -1, 1), None), ('scale', 0.05, None), # Command to be called on button click ('command', None, None), ('extraArgs', [], None), # Which mouse buttons can be used to click the button ('commandButtons', (DGG.LMB, ), self.setCommandButtons), # Sounds to be used for button events ('rolloverSound', DGG.getDefaultRolloverSound(), self.setRolloverSound), ('clickSound', DGG.getDefaultClickSound(), self.setClickSound), # Can only be specified at time of widget contruction # Do the text/graphics appear to move when the button is clicked ('pressEffect', 1, DGG.INITOPT), ('uncheckedImage', 'ui/default/checkbox_unchecked.png', self.setUncheckedImage), ('checkedImage', 'ui/default/checkbox_checked.png', self.setCheckedImage), ('uncheckedGeom', None, None), ('checkedGeom', None, None), ('isChecked', False, self.renewgeom), ) # Merge keyword options with default options self.defineoptions(kw, optiondefs) DirectButton.__init__(self, parent) self.__checkstatedumpnp = NodePath('checkstatenp') self.initialiseoptions(SDirectCheckBox)
def __init__(self, parent = None, **kw): optiondefs = ( # Define type of DirectGuiWidget ('pgFunc', PGButton, None), ('numStates', 4, None), ('state', DGG.NORMAL, None), ('relief', None, None), ('invertedFrames', (1,), None), ('frameSize', (-1,1,-1,1),None), ('scale', 0.05, None), # Command to be called on button click ('command', None, None), ('extraArgs', [], None), # Which mouse buttons can be used to click the button ('commandButtons', (DGG.LMB,), self.setCommandButtons), # Sounds to be used for button events ('rolloverSound', DGG.getDefaultRolloverSound(), self.setRolloverSound), ('clickSound', DGG.getDefaultClickSound(), self.setClickSound), # Can only be specified at time of widget contruction # Do the text/graphics appear to move when the button is clicked ('pressEffect', 1, DGG.INITOPT), ('uncheckedImage', 'ui/default/checkbox_unchecked.png', self.setUncheckedImage), ('checkedImage', 'ui/default/checkbox_checked.png', self.setCheckedImage), ('uncheckedGeom', None, None), ('checkedGeom', None, None), ('isChecked', False, self.renewgeom), ) # Merge keyword options with default options self.defineoptions(kw, optiondefs) DirectButton.__init__(self,parent) self.__checkstatedumpnp = NodePath('checkstatenp') self.initialiseoptions(SDirectCheckBox)
def initNametagGlobals(self): """ Should be called once during startup to initialize a few defaults for the Nametags. """ arrow = loader.loadModel('phase_3/models/props/arrow') card = loader.loadModel('phase_3/models/props/panel') speech3d = ChatBalloon(loader.loadModelNode('phase_3/models/props/chatbox')) thought3d = ChatBalloon(loader.loadModelNode('phase_3/models/props/chatbox_thought_cutout')) speech2d = ChatBalloon(loader.loadModelNode('phase_3/models/props/chatbox_noarrow')) chatButtonGui = loader.loadModel("phase_3/models/gui/chat_button_gui") NametagGlobals.setCamera(self.cam) NametagGlobals.setArrowModel(arrow) NametagGlobals.setNametagCard(card, VBase4(-0.5, 0.5, -0.5, 0.5)) if self.mouseWatcherNode: NametagGlobals.setMouseWatcher(self.mouseWatcherNode) NametagGlobals.setSpeechBalloon3d(speech3d) NametagGlobals.setThoughtBalloon3d(thought3d) NametagGlobals.setSpeechBalloon2d(speech2d) NametagGlobals.setThoughtBalloon2d(thought3d) NametagGlobals.setPageButton(PGButton.SReady, chatButtonGui.find("**/Horiz_Arrow_UP")) NametagGlobals.setPageButton(PGButton.SDepressed, chatButtonGui.find("**/Horiz_Arrow_DN")) NametagGlobals.setPageButton(PGButton.SRollover, chatButtonGui.find("**/Horiz_Arrow_Rllvr")) NametagGlobals.setQuitButton(PGButton.SReady, chatButtonGui.find("**/CloseBtn_UP")) NametagGlobals.setQuitButton(PGButton.SDepressed, chatButtonGui.find("**/CloseBtn_DN")) NametagGlobals.setQuitButton(PGButton.SRollover, chatButtonGui.find("**/CloseBtn_Rllvr")) rolloverSound = DirectGuiGlobals.getDefaultRolloverSound() if rolloverSound: NametagGlobals.setRolloverSound(rolloverSound) clickSound = DirectGuiGlobals.getDefaultClickSound() if clickSound: NametagGlobals.setClickSound(clickSound) # For now, we'll leave the Toon at the same point as the # camera. When we have a real toon later, we'll change it. NametagGlobals.setToon(self.cam) # We need a node to be the parent of all of the 2-d onscreen # messages along the margins. This should be in front of many # things, but not all things. self.marginManager = MarginManager() self.margins = \ self.aspect2d.attachNewNode(self.marginManager, DirectGuiGlobals.MIDGROUND_SORT_INDEX + 1) # And define a bunch of cells along the margins. mm = self.marginManager self.leftCells = [ mm.addGridCell(0, 1, base.a2dLeft, base.a2dRight, base.a2dBottom, base.a2dTop), mm.addGridCell(0, 2, base.a2dLeft, base.a2dRight, base.a2dBottom, base.a2dTop), mm.addGridCell(0, 3, base.a2dLeft, base.a2dRight, base.a2dBottom, base.a2dTop) ] self.bottomCells = [ mm.addGridCell(0.5, 0, base.a2dLeft, base.a2dRight, base.a2dBottom, base.a2dTop), mm.addGridCell(1.5, 0, base.a2dLeft, base.a2dRight, base.a2dBottom, base.a2dTop), mm.addGridCell(2.5, 0, base.a2dLeft, base.a2dRight, base.a2dBottom, base.a2dTop), mm.addGridCell(3.5, 0, base.a2dLeft, base.a2dRight, base.a2dBottom, base.a2dTop), mm.addGridCell(4.5, 0, base.a2dLeft, base.a2dRight, base.a2dBottom, base.a2dTop) ] self.rightCells = [ mm.addGridCell(5, 2, base.a2dLeft, base.a2dRight, base.a2dBottom, base.a2dTop), mm.addGridCell(5, 1, base.a2dLeft, base.a2dRight, base.a2dBottom, base.a2dTop) ]
def initNametagGlobals(self): arrow = loader.loadModel('phase_3/models/props/arrow') card = loader.loadModel('phase_3/models/props/panel') speech3d = ChatBalloon( loader.loadModel('phase_3/models/props/chatbox')) thought3d = ChatBalloon( loader.loadModel('phase_3/models/props/chatbox_thought_cutout')) exclaim3d = ChatBalloon( loader.loadModel('phase_3/models/props/chatbox_exclaim_cutout')) speech2d = ChatBalloon( loader.loadModel('phase_3/models/props/chatbox_noarrow')) if config.GetBool('want-retro-mode', False): rtex = loader.loadTexture( 'phase_3/maps/avatar_palette_1llla_1_retro.jpg') speech3d.model.setTexture(rtex, 1) thought3d.model.setTexture(rtex, 1) speech2d.model.setTexture(rtex, 1) exclaim3d.model.setTexture( loader.loadTexture('phase_3/maps/spikey_bubble_retro.jpg'), 1) chatButtonGui = loader.loadModel('phase_3/models/gui/chat_button_gui') NametagGlobals.setCamera(self.cam) NametagGlobals.setArrowModel(arrow) NametagGlobals.setNametagCard(card, VBase4(-0.5, 0.5, -0.5, 0.5)) if self.mouseWatcherNode: NametagGlobals.setMouseWatcher(self.mouseWatcherNode) NametagGlobals.setSpeechBalloon3d(speech3d) NametagGlobals.setThoughtBalloon3d(thought3d) NametagGlobals.setExclaimBalloon3d(exclaim3d) NametagGlobals.setSpeechBalloon2d(speech2d) NametagGlobals.setThoughtBalloon2d(thought3d) NametagGlobals.setExclaimBalloon2d(speech2d) NametagGlobals.setPageButton(PGButton.SReady, chatButtonGui.find('**/Horiz_Arrow_UP')) NametagGlobals.setPageButton(PGButton.SDepressed, chatButtonGui.find('**/Horiz_Arrow_DN')) NametagGlobals.setPageButton( PGButton.SRollover, chatButtonGui.find('**/Horiz_Arrow_Rllvr')) NametagGlobals.setQuitButton(PGButton.SReady, chatButtonGui.find('**/CloseBtn_UP')) NametagGlobals.setQuitButton(PGButton.SDepressed, chatButtonGui.find('**/CloseBtn_DN')) NametagGlobals.setQuitButton(PGButton.SRollover, chatButtonGui.find('**/CloseBtn_Rllvr')) rolloverSound = DirectGuiGlobals.getDefaultRolloverSound() if rolloverSound: NametagGlobals.setRolloverSound(rolloverSound) clickSound = DirectGuiGlobals.getDefaultClickSound() if clickSound: NametagGlobals.setClickSound(clickSound) NametagGlobals.setToon(self.cam) self.marginManager = MarginManager() self.margins = self.aspect2d.attachNewNode( self.marginManager, DirectGuiGlobals.MIDGROUND_SORT_INDEX + 1) mm = self.marginManager padding = 0.0225 self.leftCells = [ mm.addGridCell(0.2 + padding, -0.45, base.a2dTopLeft), mm.addGridCell(0.2 + padding, -0.9, base.a2dTopLeft), mm.addGridCell(0.2 + padding, -1.35, base.a2dTopLeft) ] self.bottomCells = [ mm.addGridCell(-0.87, 0.2 + padding, base.a2dBottomCenter), mm.addGridCell(-0.43, 0.2 + padding, base.a2dBottomCenter), mm.addGridCell(0.01, 0.2 + padding, base.a2dBottomCenter), mm.addGridCell(0.45, 0.2 + padding, base.a2dBottomCenter), mm.addGridCell(0.89, 0.2 + padding, base.a2dBottomCenter) ] self.rightCells = [ mm.addGridCell(-0.2 - padding, -1.35, base.a2dTopRight), mm.addGridCell(-0.2 - padding, -0.9, base.a2dTopRight), mm.addGridCell(-0.2 - padding, -0.45, base.a2dTopRight) ]
from direct.gui import DirectGuiGlobals NametagGlobals.setMe(base.cam) NametagGlobals.setCardModel('phase_3/models/props/panel.bam') NametagGlobals.setArrowModel('phase_3/models/props/arrow.bam') NametagGlobals.setChatBalloon3dModel('phase_3/models/props/chatbox.bam') NametagGlobals.setChatBalloon2dModel('phase_3/models/props/chatbox_noarrow.bam') NametagGlobals.setThoughtBalloonModel('phase_3/models/props/chatbox_thought_cutout.bam') chatButtonGui = loader.loadModel('phase_3/models/gui/chat_button_gui.bam') NametagGlobals.setPageButton(chatButtonGui.find('**/Horiz_Arrow_UP'), chatButtonGui.find('**/Horiz_Arrow_DN'), chatButtonGui.find('**/Horiz_Arrow_Rllvr'), chatButtonGui.find('**/Horiz_Arrow_UP')) NametagGlobals.setQuitButton(chatButtonGui.find('**/CloseBtn_UP'), chatButtonGui.find('**/CloseBtn_DN'), chatButtonGui.find('**/CloseBtn_Rllvr'), chatButtonGui.find('**/CloseBtn_UP')) soundRlvr = DirectGuiGlobals.getDefaultRolloverSound() NametagGlobals.setRolloverSound(soundRlvr) soundClick = DirectGuiGlobals.getDefaultClickSound() NametagGlobals.setClickSound(soundClick) from lib.coginvasion.toon.LocalToon import LocalToon from lib.coginvasion.login.AvChoice import AvChoice class Standalone: def __init__(self): self.process = 'client' __builtin__.game = self base.cr = ClientRepository(['phase_3/etc/direct.dc', 'phase_3/etc/toon.dc']) base.cr.isShowingPlayerIds = None base.shadowTrav = CollisionTraverser() base.cTrav = CollisionTraverser()
def initNametagGlobals(self): arrow = loader.loadModel('phase_3/models/props/arrow') card = loader.loadModel('phase_3/models/props/panel') speech3d = ChatBalloon( loader.loadModel('phase_3/models/props/chatbox').node()) thought3d = ChatBalloon( loader.loadModel( 'phase_3/models/props/chatbox_thought_cutout').node()) exclaim3d = ChatBalloon( loader.loadModel( 'phase_3/models/props/chatbox_exclaim_cutout').node()) exclaim3d.m_hscale = 1.25 speech2dNode = loader.loadModel('phase_3/models/props/chatbox_noarrow') if base.classicVisuals == 2: speech2dNode.find('**/bottom').setTextureOff(1) speech2dNode.find('**/middle').setTextureOff(1) speech2dNode.find('**/top').setTextureOff(1) speech2d = ChatBalloon(speech2dNode.node()) speech2dNode.removeNode() chatButtonGui = loader.loadModel('phase_3/models/gui/chat_button_gui') NametagGlobals.setCamera(self.cam) NametagGlobals.setArrowModel(arrow) NametagGlobals.setNametagCard(card, VBase4(-0.5, 0.5, -0.5, 0.5)) if self.mouseWatcherNode: NametagGlobals.setMouseWatcher(self.mouseWatcherNode) NametagGlobals.setSpeechBalloon3d(speech3d) NametagGlobals.setThoughtBalloon3d(thought3d) NametagGlobals.setExclaimBalloon3d(exclaim3d) NametagGlobals.setSpeechBalloon2d(speech2d) NametagGlobals.setThoughtBalloon2d(thought3d) NametagGlobals.setExclaimBalloon2d(speech2d) NametagGlobals.setPageButton(PGButton.SReady, chatButtonGui.find('**/Horiz_Arrow_UP')) NametagGlobals.setPageButton(PGButton.SDepressed, chatButtonGui.find('**/Horiz_Arrow_DN')) NametagGlobals.setPageButton( PGButton.SRollover, chatButtonGui.find('**/Horiz_Arrow_Rllvr')) NametagGlobals.setQuitButton(PGButton.SReady, chatButtonGui.find('**/CloseBtn_UP')) NametagGlobals.setQuitButton(PGButton.SDepressed, chatButtonGui.find('**/CloseBtn_DN')) NametagGlobals.setQuitButton(PGButton.SRollover, chatButtonGui.find('**/CloseBtn_Rllvr')) rolloverSound = DirectGuiGlobals.getDefaultRolloverSound() if rolloverSound: NametagGlobals.setRolloverSound(rolloverSound) clickSound = DirectGuiGlobals.getDefaultClickSound() if clickSound: NametagGlobals.setClickSound(clickSound) NametagGlobals.setToon(self.cam) self.marginManager = MarginManager() self.margins = self.aspect2d.attachNewNode( self.marginManager, DirectGuiGlobals.MIDGROUND_SORT_INDEX + 1) mm = self.marginManager self.leftCells = [ mm.addGridCell(0, 1, -1.33333333333, 1.33333333333, -1.0, 1.0, base.a2dTopLeft, (0.222222, 0, -1.5)), mm.addGridCell(0, 2, -1.33333333333, 1.33333333333, -1.0, 1.0, base.a2dTopLeft, (0.222222, 0, -1.16667)), mm.addGridCell(0, 3, -1.33333333333, 1.33333333333, -1.0, 1.0, base.a2dTopLeft, (0.222222, 0, -0.833333)) ] self.bottomCells = [ mm.addGridCell(0.5, 0, -1.33333333333, 1.33333333333, -1.0, 1.0, base.a2dBottomCenter, (-0.888889, 0, 0.166667)), mm.addGridCell(1.5, 0, -1.33333333333, 1.33333333333, -1.0, 1.0, base.a2dBottomCenter, (-0.444444, 0, 0.166667)), mm.addGridCell(2.5, 0, -1.33333333333, 1.33333333333, -1.0, 1.0, base.a2dBottomCenter, (0, 0, 0.166667)), mm.addGridCell(3.5, 0, -1.33333333333, 1.33333333333, -1.0, 1.0, base.a2dBottomCenter, (0.444444, 0, 0.166667)), mm.addGridCell(4.5, 0, -1.33333333333, 1.33333333333, -1.0, 1.0, base.a2dBottomCenter, (0.888889, 0, 0.166667)) ] self.rightCells = [ mm.addGridCell(5, 2, -1.33333333333, 1.33333333333, -1.0, 1.0, base.a2dTopRight, (-0.222222, 0, -1.16667)), mm.addGridCell(5, 1, -1.33333333333, 1.33333333333, -1.0, 1.0, base.a2dTopRight, (-0.222222, 0, -1.5)) ]