def Coordenadas_XY(self):
        for i in range(-20, 20):
            OnscreenText(text='.' + '%.1f' % (i / float(10)),
                         pos=(0, i / float(10)),
                         scale=0.05,
                         fg=(1, 1, 1, 1))
        for i in range(-20, 20):
            OnscreenText(text='.',
                         pos=(i / float(10), 0),
                         scale=0.05,
                         fg=(1, 1, 1, 1))
            if i <> 0:
                OnscreenText(text='%.1f' % (i / float(10)),
                             pos=(i / float(10), 0.05),
                             scale=0.05,
                             fg=(1, 1, 1, 1))

        OnscreenText(text='X',
                     pos=(LIMITX[0] - .03, .1),
                     scale=0,
                     fg=(1, 1, 1, 1))
        OnscreenText(text='Y',
                     pos=(.1, LIMITY[0] - .03),
                     scale=0,
                     fg=(1, 1, 1, 1))
Example #2
0
    def __init__(self):
        self.frame = DirectFrame(
            frameSize=(base.a2dLeft, base.a2dRight, base.a2dBottom,
                       base.a2dTop),
            frameColor=(0, 0, 0, 0),
            image_scale=(2, 0, 1),
            enableEdit=False,
        )
        self.frame.setTransparency(0)

        self.title = DirectLabel(
            scale=0.05,
            pos=(0, 0, 0.9),
            text="Current Mission Placeholder",
            text_fg=(0.2, 0.2, 0.1, 1),
            frameColor=(0.1, 0.8, 0.8, 0),
            enableEdit=False,
        )

        self.createBtn("Quit", 0.8, ["game-quit"])
        self.createBtn("Found It", 0.7, ["game-finished"])
        self.title.reparentTo(self.frame)

        self.timer = OnscreenText(text="", mayChange=True, pos=(0.8, 0.9))

        self.hide()
Example #3
0
    def __init__(self, controller):
        ShowBase.__init__(self)
        self.controller = controller

        OnscreenText(text="Welcome to Galaxy Simulator",
                     pos=(0, 0.70),
                     scale=0.18,
                     fg=(255, 255, 255, 1),
                     align=TextNode.ACenter,
                     mayChange=1)
        OnscreenText(text="By Antoine Mahe and Frederic Wantiez",
                     pos=(0.9, -0.85),
                     scale=0.04,
                     fg=(255, 255, 255, 1),
                     align=TextNode.ACenter,
                     mayChange=1)
        b1 = DirectButton(text="Live Mode",
                          scale=.1,
                          command=self.launch_live,
                          pos=(-0.4, 0, 0.1))
        b2 = DirectButton(text="PreCalc Mode",
                          scale=.1,
                          command=self.launch_live,
                          pos=(0.4, 0, 0.1))
        b = OnscreenImage(parent=render2d, image="models/bg.jpg")
Example #4
0
 def __init__(self, cr):
     DistributedObject.DistributedObject.__init__(self, cr)
     Level.Level.__init__(self)
     self.lastToonZone = None
     self.lastCamZone = 0
     self.titleColor = (1, 1, 1, 1)
     self.titleText = OnscreenText.OnscreenText(
         '',
         fg=self.titleColor,
         shadow=(0, 0, 0, 1),
         font=ToontownGlobals.getSuitFont(),
         pos=(0, -0.5),
         scale=0.16,
         drawOrder=0,
         mayChange=1)
     self.smallTitleText = OnscreenText.OnscreenText(
         '',
         fg=self.titleColor,
         font=ToontownGlobals.getSuitFont(),
         pos=(0.65, 0.9),
         scale=0.08,
         drawOrder=0,
         mayChange=1,
         bg=(0.5, 0.5, 0.5, 0.5),
         align=TextNode.ARight)
     self.titleSeq = None
     self.zonesEnteredList = []
     self.avIdList = []
     self.fColorZones = 0
     self.scenarioIndex = 0
