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 = mode
|
||||||
menu_mode_prev_fade_timer = menu_mode_prev_fade_timer_duration
|
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):
|
func touch_select_song(touchdict):
|
||||||
if (self.selected_genre == touchdict.genre_idx) and (self.selected_song_idx == touchdict.song_idx):
|
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]]
|
# var songslist = genres[genres.keys()[selected_genre]]
|
||||||
# selected_song_key = songslist[self.target_song_idx % len(songslist)]
|
# selected_song_key = songslist[self.target_song_idx % len(songslist)]
|
||||||
set_menu_mode(MenuMode.CHART_SELECT)
|
set_menu_mode(MenuMode.CHART_SELECT)
|
||||||
else:
|
else:
|
||||||
self.selected_genre = touchdict.genre_idx
|
self.selected_genre = touchdict.genre_idx
|
||||||
self.target_song_idx = touchdict.song_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()
|
load_preview()
|
||||||
|
|
||||||
func touch_select_chart(touchdict):
|
func touch_select_chart(touchdict):
|
||||||
if touchdict.chart_idx == selected_difficulty:
|
if touchdict.chart_idx == selected_difficulty:
|
||||||
if touchdict.enabled:
|
if touchdict.enabled:
|
||||||
SoundPlayer.play(SoundPlayer.Type.NON_POSITIONAL, self, snd_interact, 0.0)
|
play_sound(snd_interact)
|
||||||
set_menu_mode(MenuMode.GAMEPLAY)
|
set_menu_mode(MenuMode.GAMEPLAY)
|
||||||
else:
|
else:
|
||||||
SoundPlayer.play(SoundPlayer.Type.NON_POSITIONAL, self, snd_error, 0.0)
|
play_sound(snd_error)
|
||||||
elif touchdict.chart_idx < 0:
|
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)
|
set_menu_mode(MenuMode.SONG_SELECT)
|
||||||
else:
|
else:
|
||||||
self.selected_difficulty = touchdict.chart_idx
|
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):
|
func touch_gameplay(touchdict):
|
||||||
if touchdict.has('action'):
|
if touchdict.has('action'):
|
||||||
SoundPlayer.play(SoundPlayer.Type.NON_POSITIONAL, self, snd_interact, 0.0)
|
play_sound(snd_interact)
|
||||||
if touchdict.action == 'stop':
|
if touchdict.action == 'stop':
|
||||||
NoteHandler.stop()
|
NoteHandler.stop()
|
||||||
|
|
||||||
func touch_score_screen(touchdict):
|
func touch_score_screen(touchdict):
|
||||||
if touchdict.has('next_menu'):
|
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)
|
set_menu_mode(touchdict.next_menu)
|
||||||
ScoreText.score = ''
|
ScoreText.score = ''
|
||||||
ScoreText.score_sub = ''
|
ScoreText.score_sub = ''
|
||||||
# TODO: time this to coincide with the menu going fully offscreen
|
# TODO: time this to coincide with the menu going fully offscreen
|
||||||
ScoreText.update()
|
ScoreText.update()
|
||||||
elif touchdict.has('action'):
|
elif touchdict.has('action'):
|
||||||
SoundPlayer.play(SoundPlayer.Type.NON_POSITIONAL, self, snd_interact, 0.0)
|
play_sound(snd_interact)
|
||||||
if touchdict.action == 'save':
|
if touchdict.action == 'save':
|
||||||
save_score()
|
save_score()
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue