diff --git a/godot/scenes/misc/music_manager_global.tscn b/godot/scenes/misc/music_manager_global.tscn index 1ba5068..fe3b90c 100644 --- a/godot/scenes/misc/music_manager_global.tscn +++ b/godot/scenes/misc/music_manager_global.tscn @@ -9,4 +9,3 @@ main_menu_songs = Array[AudioStream]([ExtResource("1_xy4vl"), ExtResource("2_t25 [node name="audio_stream_player" type="AudioStreamPlayer" parent="." unique_id=1469531096] bus = &"Music" -playback_type = 1 diff --git a/rust/src/bgm.rs b/rust/src/bgm.rs index 678a63b..26d1992 100644 --- a/rust/src/bgm.rs +++ b/rust/src/bgm.rs @@ -27,12 +27,9 @@ pub struct MusicManager { base: Base, } -impl MusicManager { - pub fn singleton() -> Gd { - get_autoload_by_name::(MUSIC_MANAGER_GLOBAL) - } - - pub fn ready(&mut self) { +#[godot_api] +impl INode3D for MusicManager { + fn ready(&mut self) { if let Some(player) = self.player.clone() { player.signals().finished().connect_other(self, |s| { if let Some(playing) = s.currently_playing { @@ -41,9 +38,15 @@ impl MusicManager { }); } } +} + +impl MusicManager { + pub fn singleton() -> Gd { + get_autoload_by_name::(MUSIC_MANAGER_GLOBAL) + } pub fn play(&mut self, music: Option, force: bool) { - if self.currently_playing == music { + if self.currently_playing == music && !force { return; } self.currently_playing = music;