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


Python messenger.send函数代码示例

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


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

示例1: __on_joystick_polling

    def __on_joystick_polling(self, task): 
        for ev in pygame.event.get(): 
        
            if ev.type is pygame.JOYBUTTONDOWN: 
                name = 'joystick%d-button%d' % (ev.joy, ev.button) 
                messenger.send(name) 
                print name
                
            elif ev.type is pygame.JOYBUTTONUP: 
                name = 'joystick%d-button%d-up' % (ev.joy, ev.button) 
                messenger.send(name) 
                
            elif ev.type is pygame.JOYAXISMOTION: 
                name = 'joystick%d-axis%d' % (ev.joy, ev.axis) 
                messenger.send(name, [ev.value]) 
                
            elif ev.type is pygame.JOYBALLMOTION: 
                name = 'joystick%d-ball%d' % (ev.joy, ev.hat) 
                messenger.send(name, [ev.rel]) 
                
            elif ev.type is pygame.JOYHATMOTION: 
                name = 'joystick%d-hat%d' % (ev.joy, ev.hat) 
                messenger.send(name, [ev.value]) 

            #print name
        return task.cont 
开发者ID:BackupGGCode,项目名称:autosim,代码行数:26,代码来源:stearingcontrol.py

示例2: update_gaming

   def update_gaming(self):
#      out('client update',frame_no=self.frame_no)
      void=True      
      self.frame_no+=1
      GEntity.frame_no=self.frame_no
      #process data from server (server's update included)
      for d in self.proxy.new_data:
         void=False
         #some of them are to be processed here
         if network.stc_start_game in d:
            out('network.stc_start_game')
            self.screen.frame.start_game()
         elif network.stc_end_game in d:
            out('network.stc_end_game')
            self.demand('Stats')
         #if etc
         #the rest is given to the gframe, responsible for the graphic stuff
         else:
            self.screen.frame.process_server_input(d)
      if void:
         if len(self.fake_keypresses):
            messenger.send(self.fake_keypresses[0])
            self.fake_keypresses.pop(0)
      for o in __builtin__.dispose_list:o.dispose()
      __builtin__.dispose_list=[]
开发者ID:onze,项目名称:goLive,代码行数:25,代码来源:main.py

示例3: setupWindow

    def setupWindow(self, windowType, x, y, width, height,
                    parent):
        """ Applies the indicated window parameters to the prc
        settings, for future windows; or applies them directly to the
        main window if the window has already been opened.  This is
        called by the browser. """

        if self.started and base.win:
            # If we've already got a window, this must be a
            # resize/reposition request.
            wp = WindowProperties()
            if x or y or windowType == 'embedded':
                wp.setOrigin(x, y)
            if width or height:
                wp.setSize(width, height)
            if windowType == 'embedded':
                wp.setParentWindow(parent)
            wp.setFullscreen(False)
            base.win.requestProperties(wp)
            self.windowProperties = wp
            return

        # If we haven't got a window already, start 'er up.  Apply the
        # requested setting to the prc file, and to the default
        # WindowProperties structure.

        self.__clearWindowProperties()

        if windowType == 'hidden':
            data = 'window-type none\n'
        else:
            data = 'window-type onscreen\n'

        wp = WindowProperties.getDefault()

        wp.clearParentWindow()
        wp.clearOrigin()
        wp.clearSize()

        wp.setFullscreen(False)
        if windowType == 'fullscreen':
            wp.setFullscreen(True)

        if windowType == 'embedded':
            wp.setParentWindow(parent)

        if x or y or windowType == 'embedded':
            wp.setOrigin(x, y)

        if width or height:
            wp.setSize(width, height)

        self.windowProperties = wp
        self.windowPrc = loadPrcFileData("setupWindow", data)
        WindowProperties.setDefault(wp)

        self.gotWindow = True

        # Send this call to the main thread; don't call it directly.
        messenger.send('AppRunner_startIfReady', taskChain = 'default')
开发者ID:BmanGames,项目名称:Toontown-Level-Editor,代码行数:60,代码来源:AppRunner.py

