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


Python Scene.SceneClient类代码示例

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


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

示例1: run

  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,代码行数:35,代码来源:SongChoosingScene.py

示例2: run

    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,代码行数:58,代码来源:GuitarScene.py

示例3: run

 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,代码行数:9,代码来源:GameResultsScene.py

示例4: keyPressed

  def keyPressed(self, key, unicode):
    ret = SceneClient.keyPressed(self, key, unicode)

    c = self.controls.keyPressed(key)
    if self.song and (c in [Player.KEY1, Player.KEY2, Player.CANCEL, Player.ACTION1, Player.ACTION2] or key == pygame.K_RETURN):
      scores = self.song.info.getHighscores(self.player.difficulty)
      if not scores or self.player.score > scores[-1][0] or len(scores) < 5:
        if self.player.cheating:
          Dialogs.showMessage(self.engine, _("No highscores for cheaters!"))
        else:
          name = Dialogs.getText(self.engine, _("%d points is a new high score! Please enter your name:") % self.player.score, self.player.name)
          if name:
            self.player.name = name
          self.highscoreIndex = self.song.info.addHighscore(self.player.difficulty, self.player.score, self.stars, self.player.name)
          self.song.info.save()

          if self.engine.config.get("game", "uploadscores"):
            self.uploadingScores = True
            fn = lambda: self.song.info.uploadHighscores(self.engine.config.get("game", "uploadurl"), self.song.getHash())
            self.engine.resource.load(self, "uploadResult", fn)

      self.showHighscores = True
      self.engine.view.pushLayer(self.menu)
      return True
    
    return ret
开发者ID:fretsonfire,项目名称:fof-python,代码行数:26,代码来源:GameResultsScene.py

示例5: run

  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,代码行数:16,代码来源:GameResultsScene.py

示例6: keyPressed

  def keyPressed(self, key, unicode):
    ret = SceneClient.keyPressed(self, key, unicode)

    c = self.controls.keyPressed(key)
    if self.song and (c in [Player.KEY1, Player.KEY2, Player.CANCEL, Player.ACTION1, Player.ACTION2, Player.DRUM1A, Player.DRUM4A] or key == pygame.K_RETURN):
      for i,player in enumerate(self.playerList):
      
        scores = self.song.info.getHighscores(player.difficulty, part = player.part)
        if not scores or player.score > scores[-1][0] or len(scores) < 5:
          if player.cheating:
            Dialogs.showMessage(self.engine, _("No highscores for cheaters!"))
          elif player.score == 0: #trinidude4
            Dialogs.showMessage(self.engine, _("No highscore")) #trinidude4
          else:
            #alarian name = Dialogs.getText(self.engine, _("%d points is a new high score! Player " + str(i+1) + " enter your name") % player.score, player.name)
            name = Dialogs.getText(self.engine, _("%d points is a new high score! Enter your name") % player.score, player.name)
            if name:
              player.name = name

            #myfingershurt: don't separate chords for drum part totals:
            if player.part.text == "Drums":
              notesTotal = len([1 for time, event in self.song.track[i].getAllEvents() if isinstance(event, Song.Note)])
            else:
              notesTotal = len(set(time for time, event in self.song.track[i].getAllEvents() if isinstance(event, Song.Note)))
              
            modOptions1 = self.engine.config.getModOptions1(player.twoChord, 0)
            modOptions2 = self.engine.config.getModOptions2()
            scoreExt = (player.notesHit, notesTotal, player.longestStreak, Version.branchVersion(), modOptions1, modOptions2)
            self.highscoreIndex[i] = self.song.info.addHighscore(player.difficulty, player.score, self.stars[i], player.name, part = player.part, scoreExt = scoreExt)
            self.song.info.save()
          
            if self.engine.config.get("game", "uploadscores") and not player.cheating:
              self.uploadingScores = True
              #myfingershurt: ensuring new SP highscore upload URL is used from Divra (set to default in gameengine.py)
              # evilynux - New url starting 20080902
              fn = lambda: self.song.info.uploadHighscores(self.engine.config.get("game", "uploadurl_w67_starpower"), self.song.getHash(), part = player.part)
              
              self.engine.resource.load(self, "uploadResult", fn)

      if len(self.playerList) > 1 and self.playerList[0].part == self.playerList[1].part and self.playerList[0].difficulty == self.playerList[1].difficulty and self.highscoreIndex[0] != -1 and self.highscoreIndex[1] != -1 and self.highscoreIndex[1] <= self.highscoreIndex[0]:
        self.highscoreIndex[0] += 1
      
      if self.song.info.count:
        count = int(self.song.info.count)
      else:
        count = 0
      count += 1
      self.song.info.count = "%d" % count
      self.song.info.save()
      self.showHighscores = True
      self.engine.view.pushLayer(self.menu)
      return True
    return ret