Example #5
0
 def askExit(self):
     self.msgbox = loader.loadModel('phase_3/models/gui/dialog_box_gui.bam')
     self.msgbox.reparentTo(base.a2dBottomCenter)
     self.msgbox.setPos(0, 0, 1)
     buttons = loader.loadModel(
         'phase_3/models/gui/dialog_box_buttons_gui.bam')
     OKButtonUP = buttons.find('**/ChtBx_OKBtn_UP')
     OKButtonRLVR = buttons.find('**/ChtBx_OKBtn_Rllvr')
     OKButtonDN = buttons.find('**/ChtBx_OKBtn_DN')
     CloseUP = buttons.find('**/CloseBtn_UP')
     CloseRLVR = buttons.find('**/CloseBtn_Rllvr')
     CloseDN = buttons.find('**/CloseBtn_DN')
     self.OkButton = DirectButton(image=(OKButtonUP, OKButtonDN,
                                         OKButtonRLVR),
                                  command=self.exitGame,
                                  pos=(-.3, 0, -.4),
                                  relief=None)
     self.OkButton.reparentTo(self.msgbox)
     self.OkButton.show()
     self.CloseButton = DirectButton(image=(CloseUP, CloseDN, CloseRLVR),
                                     command=self.closeAsk,
                                     pos=(.3, 0, -.4),
                                     relief=None)
     self.CloseButton.reparentTo(self.msgbox)
     self.CloseButton.show()
     self.exittitle = OnscreenText(text='Are you sure you want to leave?',
                                   mayChange=False,
                                   fg=(0, 0, 0, 1),
                                   pos=(0, 0),
                                   scale=.07,
                                   font=font,
                                   align=TextNode.ACenter)
     self.exittitle.reparentTo(self.msgbox)
     self.msgbox.show()
Example #6
0
 def __init__(self, cr):
     DistributedObject.DistributedObject.__init__(self, cr)
     self.lastCamEnterRoom = 0
     self.titleColor = (1, 1, 1, 1)
     self.titleText = OnscreenText.OnscreenText(
         '',
         fg=self.titleColor,
         shadow=(0, 0, 0, 1),
         font=ToontownGlobals.getSignFont(),
         pos=(0, -0.5),
         scale=0.1,
         drawOrder=0,
         mayChange=1)
     self.smallTitleText = OnscreenText.OnscreenText('',
                                                     fg=self.titleColor,
                                                     font=getSuitFont(),
                                                     pos=(0.65, 0.9),
                                                     scale=0.08,
                                                     drawOrder=0,
                                                     mayChange=1,
                                                     bg=(0.5, 0.5, 0.5,
                                                         0.5),
                                                     align=TextNode.ARight)
     self.titleSequence = None
     return
Example #7
0
class Hud:
    def __init__(self):
        self.frame = DirectFrame(
            frameSize=(base.a2dLeft, base.a2dRight, base.a2dBottom,
                       base.a2dTop),
            frameColor=(0, 0, 0, 0),
            image_scale=(2, 0, 1),
            enableEdit=False,
        )
        self.frame.setTransparency(0)

        self.title = DirectLabel(
            scale=0.05,
            pos=(0, 0, 0.9),
            text="Current Mission Placeholder",
            text_fg=(0.2, 0.2, 0.1, 1),
            frameColor=(0.1, 0.8, 0.8, 0),
            enableEdit=False,
        )

        self.createBtn("Quit", 0.8, ["game-quit"])
        self.createBtn("Found It", 0.7, ["game-finished"])
        self.title.reparentTo(self.frame)

        self.timer = OnscreenText(text="", mayChange=True, pos=(0.8, 0.9))

        self.hide()

    def createBtn(self, text, verticalPos, commands):
        btn = DirectButton(text=text,
                           text_fg=(0.2, 0.2, 0.4, 1),
                           text_scale=0.03,
                           text_pos=(0, 0),
                           scale=3,
                           pos=(-0.9, 0, verticalPos),
                           relief=1,
                           frameColor=(0, 1, 0, 0.5),
                           command=base.messenger.send,
                           extraArgs=commands,
                           rolloverSound=None,
                           clickSound=None)
        btn.reparentTo(self.frame)

    def show(self):
        self.frame.show()

    def hide(self):
        self.frame.hide()

    def hudTask(self, task):
        self.timer.setText(
            str(self.missionLength - int(time.time() - self.startTime)) +
            " seconds left")
        return task.cont

    def initialise(self, currentMission, missionLength):
        self.startTime = time.time()
        self.missionLength = missionLength
        self.title["text"] = currentMission
