当前位置: 首页>>代码示例>>Python>>正文


Python gui.DirectGuiGlobals类代码示例

本文整理汇总了Python中direct.gui.DirectGuiGlobals的典型用法代码示例。如果您正苦于以下问题:Python DirectGuiGlobals类的具体用法?Python DirectGuiGlobals怎么用?Python DirectGuiGlobals使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了DirectGuiGlobals类的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: load

    def load(self):
        guiModel = loader.loadModel('phase_3/models/gui/tt_m_gui_ups_logo_noText')
        leftLocator = guiModel.find('**/bubbleLeft_locator')
        rightLocator = guiModel.find('**/bubbleRight_locator')
        haveFunNode = TextNode('Have Fun')
        haveFunNode.setText(TTLocalizer.TeaserHaveFun)
        haveFunNode.setTextColor(0, 0, 0, 1)
        haveFunNode.setWordwrap(6)
        haveFunNode.setAlign(TextNode.ACenter)
        haveFunNode.setFont(DirectGuiGlobals.getDefaultFont())
        haveFun = NodePath(haveFunNode)
        haveFun.reparentTo(rightLocator)
        haveFun.setScale(TTLocalizer.TPhaveFun)
        JoinUsNode = TextNode('Join Us')
        JoinUsNode.setText(TTLocalizer.TeaserJoinUs)
        JoinUsNode.setTextColor(0, 0, 0, 1)
        JoinUsNode.setWordwrap(6)
        JoinUsNode.setAlign(TextNode.ACenter)
        JoinUsNode.setFont(DirectGuiGlobals.getDefaultFont())
        JoinUs = NodePath(JoinUsNode)
        JoinUs.reparentTo(leftLocator)
        JoinUs.setPos(0, 0, -0.025)
        JoinUs.setScale(TTLocalizer.TPjoinUs)
        for page in PageOrder:
            textInfo = Pages.get(page)
            textInfo = textInfo[0] + TTLocalizer.TeaserDefault
            panel = DirectFrame(parent=self, relief=None, image=guiModel, image_scale=(0.65, 0.65, 0.65), image_pos=(0, 0, 0.0), text_align=TextNode.ACenter, text=textInfo, text_scale=TTLocalizer.TPpanel, text_pos=TTLocalizer.TPpanelPos)
            self.addItem(panel)

        guiModel.removeNode()
        return
开发者ID:Teku16,项目名称:Toontown-Crystal-Master,代码行数:31,代码来源:TeaserPanel.py

示例2: initNametagGlobals

    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
        ]
开发者ID:Toonerz,项目名称:Toontown-World-Online-Leaked-Source,代码行数:59,代码来源:ToonBase.py

示例3: __init__

	def __init__(self):
		ShowBase.__init__(self)

		# Increase the texture resolution on DirectGui
		default_font = DirectGuiGlobals.getDefaultFont()
		default_font.clear()
		default_font.setPixelsPerUnit(64)
		DirectGuiGlobals.setDefaultFont(default_font)

		self.accept("f1", sys.exit)
		self.win.setCloseRequestEvent("f1")

		self.background = OnscreenImage(parent=self.render2dp, image="art/menu_background.png")
		self.cam2dp.node().getDisplayRegion(0).setSort(-20)

		# Setup camera
		self.disableMouse()
		self.camera.setPos(0, -5, 2.25)
		self.camera.setHpr(0, -10, 0)
		self.camLens.setFov(65)

		# Setup saves
		self.save_dir = os.path.join(appdirs.user_data_dir('ThorGame', roaming=True), 'saves')
		if not os.path.exists(self.save_dir):
			os.makedirs(self.save_dir)
		self.saved_trainer_ids = [i.split('.')[0] for i in os.listdir(self.save_dir)]

		# Setup UI
		self.ui = CEFPanda()
		src_dir = _file_dir
		template_folder = os.path.join(src_dir, 'ui')
		self.ui_env = Environment(loader=FileSystemLoader(template_folder),
								  trim_blocks=True)
		# HACK - CEFPython requires a regular LoadURL before LoadString works,
		# so we just give it something to work on. This doesn't render nicely,
		# but we replace it immediately with the UI for the first GameState.
		# CEFPython issue: https://code.google.com/p/chromiumembedded/issues/detail?id=763
		self.ui.load('ui/base.html')

		# Load monster data
		data_folder = os.path.join(src_dir, 'data')
		self.monster_data = []
		for i in os.listdir(data_folder):
			if i.startswith('race'):
				with open(os.path.join(data_folder, i)) as f:
					self.monster_data.append(json.load(f))

		# Setup the default player and monster
		self.player = Trainer(dont_save=True)
		self.player.monster = Monster.new_from_race("ogre")

		# Setup game states
		self.game_state = TitleState(self)
		self.taskMgr.add(self.main_loop, "MainLoop")
