diff options
author | BigBrotherNii <nicochr1004@gmail.com> | 2024-07-24 17:21:24 +0200 |
---|---|---|
committer | metamuffin <metamuffin@disroot.org> | 2024-07-25 11:25:41 +0200 |
commit | a2c5fa06d3c36ddd71d96beda79605145e061e5e (patch) | |
tree | 9471a0a583ce1e5f4cb4a7298149b5540191c60a | |
parent | 7e4ad7a70a2636c117879021f61b3a2025a16743 (diff) | |
download | hurrycurry-a2c5fa06d3c36ddd71d96beda79605145e061e5e.tar hurrycurry-a2c5fa06d3c36ddd71d96beda79605145e061e5e.tar.bz2 hurrycurry-a2c5fa06d3c36ddd71d96beda79605145e061e5e.tar.zst |
added lobby music
-rw-r--r-- | client/audio/sound.gd | 4 | ||||
-rw-r--r-- | client/audio/sound.tscn | 4 | ||||
-rw-r--r-- | client/menu/lobby.gd | 9 | ||||
-rw-r--r-- | client/menu/lobby.tscn | 1 |
4 files changed, 16 insertions, 2 deletions
diff --git a/client/audio/sound.gd b/client/audio/sound.gd index 13fde6a2..af23f0cd 100644 --- a/client/audio/sound.gd +++ b/client/audio/sound.gd @@ -29,7 +29,9 @@ func play_music(music : String): # If music == "stop", this stops all music for stream in music_node.get_children(): stream.stop() - if music != "stop": + if music_node.get_node(music) == null: + return + else: music_node.get_node(music).play() func set_volume(value:float): diff --git a/client/audio/sound.tscn b/client/audio/sound.tscn index a8524e71..aac5e159 100644 --- a/client/audio/sound.tscn +++ b/client/audio/sound.tscn @@ -18,3 +18,7 @@ stream = ExtResource("3_qft2s") [node name="Music" type="Node" parent="."] [node name="MainMenu" type="AudioStreamPlayer" parent="Music"] +volume_db = 1.0 + +[node name="Lobby" type="AudioStreamPlayer" parent="Music"] +volume_db = -2.5 diff --git a/client/menu/lobby.gd b/client/menu/lobby.gd index 5b4616cf..9991fbbf 100644 --- a/client/menu/lobby.gd +++ b/client/menu/lobby.gd @@ -43,7 +43,7 @@ func _ready(): game.data_updated.connect(initialize) game.joined.connect(_on_game_joined) game.left.connect(_on_game_left) - Sound.play_music("stop") # TODO: Input Lobby music + check_for_music() func initialize(): map_count = game.maps.size() @@ -97,6 +97,7 @@ func _on_right_pressed(): func _on_controller_button_pressed(): if selected_map_name != null: game.mp.send_chat("/start %s" % selected_map_name) + Sound.play_music("stop") # TODO: Game music enter func _on_join_spectate_pressed(): if game.is_joined: @@ -105,3 +106,9 @@ func _on_join_spectate_pressed(): elif not game.join_sent: game.join() join_spectate.text = tr("Spectate") + +func check_for_music(): + if visible: + Sound.play_music("Lobby") + else: + Sound.play_music("stop") # TODO: Game music enter diff --git a/client/menu/lobby.tscn b/client/menu/lobby.tscn index e2da5094..d13498d6 100644 --- a/client/menu/lobby.tscn +++ b/client/menu/lobby.tscn @@ -147,6 +147,7 @@ expand_icon = true controller_texture = ExtResource("11_5uugf") press_action = "join_spectate" +[connection signal="visibility_changed" from="." to="." method="check_for_music"] [connection signal="pressed" from="VBoxContainer/Bottom/MarginContainer/VBoxContainer/HBoxContainer/VBoxContainer/Left" to="." method="_on_left_pressed"] [connection signal="pressed" from="VBoxContainer/Bottom/MarginContainer/VBoxContainer/HBoxContainer/VBoxContainer2/Right" to="." method="_on_right_pressed"] [connection signal="pressed" from="VBoxContainer/Bottom/MarginContainer/VBoxContainer/CenterContainer/Start" to="." method="_on_controller_button_pressed"] |