Example #8
0
    def load(self):
        if self.onScreenText:
            return None

        fontPath = config.GetString('on-screen-debug-font', 'cmtt12')
        fontScale = config.GetFloat('on-screen-debug-font-scale',
                                    0.050000000000000003)
        color = {'black': Vec4(0, 0, 0, 1), 'white': Vec4(1, 1, 1, 1)}
        fgColor = color[config.GetString('on-screen-debug-fg-color', 'white')]
        bgColor = color[config.GetString('on-screen-debug-bg-color', 'black')]
        fgColor.setW(
            config.GetFloat('on-screen-debug-fg-alpha', 0.84999999999999998))
        bgColor.setW(
            config.GetFloat('on-screen-debug-bg-alpha', 0.84999999999999998))
        font = loader.loadFont(fontPath)
        if not font.isValid():
            print 'failed to load OnScreenDebug font', fontPath
            font = TextNode.getDefaultFont()

        self.onScreenText = OnscreenText.OnscreenText(
            pos=(-1.0, 0.90000000000000002),
            fg=fgColor,
            bg=bgColor,
            scale=(fontScale, fontScale, 0.0),
            align=TextNode.ALeft,
            mayChange=1,
            font=font)
        DirectUtil.useDirectRenderStyle(self.onScreenText)
 def enter(self, requestStatus):
     hoodId = requestStatus['hoodId']
     zoneId = requestStatus['zoneId']
     hoodText = self.getHoodText(zoneId)
     self.titleText = OnscreenText.OnscreenText(hoodText, fg = self.titleColor, font = getSignFont(), pos = (0, -0.5), scale = TTLocalizer.HtitleText, drawOrder = 0, mayChange = 1)
     self.fsm.request(requestStatus['loader'], [
         requestStatus])
Example #10
0
    def load(self):
        if self.onScreenText:
            return

        fontPath = ConfigVariableString("on-screen-debug-font", "cmtt12").value
        fontScale = ConfigVariableDouble("on-screen-debug-font-scale",
                                         0.05).value

        color = {
            "black": Vec4(0, 0, 0, 1),
            "white": Vec4(1, 1, 1, 1),
        }
        fgColor = color[ConfigVariableString("on-screen-debug-fg-color",
                                             "white").value]
        bgColor = color[ConfigVariableString("on-screen-debug-bg-color",
                                             "black").value]
        fgColor.setW(
            ConfigVariableDouble("on-screen-debug-fg-alpha", 0.85).value)
        bgColor.setW(
            ConfigVariableDouble("on-screen-debug-bg-alpha", 0.85).value)

        font = loader.loadFont(fontPath)
        if not font.isValid():
            print "failed to load OnScreenDebug font", fontPath
            font = TextNode.getDefaultFont()
        self.onScreenText = OnscreenText.OnscreenText(pos=(-1.0, 0.9),
                                                      fg=fgColor,
                                                      bg=bgColor,
                                                      scale=(fontScale,
                                                             fontScale, 0.0),
                                                      align=TextNode.ALeft,
                                                      mayChange=1,
                                                      font=font)
        # Make sure readout is never lit or drawn in wireframe
        DirectUtil.useDirectRenderStyle(self.onScreenText)
