demo0.0.2 hotfix

This commit is contained in:
cakipaul 2025-06-27 11:43:23 +08:00
parent 98e4dfc668
commit f59bc69c8e
8 changed files with 26 additions and 17 deletions

View File

@ -14,7 +14,7 @@ static var user_root_dir := "user://data/" # must end with "/"
static var archive_dir := "user://data/archives/" static var archive_dir := "user://data/archives/"
static var archive_prefix := "save" static var archive_prefix := "save"
const CURRENT_VERSION = 1 const CURRENT_VERSION = 2
var archives := {} var archives := {}
var autosave_timer := Timer.new() var autosave_timer := Timer.new()

View File

@ -70,7 +70,7 @@ func stop_bgm_music(music_name: StringName, ease_duration := 3.0) -> void:
audio_player.queue_free() audio_player.queue_free()
else: else:
var tween = create_tween() 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) tween.tween_callback(audio_player.queue_free)
bgm_dict.erase(music_name) bgm_dict.erase(music_name)
else: else:

View File

@ -73,7 +73,7 @@ signal auto_save_seconds_changed
@export var window_top := true @export var window_top := true
# sound # sound
@export var db_master := -3.0 # default @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 @export var db_game_sfx := 3.0 # default
# language # language
# -1 null; 0 zh_CN; 1 zh_SH; 2 en # -1 null; 0 zh_CN; 1 zh_SH; 2 en

View File

@ -4,12 +4,21 @@ class_name BgmControl extends Node
@export var bgm_title = "" @export var bgm_title = ""
@export var bgm_stream: AudioStream @export var bgm_stream: AudioStream
@export var db := 0.0 @export var db := 0.0
@export var stop_ease_duration := 3.0
func _ready() -> void: func _ready() -> void:
if not bgm_title:
printerr("[BgmControl] no title fond!")
if mode == "stop": if mode == "stop":
AudioManager.stop_bgm_music(bgm_title) AudioManager.stop_bgm_music(bgm_title, stop_ease_duration)
elif mode == "start": elif mode == "start":
if not bgm_stream: if not bgm_stream:
printerr("bgm_stream is null, please check the BGM settings.") printerr("bgm_stream is null, please check the BGM settings.")
return return
AudioManager.loop_bgm_music(bgm_title, bgm_stream, db) 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!")

View File

@ -46,7 +46,7 @@ func easing_kill(duration: float = 2.0) -> Tween:
# stop with easing # stop with easing
var tween = create_tween() var tween = create_tween()
if playing: if playing:
tween.tween_property(self, "volume_db", -80.0, duration) tween.tween_property(self, "volume_linear", 0.0, duration)
tween.tween_callback(stop) tween.tween_callback(stop)
# set volume_db back to default # set volume_db back to default
tween.tween_callback(func(): volume_db = default_db) tween.tween_callback(func(): volume_db = default_db)

View File

@ -58,5 +58,5 @@ func easing_kill(duration: float = 2.0) -> void:
# stop with easing # stop with easing
if playing: if playing:
var tween = create_tween() 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) tween.tween_callback(stop)

View File

@ -59,6 +59,7 @@ func _on_resume_pressed():
func _enter_main_scene(): func _enter_main_scene():
$BgmControl.stop()
SceneManager.enter_main_scene() SceneManager.enter_main_scene()

View File

@ -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="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="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="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://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"] [ext_resource type="AudioStream" uid="uid://brs150xgqnyd5" path="res://asset/audio/专用/衔蝶_主菜单music人声版.mp3" id="4_te6ya"]
[sub_resource type="Animation" id="Animation_8kiap"] [sub_resource type="Animation" id="Animation_8kiap"]
@ -67,20 +68,18 @@ mouse_filter = 2
[node name="SfxClick" type="AudioStreamPlayer" parent="."] [node name="SfxClick" type="AudioStreamPlayer" parent="."]
unique_name_in_owner = true unique_name_in_owner = true
process_mode = 1
stream = ExtResource("2_te6ya") stream = ExtResource("2_te6ya")
volume_db = -8.285 volume_db = -8.285
bus = &"game_sfx" bus = &"game_sfx"
script = ExtResource("3_5oc6i") script = ExtResource("3_5oc6i")
[node name="SfxBGM" type="AudioStreamPlayer" parent="."] [node name="BgmControl" type="Node" parent="."]
stream = ExtResource("4_te6ya") script = ExtResource("4_5oc6i")
bus = &"game_sfx" bgm_title = "index菜单主题曲"
script = ExtResource("3_5oc6i") bgm_stream = ExtResource("4_te6ya")
mode = "场景背景音" stop_ease_duration = 1.5
"自动开始" = true metadata/_custom_type_script = "uid://bbg4vopj4apl6"
"循环播放" = true
"感应玩家操作" = false
metadata/_custom_type_script = "uid://rq6w1vuhuq1m"
[node name="TextureRect" type="TextureRect" parent="."] [node name="TextureRect" type="TextureRect" parent="."]
layout_mode = 1 layout_mode = 1