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


Python SceneClient.run方法代码示例

本文整理汇总了Python中Scene.SceneClient.run方法的典型用法代码示例。如果您正苦于以下问题:Python SceneClient.run方法的具体用法?Python SceneClient.run怎么用?Python SceneClient.run使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Scene.SceneClient的用法示例。


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

示例1: run

# 需要导入模块: from Scene import SceneClient [as 别名]
# 或者: from Scene.SceneClient import run [as 别名]
  def run(self, ticks):
    SceneClient.run(self, ticks)

    if not self.wizardStarted:
      self.wizardStarted = True

      if not self.songName:
        while True:
          self.libraryName, self.songName = \
            Dialogs.chooseSong(self.engine, \
                               selectedLibrary = Config.get("game", "selected_library"),
                               selectedSong    = Config.get("game", "selected_song"))
        
          if not self.songName:
            self.session.world.finishGame()
            return

          Config.set("game", "selected_library", self.libraryName)
          Config.set("game", "selected_song",    self.songName)
          
          info = Song.loadSongInfo(self.engine, self.songName, library = self.libraryName)
          d = Dialogs.chooseItem(self.engine, info.difficulties,
                                 _("Choose a difficulty:"), selected = self.player.difficulty)
          if d:
            self.player.difficulty = d
            break
      else:
        info = Song.loadSongInfo(self.engine, self.songName, library = self.libraryName)

      # Make sure the difficulty we chose is available
      if not self.player.difficulty in info.difficulties:
        self.player.difficulty = info.difficulties[0]
        
      self.session.world.deleteScene(self)
      self.session.world.createScene("GuitarScene", libraryName = self.libraryName, songName = self.songName)
开发者ID:fretsonfire,项目名称:fof-python,代码行数:37,代码来源:SongChoosingScene.py

示例2: run

# 需要导入模块: from Scene import SceneClient [as 别名]
# 或者: from Scene.SceneClient import run [as 别名]
    def run(self, ticks):
        SceneClient.run(self, ticks)
        pos = self.getSongPosition()

        # update song
        if self.song:
            # update stage
            self.stage.run(pos, self.guitar.currentPeriod)

            if self.countdown <= 0 and not self.song.isPlaying() and not self.done:
                self.goToResults()
                return

            if self.autoPlay:
                notes = self.guitar.getRequiredNotes(self.song, pos)
                notes = [note.number for time, note in notes]

                changed = False
                held = 0
                for n, k in enumerate(KEYS):
                    if n in notes and not self.controls.getState(k):
                        changed = True
                        self.controls.toggle(k, True)
                    elif not n in notes and self.controls.getState(k):
                        changed = True
                        self.controls.toggle(k, False)
                    if self.controls.getState(k):
                        held += 1
                if changed and held:
                    self.doPick()

            self.song.update(ticks)
            if self.countdown > 0:
                self.guitar.setBPM(self.song.bpm)
                self.countdown = max(self.countdown - ticks / self.song.period, 0)
                if not self.countdown:
                    self.engine.collectGarbage()
                    self.song.setGuitarVolume(self.guitarVolume)
                    self.song.setBackgroundVolume(self.songVolume)
                    self.song.setRhythmVolume(self.rhythmVolume)
                    self.song.play()

        # update board
        if not self.guitar.run(ticks, pos, self.controls):
            # done playing the current notes
            self.endPick()

        # missed some notes?
        if self.guitar.getMissedNotes(self.song, pos) and not self.guitar.playedNotes:
            self.song.setGuitarVolume(0.0)
            self.player.streak = 0

        # late pick
        if self.keyBurstTimeout is not None and self.engine.timer.time > self.keyBurstTimeout:
            self.keyBurstTimeout = None
            notes = self.guitar.getRequiredNotes(self.song, pos)
            if self.guitar.controlsMatchNotes(self.controls, notes):
                self.doPick()
开发者ID:fculpo,项目名称:fof-reborn,代码行数:60,代码来源:GuitarScene.py

示例3: run

# 需要导入模块: from Scene import SceneClient [as 别名]
# 或者: from Scene.SceneClient import run [as 别名]
 def run(self, ticks):
   SceneClient.run(self, ticks)
   self.time    += ticks / 50.0
   self.counter += ticks
   
   if self.counter > 5000 and self.taunt:
     self.taunt.setVolume(self.engine.config.get("audio", "guitarvol"))
     self.taunt.play()
     self.taunt = None
开发者ID:fretsonfire,项目名称:fof-python,代码行数:11,代码来源:GameResultsScene.py

示例4: run