Example #11
0
    def load(self):
        self.notify.debug('load')
        DistributedMinigame.load(self)
        self.itText = OnscreenText.OnscreenText(
            'itText',
            fg=(0.95, 0.95, 0.65, 1),
            scale=0.14,
            font=ToontownGlobals.getSignFont(),
            pos=(0.0, -0.8),
            wordwrap=15,
            mayChange=1)
        self.itText.hide()
        safezoneId = self.getSafezoneId()
        self.sky = loader.loadModel(TagGameGlobals.getSky(safezoneId))
        self.ground = loader.loadModel(TagGameGlobals.getGround(safezoneId))
        self.music = base.loadMusic('phase_4/audio/bgm/MG_toontag.ogg')
        self.tagSfx = base.loadSfx('phase_4/audio/sfx/MG_Tag_C.ogg')
        self.itPointer = loader.loadModel(
            'phase_4/models/minigames/bboard-pointer')
        self.tracks = []
        self.initialPositions = TagGameGlobals.getDropPoints(safezoneId)
        self.IT = None

        if TagGameGlobals.isSnowHood(safezoneId):
            self.snow, self.snowRender = SnowUtil.createSnow(self.ground)

        return
Example #12
0
    def load(self):
        self.notify.debug("load")
        DistributedMinigame.load(self)

        self.itText = OnscreenText.OnscreenText(
            "itText",
            fg=(0.95, 0.95, 0.65, 1),
            scale=0.14,
            font=ToontownGlobals.getSignFont(),
            pos=(0.0, -0.8),
            wordwrap=15,
            mayChange=1,
        )
        self.itText.hide()

        self.sky = loader.loadModel("phase_3.5/models/props/TT_sky")
        self.ground = loader.loadModel("phase_4/models/minigames/tag_arena")

        self.music = base.loadMusic("phase_4/audio/bgm/MG_toontag.mid")
        self.tagSfx = base.loader.loadSfx("phase_4/audio/sfx/MG_Tag_C.mp3")
        self.itPointer = loader.loadModel(
            "phase_4/models/minigames/bboard-pointer")

        self.tracks = []
        self.IT = None
 def __init__(self, cr):
     DistributedObject.DistributedObject.__init__(self, cr)
     self.titleColor = (1, 1, 1, 1)
     self.titleText = OnscreenText.OnscreenText('', fg=self.titleColor, shadow=(0, 0, 0, 1), font=ToontownGlobals.getSuitFont(), pos=(0, -0.5), scale=0.1, drawOrder=0, mayChange=1)
     self.titleSequence = None
     self.pendingZoneChange = 0
     return
Example #14
0
    def doSpawnTitleText(self, text):
        self.titleColor = (1.0, 0.5, 0.4, 1.0)
        self.titleText = OnscreenText.OnscreenText(
            text,
            fg = self.titleColor,
            font = ToontownGlobals.getSignFont(),
            pos = (0,-0.5),
            scale = 0.16,
            drawOrder = 0,
            mayChange = 1,
            wordwrap = 16
            )

        self.titleText.setText(text)
        self.titleText.show()
        self.titleText.setColor(Vec4(*self.titleColor))
        self.titleText.clearColorScale()
        self.titleText.setFg(self.titleColor)
        seq = Task.sequence(
            # HACK! Let a pause go by to cover the loading pause
            # This tricks the taskMgr
            Task.pause(0.1),
            Task.pause(6.0),
            self.titleText.lerpColorScale(
            Vec4(1.0, 1.0, 1.0, 1.0),
            Vec4(1.0, 1.0, 1.0, 0.0),
            0.5),
            Task(self.hideTitleTextTask))
        taskMgr.add(seq, "titleText")
 def DisplayPartida(self):
     for i in range(0, MAX_LINHAS_PARTIDA):
         fontMenu = loader.loadFont('font1.ttf')
         self.displayPartida.append(
             OnscreenText(pos=(LIMITX[1], LIMITY[0] - .062 * i),
                          fg=(0, 0, 0, 1),
                          font=fontMenu,
                          align=TextNode.ALeft,
                          scale=.03))
Example #16
0
 def doSpawnTitleText(self, text):
     self.titleColor = (1.0, 0.5, 0.4, 1.0)
     self.titleText = OnscreenText.OnscreenText(text, fg=self.titleColor, font=ToontownGlobals.getSignFont(), pos=(0, -0.5), scale=0.16, drawOrder=0, mayChange=1, wordwrap=16)
     self.titleText.setText(text)
     self.titleText.show()
     self.titleText.setColor(Vec4(*self.titleColor))
     self.titleText.clearColorScale()
     self.titleText.setFg(self.titleColor)
     seq = Sequence(Wait(0.1), Wait(6.0), self.titleText.colorScaleInterval(0.5, Vec4(1.0, 1.0, 1.0, 0.0)), Func(self.hideTitleText))
     seq.start()