开发者ID:Gamer125,项目名称:fofix,代码行数:53,代码来源:GameResultsScene.py

示例7: run

  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,代码行数:23,代码来源:GameResultsScene.py

示例8: keyPressed

  def keyPressed(self, key, unicode):
    ret = SceneClient.keyPressed(self, key, unicode)

    c = self.controls.keyPressed(key)
    if self.song and (c in [Player.KEY1, Player.KEY2, Player.CANCEL, Player.ACTION1, Player.ACTION2] or key == pygame.K_RETURN):
      for i,player in enumerate(self.playerList):
        scores = self.song.info.getHighscores(player.difficulty, part = player.part)
        if not scores or player.score > scores[-1][0] or len(scores) < 5:
          if player.cheating:
            Dialogs.showMessage(self.engine, _("No highscores for cheaters!"))
          else:
            name = Dialogs.getText(self.engine, _("%d points is a new high score! Player " + str(i+1) + " enter your name") % player.score, player.name)
            if name:
              player.name = name
            notesTotal = len([1 for time, event in self.song.track[i].getAllEvents() if isinstance(event, Song.Note)])
            modOptions1 = self.engine.config.getModOptions1(player.twoChord, 0)
            modOptions2 = self.engine.config.getModOptions2()
            scoreExt = (player.notesHit, notesTotal, player.longestStreak, Version.branchVersion(), modOptions1, modOptions2)
            self.highscoreIndex[i] = self.song.info.addHighscore(player.difficulty, player.score, self.stars[i], player.name, part = player.part, scoreExt = scoreExt)
            self.song.info.save()
          
            if self.engine.config.get("game", "uploadscores"):
              self.uploadingScores = True
              fn = lambda: self.song.info.uploadHighscores(self.engine.config.get("game", "uploadurl"), self.song.getHash(), part = player.part)
              self.engine.resource.load(self, "uploadResult", fn)

      if len(self.playerList) > 1 and self.playerList[0].part == self.playerList[1].part and self.playerList[0].difficulty == self.playerList[1].difficulty and self.highscoreIndex[0] != None and self.highscoreIndex[1] != None and self.highscoreIndex[1] <= self.highscoreIndex[0]:
        self.highscoreIndex[0] += 1
      
      if self.song.info.count:
        count = int(self.song.info.count)
      else:
        count = 0
      count += 1
      self.song.info.count = "%d" % count
      self.song.info.save()
      self.showHighscores = True
      self.engine.view.pushLayer(self.menu)
      return True
    return ret
开发者ID:broccoliftw,项目名称:workingfofwindows8,代码行数:40,代码来源:GameResultsScene.py

示例9: hidden

 def hidden(self):
   SceneClient.hidden(self)
   if self.nextScene:
     self.nextScene()
开发者ID:Gamer125,项目名称:fofix,代码行数:4,代码来源:GameResultsScene.py

示例10: run

  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,代码行数:101,代码来源:SongChoosingScene.py