# 需要导入模块: from Scene import SceneClient [as 别名]
# 或者: from Scene.SceneClient import run [as 别名]
  def run(self, ticks):
    SceneClient.run(self, ticks)
    self.time    += ticks / 50.0
    self.counter += ticks

    if self.offset != None:
      self.offset -= ticks / 20000.0
    if self.pauseScroll != None:
      self.pauseScroll += ticks / 20000.0
      

    if self.counter > 5000 and self.taunt:
      #self.taunt.setVolume(self.engine.config.get("audio", "guitarvol"))
      self.taunt.setVolume(self.engine.config.get("audio", "SFX_volume"))  #MFH - sound effect level
      self.taunt.play()
      self.taunt = None
开发者ID:Gamer125,项目名称:fofix,代码行数:18,代码来源:GameResultsScene.py

示例5: run

# 需要导入模块: from Scene import SceneClient [as 别名]
# 或者: from Scene.SceneClient import run [as 别名]
  def run(self, ticks):
    SceneClient.run(self, ticks)
    self.time    += ticks / 50.0
    self.counter += ticks

    if self.offset != None:
      self.offset -= ticks / 20000.0
    if self.pauseScroll != None:
      self.pauseScroll += ticks / 20000.0
      
    if self.counter > 5000 and self.taunt:
      #self.taunt.setVolume(self.engine.config.get("audio", "guitarvol"))
      self.taunt.setVolume(self.engine.config.get("audio", "SFX_volume"))  #MFH - sound effect level
      self.taunt.play()
      self.taunt = None

    #MFH - add counter here to play another crowd cheer before the one playing ends for an endless cheering loop
    if self.engine.data.cheerSoundFound > 0 and self.resultCheerLoop > 0:
      if self.resultCheerLoop == 2 or (self.resultCheerLoop == 1 and self.engine.data.cheerSoundFound == 2):
        self.cheerLoopCounter += 1
        if self.cheerLoopCounter >= self.cheerLoopDelay:
          self.cheerLoopCounter = 0
          self.engine.data.crowdSound.play()
开发者ID:Gamer125,项目名称:fofix,代码行数:25,代码来源:GameResultsScene.py

示例6: run

# 需要导入模块: from Scene import SceneClient [as 别名]
# 或者: from Scene.SceneClient import run [as 别名]
  def run(self, ticks):
    SceneClient.run(self, ticks)
    players = 1

    if not self.wizardStarted:
      self.wizardStarted = True


      if self.engine.cmdPlay == 1:
        self.songName = Config.get("game", "selected_song")
        self.libraryName = Config.get("game", "selected_library")
        self.engine.cmdPlay = 2
        
      if not self.songName:
        while True:
          self.libraryName, self.songName = \
            Dialogs.chooseSong(self.engine, \
                               selectedLibrary = Config.get("game", "selected_library"),
                               selectedSong    = Config.get("game", "selected_song"))

          if self.libraryName == None:
            newPath = Dialogs.chooseFile(self.engine, masks = ["*/songs"], prompt = _("Choose a new songs directory."), dirSelect = True)
            if newPath != None:
              Config.set("game", "base_library", os.path.dirname(newPath))
              Config.set("game", "selected_library", "songs")
              Config.set("game", "selected_song", "")
            
          if not self.songName:
            self.session.world.finishGame()
            return

          Config.set("game", "selected_library", self.libraryName)
          Config.set("game", "selected_song",    self.songName)
          
          info = Song.loadSongInfo(self.engine, self.songName, library = self.libraryName)

          selected = False
          escape = False
          escaped = False
          while True:
            if len(info.parts) > 1:
              p = Dialogs.chooseItem(self.engine, info.parts, "%s \n %s" % (info.name, _("Player 1 Choose a part:")), selected = self.player.part)
            else:
              p = info.parts[0]
            if p:
              self.player.part = p
            else:
              break;
            while True:
              if len(info.difficulties) > 1:
                d = Dialogs.chooseItem(self.engine, info.difficulties,
                                     "%s \n %s" % (info.name, _("Player 1 Choose a difficulty:")), selected = self.player.difficulty)
              else:
                d = info.difficulties[0]
              if d:
                self.player.difficulty = d
              else:
                if len(info.parts) <= 1:
                  escape = True
                break
              while True:
                if self.engine.config.get("game", "players") > 1:               
                  p = Dialogs.chooseItem(self.engine, info.parts + ["Party Mode"] + ["No Player 2"], "%s \n %s" % (info.name, _("Player 2 Choose a part:")), selected = self.player2.part)
                  if p and p == "No Player 2":
                    players = 1
                    selected = True
                    self.player2.part = p
                    break
                  elif p and p == "Party Mode":
                    players = -1
                    selected = True
                    self.player2.part = p
                    break
                  elif p and p != "No Player 2" and p != "Party Mode":
                    players = 2
                    self.player2.part = p

                  else:
                    if len(info.difficulties) <= 1:
                      escaped = True
                    if len(info.parts) <= 1:
                      escape = True
                    break
                  while True:                    
                    if len(info.difficulties) > 1:
                      d = Dialogs.chooseItem(self.engine, info.difficulties, "%s \n %s" % (info.name, _("Player 2 Choose a difficulty:")), selected = self.player2.difficulty)
                    else:
                      d = info.difficulties[0]
                    if d:
                      self.player2.difficulty = d
                    else:
                      break
                    selected = True
                    break
                else:
                  selected = True
                  break
                if selected:
                  break
              if selected or escaped:
#.........这里部分代码省略.........
开发者ID:broccoliftw,项目名称:workingfofwindows8,代码行数:103,代码来源:SongChoosingScene.py

示例7: run

# 需要导入模块: from Scene import SceneClient [as 别名]
# 或者: from Scene.SceneClient import run [as 别名]
  def run(self, ticks):
    SceneClient.run(self, ticks)
    players = 1

    if not self.wizardStarted:
      self.wizardStarted = True

      if self.engine.cmdPlay == 1:
        self.songName = Config.get("game", "selected_song")
        self.libraryName = Config.get("game", "selected_library")
        self.engine.cmdPlay = 2

      if not self.songName:
        while True:
          self.libraryName, self.songName = \
            Dialogs.chooseSong(self.engine, \
                               selectedLibrary = Config.get("game", "selected_library"),
                               selectedSong    = Config.get("game", "selected_song"))

          if self.libraryName == None:
            newPath = Dialogs.chooseFile(self.engine, masks = ["*/songs"], prompt = _("Choose a new songs directory."), dirSelect = True)
            if newPath != None:
              Config.set("game", "base_library", os.path.dirname(newPath))
              Config.set("game", "selected_library", "songs")
              Config.set("game", "selected_song", "")
              self.engine.resource.refreshBaseLib()   #myfingershurt - to let user continue with new songpath without restart
            
          if not self.songName:
            self.session.world.finishGame()
            return

          Config.set("game", "selected_library", self.libraryName)
          Config.set("game", "selected_song",    self.songName)
          
          info = Song.loadSongInfo(self.engine, self.songName, library = self.libraryName)

          selected = False
          escape = False
          escaped = False
            
          #while True:    #this nesting is now useless
          #MFH - add "Practice" mode, which will activate a section selection menu before "part"
          #racer: main menu instead of second menu practice
          
          #self.player.practiceMode = Player.PracticeSet

            #MFH - parameters for newLocalGame:
            #players = -1 (party mode), 1, 2
            #mode1p = 0 (quickplay), 1 (practice), 2 (career)
            #mode2p = 0 (face-off), 1 (pro face-off)
              #Config.define("game",   "players",             int,   1)
              #Config.define("player0","mode_1p",           int,  0)
              #Config.define("player1","mode_2p",           int,  0)

          if Config.get("player0","mode_1p") == 1 and Config.get("game","players") == 1:    #practice mode
            self.player.practiceMode = True
          else:
            self.player.practiceMode = False
           
          while True: #new nesting for Practice Mode - section / start time selection
            if self.player.practiceMode:
              #self.engine.resource.load(self, "song", lambda: Song.loadSong(self.engine, songName, library = self.libraryName, notesOnly = True, part = [player.part for player in self.playerList]), onLoad = self.songLoaded)

              
              #startTime = Dialogs.chooseItem(self.engine, info.sections, "%s \n %s" % (info.name, _("Start Section:")))
              
              sectionLabels = [sLabel for sLabel,sPos in info.sections]
              startLabel = Dialogs.chooseItem(self.engine, sectionLabels, "%s \n %s" % (info.name, _("Start Section:")))
              if startLabel:
                Log.debug("Practice start section selected: " + startLabel)
            else:
              startLabel = "Gig"
            if startLabel:
              self.player.practiceSection = startLabel
              
              #find start position in array:
              self.player.startPos = [sPos for sLabel,sPos in info.sections if sLabel == startLabel]
              Log.debug("Practice start position retrieved: " + str(self.player.startPos) )
              
            else:
              
              break;
            #if not self.player.practiceMode:
              #selected = True  #this causes "gig" mode to start song with all defaults
              #escape = True  #this causes "gig" mode to exit out to the song selection
              #escaped = True  #this does nothing :(
              #break;

          
          
          
            while True: #new nesting for Practice Mode selection
            
              if len(info.parts) > 1:
                p = Dialogs.chooseItem(self.engine, info.parts, "%s \n %s" % (info.name, _("Player 1 Choose a part:")), selected = self.player.part)
              else:
                p = info.parts[0]
              if p:
                self.player.part = p
              else:
#.........这里部分代码省略.........
开发者ID:Gamer125,项目名称:fofix,代码行数:103,代码来源:SongChoosingScene.py

示例8: run

# 需要导入模块: from Scene import SceneClient [as 别名]
# 或者: from Scene.SceneClient import run [as 别名]
  def run(self, ticks):
    SceneClient.run(self, ticks)
    players = 1

    if not self.wizardStarted:
      self.wizardStarted = True

      if not self.songName:
        while 1:
          if self.engine.cmdPlay == 2:
            self.songName = Config.get("game", "selected_song")
            self.libraryName = Config.get("game", "selected_library")
          else:
            self.mode = 1
            self.libraryName, self.songName = \
              Dialogs.chooseSong(self.engine, \
                               selectedLibrary = Config.get("game", "selected_library"),
                               selectedSong    = Config.get("game", "selected_song"))

            if self.libraryName == None:
              newPath = Dialogs.chooseFile(self.engine, masks = ["*/songs"], prompt = _("Choose a new songs directory."), dirSelect = True)
              if newPath != None:
                Config.set("game", "base_library", os.path.dirname(newPath))
                Config.set("game", "selected_library", "songs")
                Config.set("game", "selected_song", "")
                self.engine.resource.refreshBaseLib()   #myfingershurt - to let user continue with new songpath without restart

            if not self.songName:
              self.session.world.finishGame()
              return

          if not self.tut:
            Config.set("game", "selected_library", self.libraryName)
            Config.set("game", "selected_song",    self.songName)
          self.mode = 2
          info = Song.loadSongInfo(self.engine, self.songName, library = self.libraryName)

          selected = False
          escape = False
          escaped = False

          #while True:    #this nesting is now useless
          #MFH - add "Practice" mode, which will activate a section selection menu before "part"
          #racer: main menu instead of second menu practice

          #self.player.practiceMode = Player.PracticeSet

            #MFH - parameters for newLocalGame:
            #players = -1 (party mode), 1, 2
            #mode1p = 0 (quickplay), 1 (practice), 2 (career)
            #mode2p = 0 (face-off), 1 (pro face-off)
              #Config.define("game",   "players",             int,   1)
              #Config.define("game","game_mode",           int,  0)
              #Config.define("game","multiplayer_mode",           int,  0)

          if Config.get("game","game_mode") == 1 and Config.get("game","players") == 1:    #practice mode
            self.player.practiceMode = True
          else:
            self.player.practiceMode = False

          slowDownDivisor = Config.get("audio",  "speed_factor")

          while 1: #new nesting for Practice Mode - section / start time selection
            if self.player.practiceMode:
              values, options = Config.getOptions("audio", "speed_factor")
              if self.subMenuPosTuple:
                slowdown = Dialogs.chooseItem(self.engine, options, "%s \n %s" % (Dialogs.removeSongOrderPrefixFromName(info.name), _("Speed Select:")), pos = self.subMenuPosTuple)
              else:
                slowdown = Dialogs.chooseItem(self.engine, options, "%s \n %s" % (Dialogs.removeSongOrderPrefixFromName(info.name), _("Speed Select:")))
              for i in range(len(values)):
                if options[i] == slowdown:
                  self.player.practiceSpeed = values[i]
                  slowDownDivisor = values[i]
                  break

            if self.player.practiceMode:

              sectionLabels = [sLabel for sLabel,sPos in info.sections]

              if self.subMenuPosTuple:
                startLabel = Dialogs.chooseItem(self.engine, sectionLabels, "%s \n %s" % (Dialogs.removeSongOrderPrefixFromName(info.name), _("Start Section:")), pos = self.subMenuPosTuple)
              else:
                startLabel = Dialogs.chooseItem(self.engine, sectionLabels, "%s \n %s" % (Dialogs.removeSongOrderPrefixFromName(info.name), _("Start Section:")))

              if startLabel:
                Log.debug("Practice start section selected: " + startLabel)
            else:
              startLabel = "Gig"
            if startLabel:
              self.player.practiceSection = startLabel

              #find start position in array:
              try:
                tempStart = [sPos for sLabel,sPos in info.sections if sLabel == startLabel]
                if tempStart == []:
                  self.player.startPos = 0.0
                else:
                  self.player.startPos = tempStart[0]
                Log.debug("Practice start position retrieved: " + str(self.player.startPos))
              except:
#.........这里部分代码省略.........
开发者ID:zelurker,项目名称:fofix,代码行数:103,代码来源:SongChoosingScene.py


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