Example #17
0
 def Nome(self):
     self.backGround.append(OnscreenImage(image = 'texturas/background.png', pos = (0, 0, 0),scale = (1.8,1,1)))
     #self.backGround.append(OnscreenImage(image = 'texturas/bgright.png', pos = (1, 0, 0)))
     fontMenu = loader.loadFont('font1.ttf')
     self.lbjogador = OnscreenText(text = 'Informe o nome do 1º jogador:', font=fontMenu, style=1, fg = (0,0,0,1),shadow = DARKGRAIN , pos=(-0.7,0.1), align = TextNode.ALeft, scale = .09)
     self.dejogador = DirectEntry(text = "" ,scale=.07,focus=1,command=self.configuraNome)
     self.dejogador.setPos(Point3(-0.4,0,-0.05))
     self.musicaMenu.setVolume(3.0)
     self.musicaMenu.setLoop(True)
     self.musicaMenu.play()
Example #18
0
 def load(self):
     self.notify.debug('load')
     DistributedMinigame.load(self)
     self.itText = OnscreenText.OnscreenText('itText', fg = (0.94999999999999996, 0.94999999999999996, 0.65000000000000002, 1), scale = 0.14000000000000001, font = ToontownGlobals.getSignFont(), pos = (0.0, -0.80000000000000004), wordwrap = 15, mayChange = 1)
     self.itText.hide()
     self.sky = loader.loadModel('phase_3.5/models/props/TT_sky')
     self.ground = loader.loadModel('phase_4/models/minigames/tag_arena')
     self.music = base.loadMusic('phase_4/audio/bgm/MG_toontag.mid')
     self.tagSfx = base.loadSfx('phase_4/audio/sfx/MG_Tag_C.mp3')
     self.itPointer = loader.loadModel('phase_4/models/minigames/bboard-pointer')
     self.tracks = []
     self.IT = None
Example #19
0
    def __init__(
        self
    ):  #__init__ tells the file to load everything. Basically load settings and put commands in here.
        self.currentworld = ""

        self.title = OnscreenText(text='',
                                  mayChange=True,
                                  fg=(0, 0, 0, 1),
                                  pos=(.8, -.95),
                                  scale=.07,
                                  font=font,
                                  align=TextNode.ACenter)
        self.thememusic = loader.loadSfx('phase_4/audio/bgm/TC_nbrhood.mid')
        self.thememusic.play()
        self.thememusic.setVolume(.1)
        self.thememusic.setLoop(True)
        self.startWorld()  #executes the "loadTerrain" command found below

        self.accept("escape", self.askExit)
        self.accept("s", self.muteAudio)
        self.accept("e", self.enableAudio)
        self.accept("l", self.loadingScreen)
Example #20
0
 def __init__(self, cr):
     DistributedObject.DistributedObject.__init__(self, cr)
     self.titleColor = (1, 1, 1, 1)
     self.smallTitleText = OnscreenText.OnscreenText('',
                                                     fg=self.titleColor,
                                                     font=getSuitFont(),
                                                     pos=(0.65, 0.9),
                                                     scale=0.08,
                                                     drawOrder=0,
                                                     mayChange=1,
                                                     bg=(0.5, 0.5, 0.5,
                                                         0.5),
                                                     align=TextNode.ARight)