开发者ID:Kupoman,项目名称:thor,代码行数:54,代码来源:main.py

示例4: initNametagGlobals

    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)
        ]
开发者ID:Necromoni,项目名称:src,代码行数:51,代码来源:ToonBase.py

示例5: initNametagGlobals

 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)
     ]
开发者ID:ToontownModder101,项目名称:Toontown-Offline-Squirting-Flower-Modded-,代码行数:48,代码来源:ToonBase.py

示例6: labelCells

 def labelCells(self):
     if self.cellLabelParent:
         self.cellLabelParent.removeNode()
     self.cellLabelParent = self.attachNewNode('cellLabels')
     cw = self.cellWidth
     scale = cw / 10.0
     dx = cw * self.gridSize * .5
     font = DirectGuiGlobals.getDefaultFont()
     color = self.gridColor
     for i in range(self.gridSize):
         for j in range(self.gridSize):
             zoneId = self.startingZone + ((j * self.gridSize) + i)
             zoneStr = str(zoneId)
             textNode = TextNode(zoneStr)
             textNode.setText(zoneStr)
             textNode.setFont(font)
             textNode.setTextColor(color)
             textNode.setAlign(TextNode.ACenter)
             genTextNode = textNode.generate()
             textNodePath = self.cellLabelParent.attachNewNode(genTextNode)
             # Place the text node in the center of the cell
             textNodePath.setPosHprScale((i * cw - dx) + (cw * 0.5), # x
                                         (j * cw - dx) + (cw * 0.5), # y
                                         GRID_Z_OFFSET+3.0, # z
                                         # Lay them down flat
                                         0, -90, 0, # hpr
                                         scale, scale, scale)
     self.cellLabelParent.flattenLight()
开发者ID:AdrianF98,项目名称:Toontown-2-Revised,代码行数:28,代码来源:DistributedCartesianGrid.py

示例7: HTTPClient

    __builtin__.launcher = launcher
notify.info("Loading Clients")


notify.info('Starting Toontown Planet...')
if launcher.isDummy():
    http = HTTPClient()
else:
    http = launcher.http
tempLoader = Loader()
backgroundNode = tempLoader.loadSync(Filename('phase_3/models/gui/loading-background'))
from direct.gui import DirectGuiGlobals
from direct.gui.DirectGui import *
notify.info('Setting the default Toontown Planet font...')
import ToontownGlobals
DirectGuiGlobals.setDefaultFontFunc(ToontownGlobals.getInterfaceFont)
launcher.setPandaErrorCode(7)
import ToonBase
ToonBase.ToonBase()
from pandac.PandaModules import *
if base.win is None:
    notify.error('Unable to open window; aborting.')
