def update(self, millis): ''' Gets called on every logic update and we use it to update the UI texts based on user input actions. The millis parameter is the milliseconds that elapsed since the last logic update. ''' # call the super class implementation first, this is optional BaseNodeScript.update(self, millis) # detects if sounds status has been toggled in order to update the UI label if self.lastStatus != self.sounds.isEnabled(): self.lastStatus = self.sounds.isEnabled() self.soundsStatusText.setText('Sounds status: %s' % self.lastStatus) # updates the volume label if needed if self.updateVolume: self.volumeText.setText('Volume: %.1f' % self.sounds.getVolume()) self.updateVolume = False # updates the rate label if needed if self.updateRate: self.rateText.setText('Rate: %.1f' % self.sounds.getPlayRate()) self.updateRate = False # updates the balance label if needed if self.updateBalance: self.balanceText.setText('Balance: %.1f' % self.sounds.getBalance()) self.updateBalance = False # updates the looping label if needed if self.updateLooping: self.loopText.setText('Looping: %d' % self.looping) self.updateLooping = False
def update(self, millis): BaseNodeScript.update(self, millis) track = self.music.getActiveTrack() # returns a tuple of the form (index, track_name, track_file) if self.lastActiveTrack != track: self.lastActiveTrack = track self._updateTrackLabel('[%d] %s (file: %s)' % track) pl = self.music.getPlaylist() self._updatePlaylistLabel('Current playlist: %s' % pl.name)
def update(self, millis): BaseNodeScript.update(self, millis) if self.isSolutionAchieved(): self.game.getView().getTalkBox().showText('game.success')