Example #21
0
 def __init__(self, cr):
     DistributedObject.DistributedObject.__init__(self, cr)
     self.lastCamEnterRoom = 0
     self.titleColor = (1, 1, 1, 1)
     self.titleText = OnscreenText.OnscreenText(
         '',
         fg=self.titleColor,
         shadow=(0, 0, 0, 1),
         font=ToontownGlobals.getSignFont(),
         pos=(0, -0.5),
         scale=0.10000000000000001,
         drawOrder=0,
         mayChange=1)
     self.titleSequence = None
    def DisplayJogador(self):
        self.displayInfo.append(
            OnscreenImage(image='texturas/bggamebottom.png',
                          pos=(0, 0, -0.8),
                          scale=(1.8, 0.2, 0.2)))
        for i in range(0, NUM_JOGADORES):
            if i == 0:
                posx = LIMITX[1] + 0.10
            else:
                posx = LIMITX[0] - 0.95

            fontMenu = loader.loadFont('font1.ttf')

            self.displayJogador.append(
                OnscreenText(text='Nome: ',
                             style=1,
                             font=fontMenu,
                             pos=(posx, LIMITY[1] + .22),
                             fg=(0, 0, 0, 1),
                             align=TextNode.ALeft,
                             scale=.09))
            self.displayPontos.append(
                OnscreenText(text='Pontos: ',
                             style=1,
                             font=fontMenu,
                             pos=(posx, LIMITY[1] + .13),
                             fg=(0, 0, 0, 1),
                             align=TextNode.ALeft,
                             scale=.09))
            self.displayCarta.append(
                OnscreenText(text='',
                             style=1,
                             font=fontMenu,
                             pos=(posx, LIMITY[1] + .07),
                             fg=(0, 0, 0, 1),
                             align=TextNode.ALeft,
                             scale=.06))
Example #23
0
    def showTitleText(self):
        if self.style.dept not in TTLocalizer.BossLocations:
            return Sequence()

        titleText = OnscreenText.OnscreenText(
            TTLocalizer.BossLocations[self.style.dept],
            fg=(1, 1, 1, 1),
            shadow=(0, 0, 0, 1),
            font=ToontownGlobals.getSuitFont(),
            pos=(0, -0.5),
            scale=0.16,
            wordwrap=16)
        return Sequence(Wait(5.0),
                        titleText.colorScaleInterval(0.5, (1, 1, 1, 0)),
                        Func(titleText.removeNode))
Example #24
0
 def __init__(self, dept):
     self.titleColor = (1, 1, 1, 1)
     self.smallTitleText = OnscreenText.OnscreenText('',
                                                     fg=self.titleColor,
                                                     font=getSuitFont(),
                                                     pos=(0.65, 0.9),
                                                     scale=0.08,
                                                     drawOrder=0,
                                                     mayChange=1,
                                                     bg=(0.5, 0.5, 0.5,
                                                         0.5),
                                                     align=TextNode.ARight)
     self.smallTitleText.hide()
     self.dept = dept
     return
Example #25
0
 def __init__(self,
              device='CerealBox',
              nodePath=base.direct.camera,
              headingNP=base.direct.camera):
     # See if device manager has been initialized
     if base.direct.deviceManager == None:
         base.direct.deviceManager = DirectDeviceManager()
     # Set name
     DirectJoybox.joyboxCount += 1
     self.name = 'Joybox-' + repr(DirectJoybox.joyboxCount)
     # Get buttons and analogs
     self.device = device
     self.analogs = base.direct.deviceManager.createAnalogs(self.device)
     self.buttons = base.direct.deviceManager.createButtons(self.device)
     self.aList = [0, 0, 0, 0, 0, 0, 0, 0]
     self.bList = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
     # For joybox fly mode
     # Default is joe mode
     self.mapping = [
         R_LEFT_RIGHT, R_FWD_BACK, L_FWD_BACK, R_TWIST, L_TWIST, NULL_AXIS
     ]
     self.modifier = [1, 1, 1, -1, -1, 0]
     # Initialize time
     self.lastTime = globalClock.getFrameTime()
     # Record node path
     self.nodePath = nodePath
     self.headingNP = headingNP
     self.useHeadingNP = False
     self.rotateInPlace = False
     self.floatingNP = NodePath("floating")
     # Ref CS for orbit mode
     self.refCS = base.direct.cameraControl.coaMarker
     self.tempCS = base.direct.group.attachNewNode('JoyboxTempCS')
     # Text object to display current mode
     self.readout = OnscreenText.OnscreenText(pos=(-0.9, 0.95),
                                              font=base.direct.font,
                                              mayChange=1)
     # List of functions to cycle through
     self.modeList = [self.joeMode, self.driveMode, self.orbitMode]
     # Pick initial mode
     self.updateFunc = self.joyboxFly
     self.modeName = 'Joe Mode'
     # Auxiliary data
     self.auxData = []
     # Button registry
     self.addButtonEvents()
     # Spawn update task
     self.enable()
