Make music loop
This commit is contained in:
parent
fac936b97a
commit
927a904c72
@ -32,7 +32,17 @@ impl MusicManager {
|
||||
get_autoload_by_name::<MusicManager>(MUSIC_MANAGER_GLOBAL)
|
||||
}
|
||||
|
||||
pub fn play(&mut self, music: Option<Music>) {
|
||||
pub 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 {
|
||||
s.play(Some(playing), true);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
pub fn play(&mut self, music: Option<Music>, force: bool) {
|
||||
if self.currently_playing == music {
|
||||
return;
|
||||
}
|
||||
|
||||
@ -460,7 +460,7 @@ impl Game {
|
||||
}
|
||||
MusicManager::singleton()
|
||||
.bind_mut()
|
||||
.play(Some(Music::Map(self.selected_map_idx)));
|
||||
.play(Some(Music::Map(self.selected_map_idx)), false);
|
||||
|
||||
self.run_deferred(|_| {
|
||||
if let Some(peer) = &mut NetworkManager::singleton().bind_mut().peer {
|
||||
|
||||
@ -192,7 +192,7 @@ impl IPanel for LobbyPanel {
|
||||
|
||||
MusicManager::singleton()
|
||||
.bind_mut()
|
||||
.play(Some(Music::MainMenu));
|
||||
.play(Some(Music::MainMenu), false);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -102,7 +102,7 @@ impl INode3D for MainMenu {
|
||||
|
||||
MusicManager::singleton()
|
||||
.bind_mut()
|
||||
.play(Some(Music::MainMenu));
|
||||
.play(Some(Music::MainMenu), false);
|
||||
}
|
||||
|
||||
fn process(&mut self, _delta: f64) {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user