示例11: render

    def render(self, visibility, topMost):
        SceneClient.render(self, visibility, topMost)

        font    = self.engine.data.font
        bigFont = self.engine.data.bigFont

        self.visibility = v = 1.0 - ((1 - visibility) ** 2)

        self.engine.view.setOrthogonalProjection(normalize = True)
        try:
            # show countdown
            if self.countdown > 1:
                Theme.setBaseColor(min(1.0, 3.0 - abs(4.0 - self.countdown)))
                text = _("Get Ready to Rock")
                w, h = font.getStringSize(text)
                font.render(text,  (.5 - w / 2, .3))
                if self.countdown < 6:
                    scale = 0.002 + 0.0005 * (self.countdown % 1) ** 3
                    text = "%d" % (self.countdown)
                    w, h = bigFont.getStringSize(text, scale = scale)
                    Theme.setSelectedColor()
                    bigFont.render(text,  (.5 - w / 2, .45 - h / 2), scale = scale)

            w, h = font.getStringSize(" ")
            y = .05 - h / 2 - (1.0 - v) * .2

            # show song name
            if self.countdown and self.song:
                Theme.setBaseColor(min(1.0, 4.0 - abs(4.0 - self.countdown)))
                Dialogs.wrapText(font, (.05, .05 - h / 2), self.song.info.name + " \n " + self.song.info.artist, rightMargin = .6, scale = 0.0015)

            Theme.setSelectedColor()

            font.render("%d" % (self.player.score + self.getExtraScoreForCurrentlyPlayedNotes()),  (.6, y))
            font.render("%dx" % self.player.getScoreMultiplier(), (.6, y + h))

            # show the streak counter and miss message
            if self.player.streak > 0 and self.song:
                text = _("%d hit") % self.player.streak
                factor = 0.0
                if self.lastPickPos:
                    diff = self.getSongPosition() - self.lastPickPos
                    if diff > 0 and diff < self.song.period * 2:
                        factor = .25 * (1.0 - (diff / (self.song.period * 2))) ** 2
                factor = (1.0 + factor) * 0.002
                tw, th = font.getStringSize(text, scale = factor)
                font.render(text, (.16 - tw / 2, y + h / 2 - th / 2), scale = factor)
            elif self.lastPickPos is not None and self.countdown <= 0:
                diff = self.getSongPosition() - self.lastPickPos
                alpha = 1.0 - diff * 0.005
                if alpha > .1:
                    Theme.setSelectedColor(alpha)
                    glPushMatrix()
                    glTranslate(.1, y + 0.000005 * diff ** 2, 0)
                    glRotatef(math.sin(self.lastPickPos) * 25, 0, 0, 1)
                    font.render(_("Missed!"), (0, 0))
                    glPopMatrix()

            # show the streak balls
            if self.player.streak >= 30:
                glColor3f(.5, .5, 1)
            elif self.player.streak >= 20:
                glColor3f(1, 1, .5)
            elif self.player.streak >= 10:
                glColor3f(1, .5, .5)
            else:
                glColor3f(.5, 1, .5)

            s = min(39, self.player.streak) % 10 + 1
            font.render(Data.BALL2 * s + Data.BALL1 * (10 - s),   (.67, y + h * 1.3), scale = 0.0011)

            # show multiplier changes
            if self.song and self.lastMultTime is not None:
                diff = self.getSongPosition() - self.lastMultTime
                if diff > 0 and diff < self.song.period * 2:
                    m = self.player.getScoreMultiplier()
                    c = (1, 1, 1)
                    if self.player.streak >= 40:
                        texture = None
                    elif m == 1:
                        texture = None
                    elif m == 2:
                        texture = self.fx2x.texture
                        c = (1, .5, .5)
                    elif m == 3:
                        texture = self.fx3x.texture
                        c = (1, 1, .5)
                    elif m == 4:
                        texture = self.fx4x.texture
                        c = (.5, .5, 1)

                    f = (1.0 - abs(self.song.period * 1 - diff) / (self.song.period * 1)) ** 2

                    # Flash the screen
                    glBegin(GL_TRIANGLE_STRIP)
                    glColor4f(c[0], c[1], c[2], (f - .5) * 1)
                    glVertex2f(0, 0)
                    glColor4f(c[0], c[1], c[2], (f - .5) * 1)
                    glVertex2f(1, 0)
                    glColor4f(c[0], c[1], c[2], (f - .5) * .25)
#.........这里部分代码省略.........
开发者ID:fculpo,项目名称:fof-reborn,代码行数:101,代码来源:GuitarScene.py

示例12: run

  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,代码行数:101,代码来源:SongChoosingScene.py