Example #26
0
 def enter(self, requestStatus):
     hoodId = requestStatus['hoodId']
     zoneId = requestStatus['zoneId']
     hoodText = self.getHoodText(zoneId)
     self.titleText = OnscreenText.OnscreenText(
         hoodText,
         fg=self.titleColor,
         font=getSignFont(),
         pos=(0, -0.5),
         scale=TTLocalizer.HtitleText,
         drawOrder=0,
         mayChange=1)
     self.fsm.request(requestStatus['loader'], [requestStatus])
     base.cr.discordManager.setInfo(base.cr.discordManager.getState(), None,
                                    ToontownGlobals.Zone2String.get(zoneId),
                                    None, None, None, zoneId)
     return
 def enter(self, requestStatus):
     self.estateOwnerId = requestStatus.get('ownerId',
                                            base.localAvatar.doId)
     hoodText = TTLocalizer.IEstate
     self.titleText = OnscreenText.OnscreenText(
         hoodText,
         fg=self.titleColor,
         font=getSignFont(),
         pos=(0, -0.5),
         scale=TTLocalizer.HtitleText,
         drawOrder=0,
         mayChange=1)
     self.spawnTitleText()
     base.localAvatar.inEstate = 1
     self.loadCloudPlatforms()
     if base.cloudPlatformsEnabled and 0:
         self.setCloudSwitch(1)
     if self.cloudSwitch:
         self.setCloudSwitch(self.cloudSwitch)
     SafeZoneLoader.SafeZoneLoader.enter(self, requestStatus)
Example #28
0
    def enter(self, requestStatus):
        """
        enter this hood and start the state machine
        """
        assert (self.notify.debug("enter(requestStatus=" + str(requestStatus) +
                                  ")"))
        hoodId = requestStatus["hoodId"]
        zoneId = requestStatus["zoneId"]

        hoodText = self.getHoodText(zoneId)

        self.titleText = OnscreenText.OnscreenText(
            hoodText,
            fg=self.titleColor,
            font=getSignFont(),
            pos=(0, -0.5),
            scale=TTLocalizer.HtitleText,
            drawOrder=0,
            mayChange=1,
        )

        self.fsm.request(requestStatus["loader"], [requestStatus])
Example #29
0
    def __init__(self):
        ShowBase.__init__(self)
        self["ProjectDown"] = 0
        self["ProjectDirection"] = 0.1
        self["ProjectStrength"] = 0
        self["textUp"] = OnscreenText(text="0",
                                      pos=(1, 0),
                                      scale=0.5,
                                      mayChange=True)
        base.cTrav = CollisionTraverser()
        self["CollisionEvent"] = CollisionHandlerEvent()
        #A collision traverser named cTrav is called automatically
        loadModel(self, "CanyonBask")
        loadModel(self, "PenguiBall")
        loadModel(self, "HoopBall")
        loadModel(self, "Basketball")
        base.camera.reparentTo(self["PenguiBall"])
        self["Basketball"].setScale(0.05)
        self["PenguiBall"].setScale(0.05)
        self["HoopBall"].setScale(0.3)
        self["HoopBall"].setPos(-2, -20, 7.6)
        self["HoopBall"].setH(180)
        self["PenguiBall"].setPos(-2, -18, 7.6)
        collisionsetup(self)
        setuplights(self)

        taskMgr.doMethodLater(0.01,
                              PenMove,
                              "PenMove",
                              extraArgs=[self],
                              appendTask=True)
        self.accept("into-Sphere1", Collide, extraArgs=[self])
        self.camLens.setFov(120)
        self["HoopPath"].show()
        self["SphereBall"].show()
        taskMgr.doMethodLater(0.01, self.projectilestrength, "ProjectLaunch")