示例4: enterClosing

 def enterClosing(self, ts):
     doorFrameHoleRight = self.findDoorNode('doorFrameHoleRight')
     if doorFrameHoleRight.isEmpty():
         self.notify.warning('enterClosing(): did not find doorFrameHoleRight')
         return
     rightDoor = self.findDoorNode('rightDoor')
     if rightDoor.isEmpty():
         self.notify.warning('enterClosing(): did not find rightDoor')
         return
     otherNP = self.getDoorNodePath()
     trackName = 'doorClose-%d' % self.doId
     if self.rightSwing:
         h = 100
     else:
         h = -100
     self.finishDoorTrack()
     self.doorTrack = Sequence(LerpHprInterval(nodePath=rightDoor, duration=1.0, hpr=VBase3(0, 0, 0), startHpr=VBase3(h, 0, 0), other=otherNP, blendType='easeInOut'), Func(doorFrameHoleRight.hide), Func(self.hideIfHasFlat, rightDoor), SoundInterval(self.closeSfx, node=rightDoor), name=trackName)
     self.doorTrack.start(ts)
     if hasattr(self, 'done'):
         zoneId = self.otherZoneId
         if self.doorType == DoorTypes.EXT_STANDARD:
             whereTo = 'house'
         else:
             whereTo = 'estate'
         request = {'loader': 'safeZoneLoader',
          'where': whereTo,
          'how': 'doorIn',
          'hoodId': ToontownGlobals.MyEstate,
          'zoneId': zoneId,
          'shardId': None,
          'avId': -1,
          'allowRedirect': 0,
          'doorDoId': self.otherDoId}
         messenger.send('doorDoneEvent', [request])
开发者ID:gamerdave54321,项目名称:Toontown-House-Code,代码行数:34,代码来源:DistributedHouseDoor.py

示例5: quickSaveButton

 def quickSaveButton(self):
     '''quicksave the data'''
     self.menu.hide()
     self.button_quicksave['state'] = DGG.DISABLED
     self.button_quickload['state'] = DGG.DISABLED
     if self._currentDump:
         messenger.send('quick_save', [self._currentDump,self._currentMessage])
开发者ID:WindyDarian,项目名称:Sogal,代码行数:7,代码来源:story_manager.py

示例6: add

    def add(self, w, x, y, z):
        n = core.NodePath('designation')
        n.setPos(x, y, z)
        n.setShader(self.shader)
        n.setShaderInput('color', core.Vec4(0.5, 1.0, 0.5, 0.5))
        self.model.instanceTo(n)

        messenger.send('designation-add', [x, y, z, n])
开发者ID:anossov,项目名称:dorfdelf,代码行数:8,代码来源:designation.py

示例7: enterGame

 def enterGame(self,isNew):
     print '进入游戏状态'
     if isNew:
         print '新建游戏'
         messenger.send("serious_new_game")
     else:
         print '读取游戏'
         messenger.send("serious_load_game")
开发者ID:ShengCN,项目名称:SeriousCode,代码行数:8,代码来源:serious_state_manager.py

示例8: test_hold_joystick_right

 def test_hold_joystick_right(self):
     """
     test that if required to hold for reward, actually requires hold
     """
     self.cb.inc_js_goal()
     messenger.send('x_axis', [1])
     self.assertFalse(self.cb.reward_on)
     messenger.send('x_axis', [1])
     self.assertTrue(self.cb.reward_on)
开发者ID:codedragon,项目名称:goBananas,代码行数:9,代码来源:test_crossTraining.py