示例13: render

  def render(self, visibility, topMost):
    self.engine.view.setViewport(1,0)
    SceneClient.render(self, visibility, topMost)
    
    bigFont = self.engine.data.bigFont
    font    = self.engine.data.font

    v = ((1 - visibility) ** 2)
    
    glEnable(GL_BLEND)
    glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA)
    glEnable(GL_COLOR_MATERIAL)

    self.engine.view.setOrthogonalProjection(normalize = True)
    try:
      t = self.time / 100
      w, h, = self.engine.view.geometry[2:4]
      r = .5
      if self.background:
        imgwidth = self.background.width1()
        wfactor = 640.000/imgwidth
        self.background.transform.reset()
        #self.background.transform.scale(1,-1)
        self.background.transform.scale(wfactor,-wfactor)
        self.background.transform.translate(w/2,h/2)
        self.background.draw()
      
      if self.showHighscores:
        for j,player in enumerate(self.playerList):
          #self.engine.view.setViewportHalf(len(self.playerList),j)
          scale = 0.0017
          endScroll = -.14
        
          if self.pauseScroll != None:
            self.offset = 0.0

          if self.pauseScroll > 0.5:
            self.pauseScroll = None
          if self.offset == None:
            self.offset = 0
            self.pauseScroll = 0
            self.nextHighScore()

          
          # evilynux - highscore
          if self.song is not None:
            text = _("%s High Scores for %s") % (self.scorePart, Dialogs.removeSongOrderPrefixFromName(self.song.info.name))
          else:
            text = _("%s High Scores") % self.scorePart
          w, h = font.getStringSize(text)

          Theme.setBaseColor(1 - v)
          font.render(text, (.5 - w / 2, .01 - v + self.offset))

          text = _("Difficulty: %s") % (self.scoreDifficulty)
          w, h = font.getStringSize(text)
          Theme.setBaseColor(1 - v)
          font.render(text, (.5 - w / 2, .01 - v + h + self.offset))
        
          x = .01
          y = .16 + v
          
        if self.song:
          i = -1
          for i, scores in enumerate(self.song.info.getHighscores(self.scoreDifficulty, part = self.scorePart)):
            score, stars, name, scores_ext = scores
            notesHit, notesTotal, noteStreak, modVersion, modOptions1, modOptions2 = scores_ext
            if stars == 6:
              stars = 5
              perfect = 1
            else:
              perfect = 0
            for j,player in enumerate(self.playerList):
              if (self.time % 10.0) < 5.0 and i == self.highscoreIndex[j] and self.scoreDifficulty == player.difficulty and self.scorePart == player.part:
                Theme.setSelectedColor(1 - v)
                break
              else:
                Theme.setBaseColor(1 - v)
            font.render("%d." % (i + 1), (x, y + self.offset),    scale = scale)
            if notesTotal != 0:
              score = "%s %.1f%%" % (score, (float(notesHit) / notesTotal) * 100.0)
            if noteStreak != 0:
              score = "%s (%d)" % (score, noteStreak)
            font.render(unicode(score), (x + .05, y + self.offset),   scale = scale)
            options = ""
            w2, h2 = font.getStringSize(options, scale = scale / 2)
            font.render(unicode(options), (.6 - w2, y + self.offset),   scale = scale / 2)
            # evilynux - Fixed star size following Font render bugfix
            if perfect == 1 and self.theme == 2:
              glColor3f(1, 1, 0) #racer: perfect is now gold for rock band
            font.render(unicode(Data.STAR2 * stars + Data.STAR1 * (5 - stars)), (x + .6, y + self.offset), scale = scale * 1.8)
            if perfect == 1 and self.theme < 2:
              glColor3f(0, 1, 0) #racer: perfect is green for any non-RB theme
            font.render(unicode(Data.STAR2 * stars + Data.STAR1 * (5 - stars)), (x + .6, y + self.offset), scale = scale * 1.8)
            for j,player in enumerate(self.playerList):
              if (self.time % 10.0) < 5.0 and i == self.highscoreIndex[j] and self.scoreDifficulty == player.difficulty and self.scorePart == player.part:
                Theme.setSelectedColor(1 - v)
                break
              else:
                Theme.setBaseColor(1 - v)