Example #30
0
    def __init__(self):
        # Establish a global pointer to the direct object early on
        # so dependant classes can access it in their code
        __builtins__["SEditor"] = self
        # These come early since they are used later on
        self.group = render.attachNewNode('SEditor')
        self.font = TextNode.getDefaultFont()
        self.fEnabled = 0
        self.drList = DisplayRegionList()
        self.iRayList = map(lambda x: x.iRay, self.drList)
        self.dr = self.drList[0]
        self.camera = base.camera
        self.trueCamera = self.camera
        self.iRay = self.dr.iRay
        self.coaMode = COA_ORIGIN

        self.enableAutoCamera = True

        self.cameraControl = DirectCameraControl()
        self.manipulationControl = DirectManipulationControl()
        self.useObjectHandles()
        self.grid = DirectGrid()
        self.grid.disable()

        # Initialize the collection of selected nodePaths
        self.selected = SelectedNodePaths()
        # Ancestry of currently selected object
        self.ancestry = []
        self.ancestryIndex = 0
        self.activeParent = None

        self.selectedNPReadout = OnscreenText.OnscreenText(
            pos=(-1.0, -0.9),
            bg=Vec4(1, 1, 1, 1),
            scale=0.05,
            align=TextNode.ALeft,
            mayChange=1,
            font=self.font)
        # Make sure readout is never lit or drawn in wireframe
        useDirectRenderStyle(self.selectedNPReadout)
        self.selectedNPReadout.reparentTo(hidden)

        self.activeParentReadout = OnscreenText.OnscreenText(
            pos=(-1.0, -0.975),
            bg=Vec4(1, 1, 1, 1),
            scale=0.05,
            align=TextNode.ALeft,
            mayChange=1,
            font=self.font)
        # Make sure readout is never lit or drawn in wireframe
        useDirectRenderStyle(self.activeParentReadout)
        self.activeParentReadout.reparentTo(hidden)

        self.directMessageReadout = OnscreenText.OnscreenText(
            pos=(-1.0, 0.9),
            bg=Vec4(1, 1, 1, 1),
            scale=0.05,
            align=TextNode.ALeft,
            mayChange=1,
            font=self.font)
        # Make sure readout is never lit or drawn in wireframe
        useDirectRenderStyle(self.directMessageReadout)
        self.directMessageReadout.reparentTo(hidden)

        self.fControl = 0
        self.fAlt = 0
        self.fShift = 0

        self.pos = VBase3()
        self.hpr = VBase3()
        self.scale = VBase3()

        self.hitPt = Point3(0.0)

        # Lists for managing undo/redo operations
        self.undoList = []
        self.redoList = []

        # One run through the context task to init everything
        self.drList.updateContext()
        for dr in self.drList:
            dr.camUpdate()

        self.modifierEvents = [
            'control',
            'control-up',
            'shift',
            'shift-up',
            'alt',
            'alt-up',
        ]
        self.keyEvents = [
            'escape', 'delete', 'page_up', 'page_down', '[', '{', ']', '}',
            'shift-a', 'b', 'control-f', 'l', 'shift-l', 'o', 'p', 'r',
            'shift-r', 's', 't', 'v', 'w'
        ]
        self.mouseEvents = [
            'mouse1',
            'mouse1-up',
            'shift-mouse1',
            'shift-mouse1-up',
            'control-mouse1',
            'control-mouse1-up',
            'alt-mouse1',
            'alt-mouse1-up',
            'mouse2',
            'mouse2-up',
            'shift-mouse2',
            'shift-mouse2-up',
            'control-mouse2',
            'control-mouse2-up',
            'alt-mouse2',
            'alt-mouse2-up',
            'mouse3',
            'mouse3-up',
            'shift-mouse3',
            'shift-mouse3-up',
            'control-mouse3',
            'control-mouse3-up',
            'alt-mouse3',
            'alt-mouse3-up',
        ]