示例9: focus_on

    def focus_on(self, target, radius):

        self.__objectToFocus = target
        self.__radius = radius

        self.__objectPrevPos = target.getPos()

        targetPos = target.getPos()
        cameraPos = self.__camToCtrl.getPos()

        #print "The Pos of Camera : ", cameraPos
        #print "The Pos of Target : ", targetPos

        ctVector = cameraPos - targetPos
        ctvLen = ctVector.length()
        ctVector.normalize()

        #print "The e Vector : ", ctVector

        disOffset = math.fabs(ctvLen - radius)

        #print "The Distance Offset : ", disOffset

        if ctvLen > radius:

            cameraPos -= ctVector * disOffset

        elif ctvLen < radius:

            cameraPos += ctVector * disOffset

        #print "The Camera Move To : ", cameraPos

        self.__camCurrX = cameraPos[0]
        self.__camCurrY = cameraPos[1]
        self.__camCurrZ = cameraPos[2]

        self.__camToCtrl.setPos(cameraPos)
        self.__camToCtrl.lookAt(target)

        self.__update_directionsVector()

        self.turn_off_ctrl_options(
            options = [CAM_MOVE_FORWARD,
                       CAM_MOVE_BACKWARD,
                       CAM_MOVE_LEFT,
                       CAM_MOVE_RIGHT,
                       CAM_MOVE_UP,
                       CAM_MOVE_DOWN,
                       CAM_ROTATE_H_CW,
                       CAM_ROTATE_H_CCW,
                       CAM_ROTATE_P_CW,
                       CAM_ROTATE_P_CCW,
                       CAM_ROTATE_R_CW,
                       CAM_ROTATE_R_CCW])

        messenger.send("update_camera")
开发者ID:ShengCN,项目名称:SeriousCode,代码行数:57,代码来源:camera_controller.py

示例10: run

    def run(self):
        t = self.globalClock.getFrameTime()
        timeDelta = t - self.globalClock.getRealTime()
        self.globalClock.setRealTime(t)
        messenger.send('resetClock', [timeDelta])
        if self.resumeFunc != None:
            self.resumeFunc()
        if self.stepping:
            self.step()
        else:
            self.running = True
            while self.running:
                try:
                    if len(self._frameProfileQueue):
                        numFrames, session, callback = self._frameProfileQueue.pop()

                        def _profileFunc(numFrames = numFrames):
                            self._doProfiledFrames(numFrames)

                        session.setFunc(_profileFunc)
                        session.run()
                        _profileFunc = None
                        if callback:
                            callback()
                        session.release()
                    else:
                        self.step()
                except KeyboardInterrupt:
                    self.stop()
                except IOError as ioError:
                    code, message = self._unpackIOError(ioError)
                    if code == 4:
                        self.stop()
                    else:
                        raise
                except Exception as e:
                    if self.extendedExceptions:
                        self.stop()
                        print_exc_plus()
                    else:
                        if ExceptionVarDump.wantStackDumpLog and ExceptionVarDump.dumpOnExceptionInit:
                            ExceptionVarDump._varDump__print(e)
                        raise
                except:
                    if self.extendedExceptions:
                        self.stop()
                        print_exc_plus()
                    else:
                        raise

        self.mgr.stopThreads()
        return
开发者ID:MasterLoopyBM,项目名称:c0d3,代码行数:52,代码来源:Task.pyc.py

示例11: enterClosing

 def enterClosing(self, ts):
     doorFrameHoleRight = self.findDoorNode("doorFrameHoleRight")
     if doorFrameHoleRight.isEmpty():
         self.notify.warning("enterClosing(): did not find doorFrameHoleRight")
         return
     rightDoor = self.findDoorNode("rightDoor")
     if rightDoor.isEmpty():
         self.notify.warning("enterClosing(): did not find rightDoor")
         return
     otherNP = self.getDoorNodePath()
     trackName = "doorClose-%d" % self.doId
     if self.rightSwing:
         h = 100
     else:
         h = -100
     self.finishDoorTrack()
     self.doorTrack = Sequence(
         LerpHprInterval(
             nodePath=rightDoor,
             duration=1.0,
             hpr=VBase3(0, 0, 0),
             startHpr=VBase3(h, 0, 0),
             other=otherNP,
             blendType="easeInOut",
         ),
         Func(doorFrameHoleRight.hide),
         Func(self.hideIfHasFlat, rightDoor),
         SoundInterval(self.closeSfx, node=rightDoor),
         name=trackName,
     )
     self.doorTrack.start(ts)
     if hasattr(self, "done"):
         base.cr.playGame.hood.loader.setHouse(self.houseId)
         zoneId = self.otherZoneId
         if self.doorType == DoorTypes.EXT_STANDARD:
             whereTo = "house"
         else:
             whereTo = "estate"
         request = {
             "loader": "safeZoneLoader",
             "where": whereTo,
             "how": "doorIn",
             "hoodId": ToontownGlobals.MyEstate,
             "zoneId": zoneId,
             "shardId": None,
             "avId": -1,
             "allowRedirect": 0,
             "doorDoId": self.otherDoId,
         }
         messenger.send("doorDoneEvent", [request])
     return