#.........这里部分代码省略.........
开发者ID:Gamer125,项目名称:fofix,代码行数:101,代码来源:GameResultsScene.py

示例14: render

  def render(self, visibility, topMost):
    SceneClient.render(self, visibility, topMost)
    
    bigFont = self.engine.data.bigFont
    font    = self.engine.data.font

    v = ((1 - visibility) ** 2)
    
    glEnable(GL_BLEND)
    glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA)
    glEnable(GL_COLOR_MATERIAL)

    self.engine.view.setOrthogonalProjection(normalize = True)
    try:
      t = self.time / 100
      w, h, = self.engine.view.geometry[2:4]
      r = .5
      if self.background:
        if self.spinnyDisabled != True and Theme.spinnyResultsDisabled != True:
          self.background.transform.reset()
          self.background.transform.translate(v * 2 * w + w / 2 + math.cos(t / 2) * w / 2 * r, h / 2 + math.sin(t) * h / 2 * r)
          self.background.transform.rotate(-t)
          self.background.transform.scale(math.sin(t / 8) + 2, math.sin(t / 8) + 2)
        self.background.draw()
      
      if self.showHighscores:
        for j,player in enumerate(self.playerList):
          #self.engine.view.setViewportHalf(len(self.playerList),j)
          scale = 0.0017
          endScroll = -.14
        
          if self.pauseScroll != None:
            self.offset = 0.0

          if self.pauseScroll > 0.5:
            self.pauseScroll = None
          if self.offset == None:
            self.offset = 0
            self.pauseScroll = 0
            self.nextHighScore()

          
          text = _("%s High Scores") % (self.scorePart)
          w, h = font.getStringSize(text)

          Theme.setBaseColor(1 - v)
          font.render(text, (.5 - w / 2, .01 - v + self.offset))

          text = _("Difficulty: %s") % (self.scoreDifficulty)
          w, h = font.getStringSize(text)
          Theme.setBaseColor(1 - v)
          font.render(text, (.5 - w / 2, .01 - v + h + self.offset))
        
          x = .01
          y = .16 + v
          
        if self.song:
          i = -1
          for i, scores in enumerate(self.song.info.getHighscores(self.scoreDifficulty, part = self.scorePart)):
            score, stars, name, scores_ext = scores
            notesHit, notesTotal, noteStreak, modVersion, modOptions1, modOptions2 = scores_ext
            if stars == 6:
              stars = 5
              perfect = 1
            else:
              perfect = 0
            for j,player in enumerate(self.playerList):
              if (self.time % 10.0) < 5.0 and i == self.highscoreIndex[j] and self.scoreDifficulty == player.difficulty and self.scorePart == player.part:
                Theme.setSelectedColor(1 - v)
                break
              else:
                Theme.setBaseColor(1 - v)
            font.render("%d." % (i + 1), (x, y + self.offset),    scale = scale)
            if notesTotal != 0:
              score = "%s %.1f%%" % (score, (float(notesHit) / notesTotal) * 100.0)
            if noteStreak != 0:
              score = "%s %d" % (score, noteStreak)
            font.render(unicode(score), (x + .05, y + self.offset),   scale = scale)
            options = ""
            #options = "%s,%s" % (modOptions1, modOptions2)
            #options = self.engine.config.prettyModOptions(options)
            w2, h2 = font.getStringSize(options, scale = scale / 2)
            font.render(unicode(options), (.6 - w2, y + self.offset),   scale = scale / 2)
            if perfect == 1:
              glColor3f(0, 1, 0)
            font.render(unicode(Data.STAR2 * stars + Data.STAR1 * (5 - stars)), (x + .6, y + self.offset), scale = scale * .9)
            for j,player in enumerate(self.playerList):
              if (self.time % 10.0) < 5.0 and i == self.highscoreIndex[j] and self.scoreDifficulty == player.difficulty and self.scorePart == player.part:
                Theme.setSelectedColor(1 - v)
                break
              else:
                Theme.setBaseColor(1 - v)
            font.render(name, (x + .8, y + self.offset), scale = scale)
            y += h
            endScroll -= .07
            
          if self.offset < endScroll or i == -1:
            self.offset = .8
            self.nextHighScore()
            endScroll = -0.14
