Ferme les fenêtres (des paramètres) sans mettre pause
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
extends Resource
|
||||
class_name SettingsData
|
||||
|
||||
const MASTER_BUS_ID = 0
|
||||
const MUSIC_BUS_ID = 1
|
||||
const SFX_BUS_ID = 2
|
||||
const AMBIANCE_BUS_ID = 3
|
||||
|
||||
@@ -92,7 +92,7 @@ func _on_settings_language_changed(s : SettingsData):
|
||||
update_language_settings(s)
|
||||
|
||||
func _on_settings_sound_changed(s : SettingsData):
|
||||
AudioServer.set_bus_volume_db(0, linear_to_db(s.master_volume))
|
||||
AudioServer.set_bus_volume_db(SettingsData.MASTER_BUS_ID, linear_to_db(s.master_volume))
|
||||
AudioServer.set_bus_volume_db(SettingsData.MUSIC_BUS_ID, linear_to_db(s.music_volume))
|
||||
AudioServer.set_bus_volume_db(SettingsData.SFX_BUS_ID, linear_to_db(s.sfx_volume))
|
||||
AudioServer.set_bus_volume_db(SettingsData.AMBIANCE_BUS_ID, linear_to_db(s.ambiance_volume))
|
||||
|
||||
@@ -11,6 +11,10 @@ signal closed
|
||||
func _ready():
|
||||
update_title(title)
|
||||
|
||||
func _input(_event: InputEvent) -> void:
|
||||
if is_visible_in_tree() and Input.is_action_just_pressed("pause"):
|
||||
close_window()
|
||||
|
||||
func update_title(text : String):
|
||||
title = text
|
||||
if (is_node_ready()):
|
||||
|
||||
@@ -32,7 +32,12 @@ func set_pause(p):
|
||||
GameInfo.save_settings()
|
||||
|
||||
func _input(_event):
|
||||
if Input.is_action_just_pressed("pause"):
|
||||
if (SceneManager.actual_scene
|
||||
and SceneManager.actual_scene.get_scene_id() != "TITLE"
|
||||
and Input.is_action_just_pressed("pause")
|
||||
and not %Settings.is_visible_in_tree()
|
||||
and not %Controls.is_visible_in_tree()
|
||||
):
|
||||
pause = not pause
|
||||
|
||||
func _on_timeline_ended():
|
||||
|
||||
@@ -210,6 +210,7 @@ NO_ENERGY_LEFT," (no energy left)", " (pas d'énergie restante)"
|
||||
SETTINGS,Settings,Paramètres
|
||||
LANGUAGE,Language,Langage
|
||||
SOUND,Sound,Son
|
||||
MASTER_VOLUME,Master volume,Volume principal
|
||||
MUSIC_VOLUME,Music volume,Volume de la musique
|
||||
ENVIRONMENT_VOLUME,Environment Volume,Volume de l'environnement
|
||||
SFX_VOLUME,Sfx Volume,Volume des bruitages
|
||||
|
||||
|
Reference in New Issue
Block a user