diff --git a/manager/archive_manager/archive_manager.gd b/manager/archive_manager/archive_manager.gd index 8d0ec0df..8076d04b 100644 --- a/manager/archive_manager/archive_manager.gd +++ b/manager/archive_manager/archive_manager.gd @@ -14,7 +14,7 @@ static var user_root_dir := "user://data/" # must end with "/" static var archive_dir := "user://data/archives/" static var archive_prefix := "save" -const CURRENT_VERSION = 1 +const CURRENT_VERSION = 2 var archives := {} var autosave_timer := Timer.new() diff --git a/manager/audio_manager/audio_manager.gd b/manager/audio_manager/audio_manager.gd index 0c812e1b..b89078fa 100644 --- a/manager/audio_manager/audio_manager.gd +++ b/manager/audio_manager/audio_manager.gd @@ -70,7 +70,7 @@ func stop_bgm_music(music_name: StringName, ease_duration := 3.0) -> void: audio_player.queue_free() else: var tween = create_tween() - tween.tween_property(audio_player, "volume_db", -80.0, ease_duration) + tween.tween_property(audio_player, "volume_linear", 0.0, ease_duration) tween.tween_callback(audio_player.queue_free) bgm_dict.erase(music_name) else: diff --git a/manager/config_manager/global_config.gd b/manager/config_manager/global_config.gd index 10469703..8c48d1b4 100644 --- a/manager/config_manager/global_config.gd +++ b/manager/config_manager/global_config.gd @@ -73,7 +73,7 @@ signal auto_save_seconds_changed @export var window_top := true # sound @export var db_master := -3.0 # default -@export var db_dialog := -7.0 # default +@export var db_dialog := -13.0 # default @export var db_game_sfx := 3.0 # default # language # -1 null; 0 zh_CN; 1 zh_SH; 2 en diff --git a/scene/entity/audio/bgm_control.gd b/scene/entity/audio/bgm_control.gd index 975fadb8..da1e81ce 100644 --- a/scene/entity/audio/bgm_control.gd +++ b/scene/entity/audio/bgm_control.gd @@ -4,12 +4,21 @@ class_name BgmControl extends Node @export var bgm_title = "" @export var bgm_stream: AudioStream @export var db := 0.0 +@export var stop_ease_duration := 3.0 func _ready() -> void: + if not bgm_title: + printerr("[BgmControl] no title fond!") if mode == "stop": - AudioManager.stop_bgm_music(bgm_title) + AudioManager.stop_bgm_music(bgm_title, stop_ease_duration) elif mode == "start": if not bgm_stream: printerr("bgm_stream is null, please check the BGM settings.") return - AudioManager.loop_bgm_music(bgm_title, bgm_stream, db) \ No newline at end of file + AudioManager.loop_bgm_music(bgm_title, bgm_stream, db) + +func stop(): + if bgm_title: + AudioManager.stop_bgm_music(bgm_title, stop_ease_duration) + else: + printerr("[BgmControl] stop err, no title fond!") diff --git a/scene/entity/audio/sfx.gd b/scene/entity/audio/sfx.gd index 5f54d48d..f9960bf9 100644 --- a/scene/entity/audio/sfx.gd +++ b/scene/entity/audio/sfx.gd @@ -46,7 +46,7 @@ func easing_kill(duration: float = 2.0) -> Tween: # stop with easing var tween = create_tween() if playing: - tween.tween_property(self, "volume_db", -80.0, duration) + tween.tween_property(self, "volume_linear", 0.0, duration) tween.tween_callback(stop) # set volume_db back to default tween.tween_callback(func(): volume_db = default_db) diff --git a/scene/entity/audio/sfx2d.gd b/scene/entity/audio/sfx2d.gd index 731f23d8..ced73645 100644 --- a/scene/entity/audio/sfx2d.gd +++ b/scene/entity/audio/sfx2d.gd @@ -58,5 +58,5 @@ func easing_kill(duration: float = 2.0) -> void: # stop with easing if playing: var tween = create_tween() - tween.tween_property(self, "volume_db", -80.0, duration) + tween.tween_property(self, "volume_linear", 0.0, duration) tween.tween_callback(stop) diff --git a/scene/index_page.gd b/scene/index_page.gd index 86a66d96..1c92e77a 100644 --- a/scene/index_page.gd +++ b/scene/index_page.gd @@ -59,6 +59,7 @@ func _on_resume_pressed(): func _enter_main_scene(): + $BgmControl.stop() SceneManager.enter_main_scene() diff --git a/scene/index_page.tscn b/scene/index_page.tscn index 0caa9359..7503337c 100644 --- a/scene/index_page.tscn +++ b/scene/index_page.tscn @@ -1,9 +1,10 @@ -[gd_scene load_steps=12 format=3 uid="uid://c4ycvdsabi7lw"] +[gd_scene load_steps=13 format=3 uid="uid://c4ycvdsabi7lw"] [ext_resource type="Script" uid="uid://b4rw4hk7ns4m8" path="res://scene/index_page.gd" id="1_c7y7r"] [ext_resource type="Texture2D" uid="uid://bcc0bk34l5gbc" path="res://asset/art/ui/index_menu/菜单背景1.png" id="1_jxn4k"] [ext_resource type="AudioStream" uid="uid://cvttds81trcoc" path="res://asset/audio/sfx/UI/click.wav" id="2_te6ya"] [ext_resource type="Script" uid="uid://rq6w1vuhuq1m" path="res://scene/entity/audio/sfx.gd" id="3_5oc6i"] +[ext_resource type="Script" uid="uid://bbg4vopj4apl6" path="res://scene/entity/audio/bgm_control.gd" id="4_5oc6i"] [ext_resource type="AudioStream" uid="uid://brs150xgqnyd5" path="res://asset/audio/专用/衔蝶_主菜单music人声版.mp3" id="4_te6ya"] [sub_resource type="Animation" id="Animation_8kiap"] @@ -67,20 +68,18 @@ mouse_filter = 2 [node name="SfxClick" type="AudioStreamPlayer" parent="."] unique_name_in_owner = true +process_mode = 1 stream = ExtResource("2_te6ya") volume_db = -8.285 bus = &"game_sfx" script = ExtResource("3_5oc6i") -[node name="SfxBGM" type="AudioStreamPlayer" parent="."] -stream = ExtResource("4_te6ya") -bus = &"game_sfx" -script = ExtResource("3_5oc6i") -mode = "场景背景音" -"自动开始" = true -"循环播放" = true -"感应玩家操作" = false -metadata/_custom_type_script = "uid://rq6w1vuhuq1m" +[node name="BgmControl" type="Node" parent="."] +script = ExtResource("4_5oc6i") +bgm_title = "index菜单主题曲" +bgm_stream = ExtResource("4_te6ya") +stop_ease_duration = 1.5 +metadata/_custom_type_script = "uid://bbg4vopj4apl6" [node name="TextureRect" type="TextureRect" parent="."] layout_mode = 1