#.........这里部分代码省略.........
开发者ID:broccoliftw,项目名称:workingfofwindows8,代码行数:101,代码来源:GameResultsScene.py

示例15: render

  def render(self, visibility, topMost):
    SceneClient.render(self, visibility, topMost)
    
    bigFont = self.engine.data.bigFont
    font    = self.engine.data.font

    v = ((1 - visibility) ** 2)
    
    glEnable(GL_BLEND)
    glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA)
    glEnable(GL_COLOR_MATERIAL)

    self.engine.view.setOrthogonalProjection(normalize = True)
    try:
      t = self.time / 100
      w, h, = self.engine.view.geometry[2:4]
      r = .5
      self.background.transform.reset()
      self.background.transform.translate(v * 2 * w + w / 2 + math.cos(t / 2) * w / 2 * r, h / 2 + math.sin(t) * h / 2 * r)
      self.background.transform.rotate(-t)
      self.background.transform.scale(math.sin(t / 8) + 2, math.sin(t / 8) + 2)
      self.background.draw()
      
      if self.showHighscores:
        scale = 0.0017
        d = self.player.difficulty
        
        text = _("Highest Scores (%s)") % d
        w, h = font.getStringSize(text)
        Theme.setBaseColor(1 - v)
        font.render(text, (.5 - w / 2, .05 - v))
        
        x = .1
        y = .15 + v
        for i, scores in enumerate(self.song.info.getHighscores(d)):
          score, stars, name = scores
          if i == self.highscoreIndex and (self.time % 10.0) < 5.0:
            Theme.setSelectedColor(1 - v)
          else:
            Theme.setBaseColor(1 - v)
          font.render("%d." % (i + 1), (x, y),    scale = scale)
          font.render(unicode(score), (x + .05, y),   scale = scale)
          font.render(unicode(Data.STAR2 * stars + Data.STAR1 * (5 - stars)), (x + .25, y), scale = scale * .9)
          font.render(name, (x + .5, y), scale = scale)
          y += h
          
        if self.uploadingScores:
          Theme.setBaseColor(1 - v)
          if self.uploadResult is None:
            text = _("Uploading Scores...")
          else:
            success, ordinal = self.uploadResult
            if success:
              if ordinal > 0:
                text = _("You're #%d on the world charts!") % ordinal
              else:
                text = ""
            else:
              text = _("Score upload failed")
          font.render(text, (.05, .7 + v), scale = 0.001)
        return
      
      Theme.setBaseColor(1 - v)
      text = _("Song Finished!")
      w, h = font.getStringSize(text)
      font.render(text, (.5 - w / 2, .05 - v))
      
      text = "%d" % (self.player.score * self.anim(1000, 2000))
      w, h = bigFont.getStringSize(text)
      bigFont.render(text, (.5 - w / 2, .11 + v + (1.0 - self.anim(0, 1000) ** 3)), scale = 0.0025)
      
      if self.counter > 1000:
        scale = 0.0017
        text = (Data.STAR2 * self.stars + Data.STAR1 * (5 - self.stars))
        w, h = bigFont.getStringSize(Data.STAR1, scale = scale)
        x = .5 - w * len(text) / 2
        for i, ch in enumerate(text):
          bigFont.render(ch, (x + 100 * (1.0 - self.anim(1000 + i * 200, 1000 + (i + 1) * 200)) ** 2, .35 + v), scale = scale)
          x += w
      
      if self.counter > 2500:
        text = _("Accuracy: %d%%") % self.accuracy      
        w, h = font.getStringSize(text)
        font.render(text, (.5 - w / 2, .55 + v))
        text = _("Longest note streak: %d") % self.player.longestStreak
        w, h = font.getStringSize(text)
        font.render(text, (.5 - w / 2, .55 + h + v))
    finally:
      self.engine.view.resetProjection()
开发者ID:fretsonfire,项目名称:fof-python,代码行数:89,代码来源:GameResultsScene.py


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