launcher.setPandaErrorCode(0)
launcher.setPandaWindowOpen()
ConfigVariableDouble('decompressor-step-time').setValue(0.01)
ConfigVariableDouble('extractor-step-time').setValue(0.01)
backgroundNodePath = aspect2d.attachNewNode(backgroundNode, 0)
backgroundNodePath.setPos(0.0, 0.0, 0.0)
backgroundNodePath.setScale(render2d, VBase3(1))
backgroundNodePath.find('**/fg').hide()
logo = OnscreenImage(
开发者ID:Teku16,项目名称:ToontownPlanet,代码行数:31,代码来源:ToontownPlanetStart.py

示例8: PiratesOnlineLauncher

import sys
import random
import __builtin__
import gc
gc.disable()

try:
    launcher
except:
    from pirates.launcher.PiratesOnlineLauncher import PiratesOnlineLauncher
    launcher = PiratesOnlineLauncher()
    __builtin__.launcher = launcher

from direct.gui import DirectGuiGlobals
import PiratesGlobals
DirectGuiGlobals.setDefaultFontFunc(PiratesGlobals.getInterfaceFont)
launcher.setPandaErrorCode(7)
import PiratesBase
PiratesBase.PiratesBase()
from direct.showbase.ShowBaseGlobal import *
if base.config.GetBool('want-preloader', 0):
    base.preloader = PiratesPreloader.PiratesPreloader()

if base.win == None:
    print 'Unable to open window; aborting.'
    sys.exit()

launcher.setPandaErrorCode(0)
launcher.setPandaWindowOpen()
base.sfxPlayer.setCutoffDistance(500.0)
from pirates.audio import SoundGlobals
开发者ID:Puggyblue999,项目名称:PiratesOfTheCarribeanOnline,代码行数:31,代码来源:PiratesStart.py

示例9: __init__

 def __init__(self, doneEvent):
     self.doneEvent = doneEvent
     DirectFrame.__init__(self)
     self.reparentTo(aspect2d)
     self.setPos(0.0, 0.0, 0.16)
     self.stash()
     publicPartyGui = loader.loadModel('phase_4/models/parties/publicPartyGUI')
     self.frame = DirectFrame(parent=self, geom=publicPartyGui.find('**/activities_background'), geom_pos=(-0.8, 0.0, 0.2), geom_scale=2.0, relief=None)
     self.earnedLabel = DirectLabel(parent=self, relief=None, text=str(0), text_align=TextNode.ACenter, text_pos=(0.0, -0.07), text_scale=0.2, text_fg=(0.95, 0.95, 0.0, 1.0), text_font=ToontownGlobals.getSignFont(), textMayChange=True, image=DirectGuiGlobals.getDefaultDialogGeom(), image_scale=(0.33, 1.0, 0.33), pos=(-0.3, 0.0, 0.2), scale=0.9)
     purchaseModels = loader.loadModel('phase_4/models/gui/purchase_gui')
     jarImage = purchaseModels.find('**/Jar')
     self.jarLabel = DirectLabel(parent=self, relief=None, text=str(0), text_align=TextNode.ACenter, text_pos=(0.0, -0.07), text_scale=0.2, text_fg=JellybeanRewardGui.JarLabelTextColor, text_font=ToontownGlobals.getSignFont(), textMayChange=True, image=jarImage, scale=0.7, pos=(0.3, 0.0, 0.17))
     purchaseModels.removeNode()
     del purchaseModels
     jarImage.removeNode()
     del jarImage
     self.messageLabel = DirectLabel(parent=self, relief=None, text='', text_align=TextNode.ALeft, text_wordwrap=16.0, text_scale=0.07, pos=(-0.52, 0.0, -0.1), textMayChange=True)
     self.doubledJellybeanLabel = DirectLabel(parent=self, relief=None, text=TTLocalizer.PartyRewardDoubledJellybean, text_align=TextNode.ACenter, text_wordwrap=12.0, text_scale=0.09, text_fg=(1.0, 0.125, 0.125, 1.0), pos=(0.0, 0.0, -0.465), textMayChange=False)
     self.doubledJellybeanLabel.hide()
     self.closeButton = DirectButton(parent=self, relief=None, text=TTLocalizer.PartyJellybeanRewardOK, text_align=TextNode.ACenter, text_scale=0.065, text_pos=(0.0, -0.625), geom=(publicPartyGui.find('**/startButton_up'),
      publicPartyGui.find('**/startButton_down'),
      publicPartyGui.find('**/startButton_rollover'),
      publicPartyGui.find('**/startButton_inactive')), geom_pos=(-0.39, 0.0, 0.125), command=self._close)
     publicPartyGui.removeNode()
     del publicPartyGui
     self.countSound = base.loadSfx('phase_13/audio/sfx/tick_counter_short.mp3')
     self.overMaxSound = base.loadSfx('phase_13/audio/sfx/tick_counter_overflow.mp3')
     return
开发者ID:BmanGames,项目名称:Toontown-Level-Editor,代码行数:28,代码来源:JellybeanRewardGui.py

示例10: ConfigVariableDouble

base.transitions.IrisModelName = "phase_3/models/misc/iris.bam"
base.transitions.FadeModelName = "phase_3/models/misc/fade.bam"
base.setFrameRateMeter(False)
base.accept("f9", base.screenshot, ["screenshots/screenshot"])
from direct.filter.CommonFilters import CommonFilters

print "CIStart: Setting display preferences..."
sm.applySettings(jsonfile)
if base.win == None:
    print "CIStart: Unable to open window; aborting."
    sys.exit()
else:
    print "CIStart: Successfully opened window."
ConfigVariableDouble("decompressor-step-time").setValue(0.01)
ConfigVariableDouble("extractor-step-time").setValue(0.01)
DirectGuiGlobals.setDefaultFontFunc(CIGlobals.getToonFont)
DirectGuiGlobals.setDefaultFont(CIGlobals.getToonFont())
DirectGuiGlobals.setDefaultRolloverSound(loader.loadSfx("phase_3/audio/sfx/GUI_rollover.mp3"))
DirectGuiGlobals.setDefaultClickSound(loader.loadSfx("phase_3/audio/sfx/GUI_create_toon_fwd.mp3"))
DirectGuiGlobals.setDefaultDialogGeom(loader.loadModel("phase_3/models/gui/dialog_box_gui.bam"))


def maybeDoSomethingWithMusic(condition):
    width, height, fs, music, sfx, tex_detail, model_detail, aa, af = sm.getSettings(jsonfile)
    if condition == 0:
        if music == True:
            base.enableMusic(False)
    elif condition == 1:
        if music == True:
            base.enableMusic(True)
开发者ID:coginvasion,项目名称:src,代码行数:30,代码来源:CIStart.py

示例11: __init__

    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)