开发者ID:BmanGames,项目名称:Toontown-Level-Editor,代码行数:51,代码来源:DistributedHouseDoor.py

示例12: set_block

    def set_block(self, x, y, z, form, substance, hidden, update_hidden=True):
        if (x, y, z) not in self:
            return False

        old = self.blocks[(x, y, z)]
        new = (form, substance, hidden)

        if old != new:
            self.blocks[(x, y, z)] = new
            messenger.send('block-update', [(x, y, z)])

            if update_hidden:
                for dx, dy, dz in DIRECTIONS.values():
                    self.update_hidden(x + dx, y + dy, z + dz)
开发者ID:anossov,项目名称:dorfdelf,代码行数:14,代码来源:world.py

示例13: load

 def load(self):
     self.notify.debug('load')
     if not self.house_loaded:
         if self.houseType >= len(self.cr.playGame.hood.loader.houseModels):
             self.houseType = HouseGlobals.HOUSE_DEFAULT
         houseModel = self.cr.playGame.hood.loader.houseModels[self.houseType]
         self.house = houseModel.copyTo(self.cr.playGame.hood.loader.houseNode[self.housePosInd])
         self.house_loaded = 1
         self.cr.playGame.hood.loader.houseId2house[self.doId] = self.house
         if self.houseType == HouseGlobals.HOUSE_DEFAULT:
             self.__setHouseColor()
         if self.houseType == HouseGlobals.HOUSE_DEFAULT or self.houseType == HouseGlobals.HOUSE_TEST:
             self.__setupDoor()
         else:
             self.__setupDoorCustom()
         messenger.send('houseLoaded-%d' % self.doId)
开发者ID:BmanGames,项目名称:ToontownStride,代码行数:16,代码来源:DistributedHouse.py

示例14: __downloadPackageTask

    def __downloadPackageTask(self, task):

        """ This task runs on the aysynchronous task chain; each pass,
        it extracts one package from self.needsDownload and downloads
        it. """

        while True:
            self.packageLock.acquire()
            try:
                # If we're done downloading, stop the task.
                if self.state == self.S_done or not self.needsDownload:
                    self.downloadTask = None
                    self.packageLock.release()
                    yield task.done; return

                assert self.state == self.S_started
                pp = self.needsDownload[0]
                del self.needsDownload[0]
            except:
                self.packageLock.release()
                raise
            self.packageLock.release()

            # Now serve this one package.
            eventName = 'PackageInstaller-%s-packageStarted' % self.uniqueId
            messenger.send(eventName, [pp], taskChain = 'default')

            if not pp.package.hasPackage:
                for token in pp.package.downloadPackageGenerator(self.appRunner.http):
                    if token == pp.package.stepContinue:
                        yield task.cont
                    else:
                        break

                if token != pp.package.stepComplete:
                    pc = PStatCollector(':App:PackageInstaller:donePackage:%s' % (pp.package.packageName))
                    pc.start()
                    self.__donePackage(pp, False)
                    pc.stop()
                    yield task.cont
                    continue

            # Successfully downloaded and installed.
            pc = PStatCollector(':App:PackageInstaller:donePackage:%s' % (pp.package.packageName))
            pc.start()
            self.__donePackage(pp, True)
            pc.stop()
开发者ID:AdrianF98,项目名称:Toontown-2-Revised,代码行数:47,代码来源:PackageInstaller.py

示例15: dispatchMessages

 def dispatchMessages(self):
     if self.walk:
         messenger.send("walk", [-0.1])
     elif self.reverse:
         messenger.send("reverse", [0.1])
     if self.left:
         messenger.send("turn", [0.8])
     elif self.right:
         messenger.send("turn", [-0.8])
开发者ID:ShengCN,项目名称:SeriousCode,代码行数:9,代码来源:input_handler.py


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