slight refactor on menu sound playback
This commit is contained in:
parent
cdae65ec87
commit
c1501e2f6e
|
@ -496,48 +496,51 @@ func set_menu_mode(mode):
|
|||
menu_mode = mode
|
||||
menu_mode_prev_fade_timer = menu_mode_prev_fade_timer_duration
|
||||
|
||||
func play_sound(sound: AudioStream, volume_db: float = 0.0, pitch_scale: float = 1.0):
|
||||
SoundPlayer.play(SoundPlayer.Type.NON_POSITIONAL, self, sound, volume_db, pitch_scale)
|
||||
|
||||
func touch_select_song(touchdict):
|
||||
if (self.selected_genre == touchdict.genre_idx) and (self.selected_song_idx == touchdict.song_idx):
|
||||
SoundPlayer.play(SoundPlayer.Type.NON_POSITIONAL, self, snd_interact, 0.0)
|
||||
play_sound(snd_interact)
|
||||
# var songslist = genres[genres.keys()[selected_genre]]
|
||||
# selected_song_key = songslist[self.target_song_idx % len(songslist)]
|
||||
set_menu_mode(MenuMode.CHART_SELECT)
|
||||
else:
|
||||
self.selected_genre = touchdict.genre_idx
|
||||
self.target_song_idx = touchdict.song_idx
|
||||
SoundPlayer.play(SoundPlayer.Type.NON_POSITIONAL, self, snd_interact, -4.5)
|
||||
play_sound(snd_interact, -4.5)
|
||||
load_preview()
|
||||
|
||||
func touch_select_chart(touchdict):
|
||||
if touchdict.chart_idx == selected_difficulty:
|
||||
if touchdict.enabled:
|
||||
SoundPlayer.play(SoundPlayer.Type.NON_POSITIONAL, self, snd_interact, 0.0)
|
||||
play_sound(snd_interact)
|
||||
set_menu_mode(MenuMode.GAMEPLAY)
|
||||
else:
|
||||
SoundPlayer.play(SoundPlayer.Type.NON_POSITIONAL, self, snd_error, 0.0)
|
||||
play_sound(snd_error)
|
||||
elif touchdict.chart_idx < 0:
|
||||
SoundPlayer.play(SoundPlayer.Type.NON_POSITIONAL, self, snd_interact, -3.0, 0.7)
|
||||
play_sound(snd_interact, -3.0, 0.7)
|
||||
set_menu_mode(MenuMode.SONG_SELECT)
|
||||
else:
|
||||
self.selected_difficulty = touchdict.chart_idx
|
||||
SoundPlayer.play(SoundPlayer.Type.NON_POSITIONAL, self, snd_interact, -4.5)
|
||||
play_sound(snd_interact, -4.5)
|
||||
|
||||
func touch_gameplay(touchdict):
|
||||
if touchdict.has('action'):
|
||||
SoundPlayer.play(SoundPlayer.Type.NON_POSITIONAL, self, snd_interact, 0.0)
|
||||
play_sound(snd_interact)
|
||||
if touchdict.action == 'stop':
|
||||
NoteHandler.stop()
|
||||
|
||||
func touch_score_screen(touchdict):
|
||||
if touchdict.has('next_menu'):
|
||||
SoundPlayer.play(SoundPlayer.Type.NON_POSITIONAL, self, snd_interact, 0.0)
|
||||
play_sound(snd_interact)
|
||||
set_menu_mode(touchdict.next_menu)
|
||||
ScoreText.score = ''
|
||||
ScoreText.score_sub = ''
|
||||
# TODO: time this to coincide with the menu going fully offscreen
|
||||
ScoreText.update()
|
||||
elif touchdict.has('action'):
|
||||
SoundPlayer.play(SoundPlayer.Type.NON_POSITIONAL, self, snd_interact, 0.0)
|
||||
play_sound(snd_interact)
|
||||
if touchdict.action == 'save':
|
||||
save_score()
|
||||
|
||||
|
|
Loading…
Reference in New Issue