开发者ID:WindyDarian,项目名称:Sogal,代码行数:39,代码来源:direct_controls.py

示例12: enterReward

    def enterReward(self):
        numToons = 0
        toonLayouts = ((2,), (1, 3), (0, 2, 4), (0, 1, 3, 4))
        toonPositions = (5.0, 1.75, -0.25, -1.75, -5.0)
        self.toons = []
        self.toonsKeep = []
        self.counters = []
        self.totalCounters = []
        camera.reparentTo(render)
        base.camLens.setFov(ToontownGlobals.DefaultCameraFov)
        camera.setPos(0, 16.0, 2.0)
        camera.lookAt(0, 0, 0.75)
        base.transitions.irisIn(0.40000000000000002)
        self.title.reparentTo(aspect2d)
        self.foreground.reparentTo(render)
        self.backgroundL.reparentTo(render)
        self.backgroundR.reparentTo(render)
        self.sidewalk.reparentTo(render)
        self.door.reparentTo(render)
        size = 20
        z = -2.5
        floor = CollisionPolygon(Point3(-size, -size, z), Point3(size, -size, z), Point3(size, size, z), Point3(-size, size, z))
        floor.setTangible(1)
        floorNode = CollisionNode('collision_floor')
        floorNode.addSolid(floor)
        self.collisionFloor = render.attachNewNode(floorNode)
        NametagGlobals.setOnscreenChatForced(1)
        for index in range(len(self.ids)):
            avId = self.ids[index]
            if self.states[index] != PURCHASE_NO_CLIENT_STATE and self.states[index] != PURCHASE_DISCONNECTED_STATE and avId in base.cr.doId2do:
                numToons += 1
                toon = base.cr.doId2do[avId]
                toon.stopSmooth()
                self.toons.append(toon)
                self.toonsKeep.append(DelayDelete.DelayDelete(toon, 'Purchase.enterReward'))
                counter = DirectLabel(parent = hidden, relief = None, pos = (0.0, 0.0, 0.0), text = str(0), text_scale = 0.20000000000000001, text_fg = (0.94999999999999996, 0.94999999999999996, 0, 1), text_pos = (0, -0.10000000000000001, 0), text_font = ToontownGlobals.getSignFont())
                counter['image'] = DGG.getDefaultDialogGeom()
                counter['image_scale'] = (0.33000000000000002, 1, 0.33000000000000002)
                counter.setScale(0.5)
                counter.count = 0
                counter.max = self.pointsArray[index]
                self.counters.append(counter)
                money = self.playerMoney[index]
                totalCounter = DirectLabel(parent = hidden, relief = None, pos = (0.0, 0.0, 0.0), text = str(money), text_scale = 0.20000000000000001, text_fg = (0.94999999999999996, 0.94999999999999996, 0, 1), text_pos = (0, -0.10000000000000001, 0), text_font = ToontownGlobals.getSignFont(), image = self.jarImage)
                totalCounter.setScale(0.5)
                totalCounter.count = money
                totalCounter.max = toon.getMaxMoney()
                self.totalCounters.append(totalCounter)
                continue
        
        self.accept('clientCleanup', self._handleClientCleanup)
        pos = 0
        toonLayout = toonLayouts[numToons - 1]
        for toon in self.toons:
            thisPos = toonPositions[toonLayout[pos]]
            toon.setPos(Vec3(thisPos, 1.0, -2.5))
            toon.setHpr(Vec3(0, 0, 0))
            toon.setAnimState('neutral', 1)
            toon.setShadowHeight(0)
            if not toon.isDisabled():
                toon.reparentTo(render)
            
            self.counters[pos].setPos(thisPos * -0.17000000000000001, 0, toon.getHeight() / 10 + 0.25)
            self.counters[pos].reparentTo(aspect2d)
            self.totalCounters[pos].setPos(thisPos * -0.17000000000000001, 0, -0.82499999999999996)
            self.totalCounters[pos].reparentTo(aspect2d)
            pos += 1
        
        self.maxPoints = max(self.pointsArray)
        if self.votesArray:
            self.maxVotes = max(self.votesArray)
            numToons = len(self.toons)
            self.voteMultiplier = TravelGameGlobals.PercentOfVotesConverted[numToons] / 100.0
            self.maxBeansFromVotes = int(self.voteMultiplier * self.maxVotes)
        else:
            self.maxVotes = 0
            self.maxBeansFromVotes = 0
        
        def reqCountUp(state):
            self.countUp()
            return Task.done

        countUpDelay = DELAY_BEFORE_COUNT_UP
        taskMgr.doMethodLater(countUpDelay, reqCountUp, 'countUpTask')
        
        def reqCountDown(state):
            self.countDown()
            return Task.done

        countDownDelay = countUpDelay + COUNT_UP_DURATION + DELAY_AFTER_COUNT_UP
        taskMgr.doMethodLater(countDownDelay, reqCountDown, 'countDownTask')
        
        def celebrate(task):
            for counter in task.counters:
                counter.hide()
            
            winningPoints = max(task.pointsArray)
            for i in range(len(task.ids)):
                if task.pointsArray[i] == winningPoints:
                    avId = task.ids[i]
#.........这里部分代码省略.........
开发者ID:ponyboy837,项目名称:Toontown-2003-Server,代码行数:101,代码来源:Purchase.py


注:本文中的direct.gui.DirectGuiGlobals类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。