diff --git a/asset/art/ui/index/佩戴耳机提示_下方无字.png b/asset/art/ui/index/佩戴耳机提示_下方无字.png new file mode 100644 index 00000000..bad41cab Binary files /dev/null and b/asset/art/ui/index/佩戴耳机提示_下方无字.png differ diff --git a/asset/art/ui/index/佩戴耳机提示_下方无字.png.import b/asset/art/ui/index/佩戴耳机提示_下方无字.png.import new file mode 100644 index 00000000..aa8b259e --- /dev/null +++ b/asset/art/ui/index/佩戴耳机提示_下方无字.png.import @@ -0,0 +1,34 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://b1xp65ac7f1iq" +path="res://.godot/imported/佩戴耳机提示_下方无字.png-0dab5dbb3bc15567f09ddc523d4520b4.ctex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://asset/art/ui/index/佩戴耳机提示_下方无字.png" +dest_files=["res://.godot/imported/佩戴耳机提示_下方无字.png-0dab5dbb3bc15567f09ddc523d4520b4.ctex"] + +[params] + +compress/mode=0 +compress/high_quality=false +compress/lossy_quality=0.7 +compress/hdr_compression=1 +compress/normal_map=0 +compress/channel_pack=0 +mipmaps/generate=false +mipmaps/limit=-1 +roughness/mode=0 +roughness/src_normal="" +process/fix_alpha_border=true +process/premult_alpha=false +process/normal_map_invert_y=false +process/hdr_as_srgb=false +process/hdr_clamp_exposure=false +process/size_limit=0 +detect_3d/compress_to=1 diff --git a/asset/dialogue/item_description.csv b/asset/dialogue/item_description.csv index 791c3243..ae33517c 100644 --- a/asset/dialogue/item_description.csv +++ b/asset/dialogue/item_description.csv @@ -11,7 +11,7 @@ ux_panel_退出游戏,退出游戏,,,,,Exit Game setting_总音量,总音量,,,,,Master Volume setting_音效音量,音效音量,,,,,Sound Effects setting_对话音量,对话音量,,,,,Dialogue Volume -setting_语言,语言(Lang),,,,,Language (Lang) +setting_语言,语言(Lang),,,,,Language (语言) setting_字幕,字幕,,,,,Subtitles setting_气泡文字自动结束,气泡文字自动结束,,,,,Auto-dismiss Text Bubbles setting_气泡等待时长,气泡停留,,,,,Text Display Duration @@ -21,6 +21,7 @@ setting_自动保存,自动保存,,,,,Auto Save ui_秒,秒,,,,,seconds setting_主播模式,主播模式,,,,,Streamer Mode setting_返回,返回,,,,,Back +setting_确认,确认,,,,,Confirm bag_tab_笔记,线索,,,,,Clues bag_tab_物品,物件,,,,,Items bag_tab_记忆,记忆,,,,,Memories diff --git a/asset/dialogue/item_description.dialogue b/asset/dialogue/item_description.dialogue index 138e3248..630ac873 100644 --- a/asset/dialogue/item_description.dialogue +++ b/asset/dialogue/item_description.dialogue @@ -10,6 +10,7 @@ 返回主菜单 [ID:ux_panel_返回主菜单] 退出游戏 [ID:ux_panel_退出游戏] + 总音量[ID:setting_总音量] 音效音量[ID:setting_音效音量] 对话音量[ID:setting_对话音量] @@ -23,6 +24,7 @@ 秒 [ID:ui_秒] 主播模式[ID:setting_主播模式] 返回[ID:setting_返回] +确认[ID:setting_确认] 线索[ID:bag_tab_笔记] diff --git a/export_presets.cfg b/export_presets.cfg index af0a6e78..dcb8bbe3 100644 --- a/export_presets.cfg +++ b/export_presets.cfg @@ -9,7 +9,7 @@ custom_features="" export_filter="all_resources" include_filter="" exclude_filter="" -export_path="../demo0.5/xiandie.exe" +export_path="../demo0.5.2/xiandie.exe" patches=PackedStringArray() encryption_include_filters="" encryption_exclude_filters="" @@ -37,8 +37,8 @@ application/modify_resources=true application/icon="uid://cxgwspjv16j7m" application/console_wrapper_icon="uid://cxgwspjv16j7m" application/icon_interpolation=4 -application/file_version="0.5.0.0" -application/product_version="0.5.0.0" +application/file_version="0.5.2.0" +application/product_version="0.5.2.0" application/company_name="包包丁" application/product_name="衔蝶" application/file_description="衔蝶" diff --git a/manager/archive_manager/archive_manager.gd b/manager/archive_manager/archive_manager.gd index 1b3710a3..22b2262e 100644 --- a/manager/archive_manager/archive_manager.gd +++ b/manager/archive_manager/archive_manager.gd @@ -21,7 +21,8 @@ static var archive_prefix := "save" const CURRENT_VERSION = 6 -var archives := {} +var archives_dict: Dictionary[int, AssembledArchive] = {} +var archives_notes_dict: Dictionary[int, String] = {} var autosave_timer := Timer.new() # 供运行时缓存跨场景数据 @@ -41,7 +42,7 @@ func _ready() -> void: load_config() # 在 debug or editor 模式下,直接保证有 archive if GlobalConfig.DEBUG or Engine.is_editor_hint(): - if archives.size() == 0: + if archives_dict.size() == 0: create_and_use_new_archive(0) else: # debug 模式下默认使用 0 号存档 @@ -66,7 +67,7 @@ func _on_archive_id_changed(): # print("_on_archive_id_changed same id=", selected_id) # return print("_on_archive_id_changed id=", selected_id) - if not archives.has(selected_id): + if not archives_dict.has(selected_id): print("新建存档 ", selected_id) create_and_use_new_archive(selected_id) # 已创建新存档 [ID:ui_new_archive] @@ -125,7 +126,10 @@ func _check_dirs_and_archives() -> bool: # get archive number for file in files: if file.begins_with(archive_prefix) and file.ends_with(GlobalConfig.RES_FILE_FORMAT): - var id_str = file.get_basename().substr(archive_prefix.length()).strip_escapes() + # format: save012_xxxxx; save000 + var id_and_note = file.get_basename().substr(archive_prefix.length()).strip_escapes().split("_", true, 1) + var id_str = id_and_note[0] + var note_str = id_and_note[1] if id_and_note.size() >= 2 else (archive_prefix + id_str) # 非三位数的 id 会被忽略 if id_str.length() != 3: continue @@ -133,13 +137,14 @@ func _check_dirs_and_archives() -> bool: # 读取范围是 0-99 if id < 0 or id > 99: continue + archives_notes_dict[id] = note_str var path = archive_dir + file - if not archives.has(id): + if not archives_dict.has(id): var res = ResourceLoader.load( path, "AssembledArchive", ResourceLoader.CACHE_MODE_REPLACE_DEEP ) if is_instance_valid(res) and res.version >= CURRENT_VERSION: - archives[id] = res + archives_dict[id] = res else: printerr("SKIP INVALID ARCHIVE! file=", file) return true @@ -179,7 +184,7 @@ func _create_and_save_new_archive_resoure(id, take_over_path = false) -> void: archive.archive_id = id archive.created_time = Time.get_datetime_string_from_system(false, true) ResourceSaver.save(archive, archive_path) - archives[id] = archive + archives_dict[id] = archive # 超过 999 个存档会出问题;不过这个游戏不会有这么多存档 @@ -194,6 +199,10 @@ func _get_archive_path(id: int) -> String: return archive_dir + archive_prefix + id_str + GlobalConfig.RES_FILE_FORMAT +func allow_resume(id := 1) -> bool: + return archives_dict.has(id) + + func save_all() -> void: # save config var config = GlobalConfigManager.config @@ -244,10 +253,10 @@ func load_archive() -> void: # if archive and selected_id == archive.archive_id: # return print("load_archive ", selected_id) - if not archives.has(selected_id): + if not archives_dict.has(selected_id): _handle_load_error(str(selected_id) + " 号存档", "查找") return - archive = archives[selected_id] + archive = archives_dict[selected_id] # emit signal archive_loaded.emit() check_autosave_options() diff --git a/manager/config_manager/global_config.gd b/manager/config_manager/global_config.gd index 8fe5d68e..64275be4 100644 --- a/manager/config_manager/global_config.gd +++ b/manager/config_manager/global_config.gd @@ -63,6 +63,7 @@ signal auto_save_seconds_changed @export var debug_mode := false # 开启 debug 模式 @export var skip_trailer := false # 跳过 trailer @export var version: int #存档版本 +@export var game_launched_times := 0 # 启动游戏次数 @export var game_total_seconds := 0 # 游戏总时长 @export var game_rounds := 1 # 当前周目数 @export var current_selected_archive_id := -1: # 当前选定存档, -1 为未选择 @@ -86,9 +87,8 @@ signal auto_save_seconds_changed @export var db_dialog := linear_to_db(0.7) + Settings.dialog_db_offset @export var db_game_sfx := linear_to_db(0.7) + Settings.sfx_db_offset # language -# -1 null; 0 zh; 2 en +# -1 null; 0 zh; 1 en @export var language := 0 -# zh: 0 _SH, 1 _CN; en: [null]; @export var caption := 0 # 最大范围为 10 秒,精度 0.1 @export var os_wait_time := 3.0 diff --git a/manager/config_manager/global_config_manager.gd b/manager/config_manager/global_config_manager.gd index a5af4c3a..7fd8879b 100644 --- a/manager/config_manager/global_config_manager.gd +++ b/manager/config_manager/global_config_manager.gd @@ -44,26 +44,42 @@ func _set_config(val: GlobalConfig) -> void: update_locale(config.language, config.caption) -func update_locale(lang_id: int, caption_id: int): - # -1 null; 0 zh; 2 en - # var lang_id = language_options.selected - # zh: 0 _SH, 1 _CN; en: [null]; - # var caption_id = caption_options.selected - var lang = "" - match lang_id: - 0: - if caption_id == 0: - lang = "zh_SH" - elif caption_id == 1: - lang = "zh_CN" - 1: - lang = "en" +# -1 null; 0 zh; 1 en +var language_options = ["简体中文", "English"] +var caption_options_dict = {0: ["上海话", "普通话"], 1: [""]} +var caption_loacles_dict = {0: ["zh_SH", "zh_CN"], 1: ["en"]} + + +# return example: "中文_简体中文" "English_" +func update_locale(lang_id: int, caption_id: int) -> void: + lang_id = wrapi(lang_id, 0, language_options.size()) + var caption_loacles = caption_loacles_dict.get(lang_id) + caption_id = wrapi(caption_id, 0, caption_loacles.size()) + var lang = caption_loacles[caption_id] GlobalConfigManager.config.language = lang_id GlobalConfigManager.config.caption = caption_id print("set language to: ", lang) TranslationServer.set_locale(lang) +func get_locale_language_name() -> String: + GlobalConfigManager.config.language = wrapi( + GlobalConfigManager.config.language, 0, language_options.size() + ) + return language_options[GlobalConfigManager.config.language] + + +func get_locale_caption_name() -> String: + GlobalConfigManager.config.language = wrapi( + GlobalConfigManager.config.language, 0, language_options.size() + ) + var caption_options = caption_options_dict.get(GlobalConfigManager.config.language) + GlobalConfigManager.config.caption = wrapi( + GlobalConfigManager.config.caption, 0, caption_options.size() + ) + return caption_options[GlobalConfigManager.config.caption] + + var _on_timer_timeout_counter := 0 diff --git a/scene/ground/scene/c01/s06_孤儿院长廊围墙.tscn b/scene/ground/scene/c01/s06_孤儿院长廊围墙.tscn index 904cff5e..051e9ec1 100644 --- a/scene/ground/scene/c01/s06_孤儿院长廊围墙.tscn +++ b/scene/ground/scene/c01/s06_孤儿院长廊围墙.tscn @@ -362,8 +362,9 @@ shape = SubResource("RectangleShape2D_1ojoa") debug_color = Color(0.519778, 0.447036, 0.929413, 0.42) [node name="Interactable桌椅" parent="Ground/DeployLayer" index="12" instance=ExtResource("12_idjp0")] -position = Vector2(2881, 49) +position = Vector2(2907, 53) enable_snapper = false +collision_width_and_x = Vector2(80, 0) one_shot = false [node name="【站立小孩-3】" parent="Ground/DeployLayer" index="13" instance=ExtResource("8_ouldg")] diff --git a/scene/ground/scene/c02/s13_盒子猫二楼.gd b/scene/ground/scene/c02/s13_盒子猫二楼.gd index 74f3f711..0a656886 100644 --- a/scene/ground/scene/c02/s13_盒子猫二楼.gd +++ b/scene/ground/scene/c02/s13_盒子猫二楼.gd @@ -28,7 +28,7 @@ func knock_light_door(): boss = get_node_or_null("../DeployLayer/追猫猪头怪_右侧") if boss: boss.allow_restart_game = false - boss = get_node_or_null("追猫猪头怪_传送") + boss = get_node_or_null("../DeployLayer/追猫猪头怪_传送") if boss: boss.allow_restart_game = false do_knock_light_door.call_deferred() diff --git a/scene/index/index_page.gd b/scene/index/index_page.gd index 52762c52..d0e85a52 100644 --- a/scene/index/index_page.gd +++ b/scene/index/index_page.gd @@ -22,7 +22,7 @@ func _ready(): func _check_resume_btn(): - if not ArchiveManager.archives.has(1): + if not ArchiveManager.allow_resume(1): resume_btn.queue_free() @@ -37,7 +37,7 @@ func _on_resume_pressed(): sfx_click.global_play() # 继续一号存档 print("Resume Game") - if ArchiveManager.archives.has(1): + if ArchiveManager.allow_resume(1): # 设置 current_selected_archive_id 后,存档会自动加载 GlobalConfigManager.config.current_selected_archive_id = 1 else: diff --git a/scene/settings/settings.gd b/scene/settings/settings.gd index 69d5dfd1..25156379 100644 --- a/scene/settings/settings.gd +++ b/scene/settings/settings.gd @@ -8,9 +8,16 @@ const dialog_db_offset := -10.0 @onready var master_bus_slider = %HSliderMasterBus as HSlider @onready var sfx_bus_slider = %HSliderSfxBus as HSlider @onready var dialog_bus_slider = %HSliderDialogBus as HSlider -@onready var language_options = %OptionButtonLanguage as OptionButton -@onready var caption_box = %"字幕" as BoxContainer -@onready var caption_options = %OptionButtonCaption as OptionButton + +@onready var lang_label = %LangLabel as Label +@onready var lang_left_btn = %LangLeft as Button +@onready var lang_right_btn = %LangRight as Button + +@onready var caption_box = %CaptionBox as BoxContainer +@onready var caption_label = %CaptionLabel as Label +@onready var caption_left_btn = %CaptionLeft as Button +@onready var caption_right_btn = %CaptionRight as Button + @onready var os_auto_end = %OSAutoEnd as CheckBox @onready var os_wait_time_box = %OSWaitTimeBox as BoxContainer @onready var h_slider_os_wait_time = %HSliderOSWaitTime as HSlider @@ -61,14 +68,15 @@ func _ready(): master_bus_slider.value_changed.connect(_on_master_bus_slider_value_changed) sfx_bus_slider.value_changed.connect(_on_sfx_bus_slider_value_changed) dialog_bus_slider.value_changed.connect(_on_dialog_bus_slider_value_changed) - # language - language_options.selected = GlobalConfigManager.config.language - language_options.item_selected.connect(_on_language_or_caption_options_selected) - # caption - caption_options.selected = GlobalConfigManager.config.caption - caption_options.item_selected.connect(_on_language_or_caption_options_selected) - # setup language - _on_language_or_caption_options_selected() + # language & caption + lang_left_btn.pressed.connect(_on_lang_left_btn_pressed) + lang_right_btn.pressed.connect(_on_lang_right_btn_pressed) + caption_left_btn.pressed.connect(_on_caption_left_btn_pressed) + caption_right_btn.pressed.connect(_on_caption_right_btn_pressed) + # setup language & caption + lang_label.text = GlobalConfigManager.get_locale_language_name() + caption_label.text = GlobalConfigManager.get_locale_caption_name() + caption_box.visible = caption_label.text != "" # os auto finish os_auto_end.button_pressed = GlobalConfigManager.config.os_auto_end os_auto_end.toggled.connect(_on_os_auto_end_toggled) @@ -123,20 +131,36 @@ func _on_dialog_bus_slider_value_changed(value: float) -> void: AudioServer.set_bus_volume_db(AudioServer.get_bus_index("dialog"), db_value) -func _on_language_or_caption_options_selected(_id = null) -> void: - # -1 null; 0 zh; 2 en - var lang_id = language_options.selected - # zh: 0 _CN, _SH; en: [null]; - var caption_id = caption_options.selected - if lang_id != 0: - caption_box.hide() - language_options.focus_neighbor_bottom = os_auto_end.get_path() - os_auto_end.focus_neighbor_top = language_options.get_path() - else: - caption_box.show() - language_options.focus_neighbor_bottom = caption_options.get_path() - os_auto_end.focus_neighbor_top = caption_options.get_path() - GlobalConfigManager.update_locale(lang_id, caption_id) +func _on_lang_left_btn_pressed() -> void: + GlobalConfigManager.update_locale( + GlobalConfigManager.config.language - 1, GlobalConfigManager.config.caption + ) + lang_label.text = GlobalConfigManager.get_locale_language_name() + caption_label.text = GlobalConfigManager.get_locale_caption_name() + caption_box.visible = caption_label.text != "" + + +func _on_lang_right_btn_pressed() -> void: + GlobalConfigManager.update_locale( + GlobalConfigManager.config.language + 1, GlobalConfigManager.config.caption + ) + lang_label.text = GlobalConfigManager.get_locale_language_name() + caption_label.text = GlobalConfigManager.get_locale_caption_name() + caption_box.visible = caption_label.text != "" + + +func _on_caption_left_btn_pressed() -> void: + GlobalConfigManager.update_locale( + GlobalConfigManager.config.language, GlobalConfigManager.config.caption - 1 + ) + caption_label.text = GlobalConfigManager.get_locale_caption_name() + + +func _on_caption_right_btn_pressed() -> void: + GlobalConfigManager.update_locale( + GlobalConfigManager.config.language, GlobalConfigManager.config.caption + 1 + ) + caption_label.text = GlobalConfigManager.get_locale_caption_name() func _on_os_auto_end_toggled(is_pressed: bool) -> void: diff --git a/scene/settings/settings.tscn b/scene/settings/settings.tscn index 2ca44a38..6d27ed81 100644 --- a/scene/settings/settings.tscn +++ b/scene/settings/settings.tscn @@ -156,11 +156,31 @@ layout_mode = 2 theme_override_constants/separation = 31 theme_override_styles/separator = SubResource("StyleBoxEmpty_n2b1f") -[node name="OptionButtonLanguage" type="OptionButton" parent="MarginContainer/VBoxContainer/语言"] +[node name="LangLeft" type="Button" parent="MarginContainer/VBoxContainer/语言"] unique_name_in_owner = true layout_mode = 2 +text = "<" +flat = true + +[node name="LangLabel" type="Label" parent="MarginContainer/VBoxContainer/语言"] +unique_name_in_owner = true +custom_minimum_size = Vector2(50, 0) +layout_mode = 2 +text = "中文" +horizontal_alignment = 1 + +[node name="LangRight" type="Button" parent="MarginContainer/VBoxContainer/语言"] +unique_name_in_owner = true +layout_mode = 2 +text = ">" +flat = true + +[node name="OptionButtonLanguage" type="OptionButton" parent="MarginContainer/VBoxContainer/语言"] +unique_name_in_owner = true +visible = false +layout_mode = 2 focus_neighbor_top = NodePath("../../对话音量/HSliderDialogBus") -focus_neighbor_bottom = NodePath("../../字幕/OptionButtonCaption") +focus_neighbor_bottom = NodePath("../../CaptionBox/OptionButtonCaption") selected = 0 allow_reselect = true item_count = 2 @@ -169,23 +189,24 @@ popup/item_0/id = 0 popup/item_1/text = "English" popup/item_1/id = 2 -[node name="字幕" type="HBoxContainer" parent="MarginContainer/VBoxContainer"] +[node name="CaptionBox" type="HBoxContainer" parent="MarginContainer/VBoxContainer"] unique_name_in_owner = true layout_mode = 2 size_flags_horizontal = 4 -[node name="Label" type="Label" parent="MarginContainer/VBoxContainer/字幕"] +[node name="Label" type="Label" parent="MarginContainer/VBoxContainer/CaptionBox"] custom_minimum_size = Vector2(50, 0) layout_mode = 2 text = "setting_字幕" -[node name="VSeparator" type="VSeparator" parent="MarginContainer/VBoxContainer/字幕"] +[node name="VSeparator" type="VSeparator" parent="MarginContainer/VBoxContainer/CaptionBox"] layout_mode = 2 theme_override_constants/separation = 31 theme_override_styles/separator = SubResource("StyleBoxEmpty_n2b1f") -[node name="OptionButtonCaption" type="OptionButton" parent="MarginContainer/VBoxContainer/字幕"] +[node name="OptionButtonCaption" type="OptionButton" parent="MarginContainer/VBoxContainer/CaptionBox"] unique_name_in_owner = true +visible = false layout_mode = 2 focus_neighbor_top = NodePath("../../语言/OptionButtonLanguage") focus_neighbor_bottom = NodePath("../../OSAutoEnd") @@ -197,6 +218,25 @@ popup/item_0/id = 1 popup/item_1/text = "普通话" popup/item_1/id = 0 +[node name="CaptionLeft" type="Button" parent="MarginContainer/VBoxContainer/CaptionBox"] +unique_name_in_owner = true +layout_mode = 2 +text = "<" +flat = true + +[node name="CaptionLabel" type="Label" parent="MarginContainer/VBoxContainer/CaptionBox"] +unique_name_in_owner = true +custom_minimum_size = Vector2(50, 0) +layout_mode = 2 +text = "普通话" +horizontal_alignment = 1 + +[node name="CaptionRight" type="Button" parent="MarginContainer/VBoxContainer/CaptionBox"] +unique_name_in_owner = true +layout_mode = 2 +text = ">" +flat = true + [node name="HSeparator2" type="HSeparator" parent="MarginContainer/VBoxContainer"] visible = false layout_mode = 2 @@ -205,7 +245,7 @@ layout_mode = 2 unique_name_in_owner = true layout_mode = 2 size_flags_horizontal = 4 -focus_neighbor_top = NodePath("../字幕/OptionButtonCaption") +focus_neighbor_top = NodePath("../CaptionBox/OptionButtonCaption") focus_neighbor_bottom = NodePath("../OSWaitTimeBox/HSliderOSWaitTime") text = "setting_气泡文字自动结束" diff --git a/scene/trailer.gd b/scene/trailer.gd index bc2d7952..6fd61660 100644 --- a/scene/trailer.gd +++ b/scene/trailer.gd @@ -1,24 +1,119 @@ extends Control @onready var video_player = $VideoStreamPlayer -@onready var mask = $"遮罩" @onready var earplug_notice = $"耳机提示" +@onready var sfx_click = $SfxClick as Sfx +@onready var settings = %"设置界面" as Control +@onready var lang_label = %LangLabel as Label +@onready var lang_left_btn = %LangLeft as Button +@onready var lang_right_btn = %LangRight as Button +@onready var caption_box = %CaptionBox as BoxContainer +@onready var caption_label = %CaptionLabel as Label +@onready var caption_left_btn = %CaptionLeft as Button +@onready var caption_right_btn = %CaptionRight as Button +@onready var confirm_btn = %ConfirmButton as Button + var packed_index_page := preload("uid://c4ycvdsabi7lw") +var first_launching_game := true + func _ready() -> void: - if GlobalConfigManager.config and GlobalConfigManager.config.skip_trailer: - SceneManager.checkout_index_page(false) - return + earplug_notice.hide() + if GlobalConfigManager.config: + var game_launched_times = GlobalConfigManager.config.game_launched_times + GlobalConfigManager.config.game_launched_times = game_launched_times + 1 + first_launching_game = game_launched_times == 0 + if GlobalConfigManager.config.skip_trailer: + SceneManager.checkout_index_page(false) + return video_player.play() - await video_player.finished - mask.visible = true + video_player.finished.connect(_on_video_finished) + + lang_label.text = GlobalConfigManager.get_locale_language_name() + caption_label.text = GlobalConfigManager.get_locale_caption_name() + if caption_label.text == "": + caption_box.hide() + lang_left_btn.pressed.connect(_on_lang_left_btn_pressed) + lang_right_btn.pressed.connect(_on_lang_right_btn_pressed) + caption_left_btn.pressed.connect(_on_caption_left_btn_pressed) + caption_right_btn.pressed.connect(_on_caption_right_btn_pressed) + + +var earplug_notice_tween: Tween + + +func _on_video_finished() -> void: earplug_notice.visible = true earplug_notice.modulate.a = 0 + earplug_notice_tween = create_tween() + earplug_notice_tween.tween_property(earplug_notice, "modulate:a", 1.0, 1.0) + if not first_launching_game: + settings.hide() + earplug_notice_tween.tween_interval(3.0) + earplug_notice_tween.tween_property(earplug_notice, "modulate:a", 0.0, 1.0) + earplug_notice_tween.finished.connect(_on_earplug_notice_finished) + else: + settings.show() + confirm_btn.pressed.connect(_on_confirm_btn_pressed) + + +func _on_confirm_btn_pressed() -> void: + confirm_btn.disabled = true var tween = create_tween() - tween.tween_property(earplug_notice, "modulate:a", 1.0, 1.0) - tween.tween_interval(3.0) tween.tween_property(earplug_notice, "modulate:a", 0.0, 1.0) - await tween.finished + tween.finished.connect(_on_earplug_notice_finished) + + +func _on_earplug_notice_finished() -> void: SceneManager.checkout_index_page(false) + + +func _unhandled_input(event: InputEvent) -> void: + if event.is_action_pressed("escape") and not first_launching_game: + if video_player.is_playing(): + get_viewport().set_input_as_handled() + video_player.stop() + _on_video_finished() + elif earplug_notice_tween and earplug_notice_tween.is_running(): + get_viewport().set_input_as_handled() + earplug_notice_tween.kill() + earplug_notice.modulate.a = 0 + _on_earplug_notice_finished() + + +func _on_lang_left_btn_pressed() -> void: + sfx_click.play() + GlobalConfigManager.update_locale( + GlobalConfigManager.config.language - 1, GlobalConfigManager.config.caption + ) + lang_label.text = GlobalConfigManager.get_locale_language_name() + caption_label.text = GlobalConfigManager.get_locale_caption_name() + caption_box.visible = caption_label.text != "" + + +func _on_lang_right_btn_pressed() -> void: + sfx_click.play() + GlobalConfigManager.update_locale( + GlobalConfigManager.config.language + 1, GlobalConfigManager.config.caption + ) + lang_label.text = GlobalConfigManager.get_locale_language_name() + caption_label.text = GlobalConfigManager.get_locale_caption_name() + caption_box.visible = caption_label.text != "" + + +func _on_caption_left_btn_pressed() -> void: + sfx_click.play() + GlobalConfigManager.update_locale( + GlobalConfigManager.config.language, GlobalConfigManager.config.caption - 1 + ) + caption_label.text = GlobalConfigManager.get_locale_caption_name() + + +func _on_caption_right_btn_pressed() -> void: + sfx_click.play() + GlobalConfigManager.update_locale( + GlobalConfigManager.config.language, GlobalConfigManager.config.caption + 1 + ) + caption_label.text = GlobalConfigManager.get_locale_caption_name() diff --git a/scene/trailer.tscn b/scene/trailer.tscn index 4d480664..ac1ff6fd 100644 --- a/scene/trailer.tscn +++ b/scene/trailer.tscn @@ -1,8 +1,14 @@ -[gd_scene load_steps=4 format=3 uid="uid://bpjjq1wdqm7um"] +[gd_scene load_steps=9 format=3 uid="uid://bpjjq1wdqm7um"] [ext_resource type="VideoStream" uid="uid://bkbulg542mj6v" path="res://asset/audio/专用/包包丁片头_5899532.ogv" id="1_24316"] [ext_resource type="Script" uid="uid://dbjwl8l8x1udp" path="res://scene/trailer.gd" id="1_tess7"] -[ext_resource type="Texture2D" uid="uid://c0r4spqoga3of" path="res://asset/art/ui/index/佩戴耳机提示.png" id="3_8aq0n"] +[ext_resource type="Texture2D" uid="uid://b1xp65ac7f1iq" path="res://asset/art/ui/index/佩戴耳机提示_下方无字.png" id="3_a6l8g"] +[ext_resource type="AudioStream" uid="uid://dq7h4qjtd72wk" path="res://asset/audio/sfx/交互/通用点击.ogg" id="4_y2lxw"] +[ext_resource type="Script" uid="uid://rq6w1vuhuq1m" path="res://scene/entity/audio/sfx.gd" id="5_yb8ks"] +[ext_resource type="Theme" uid="uid://be5scnhjobkux" path="res://config/settings_theme.tres" id="6_a6l8g"] +[ext_resource type="FontVariation" uid="uid://1ryw42kej6lv" path="res://config/font_ui.tres" id="7_pe403"] + +[sub_resource type="StyleBoxEmpty" id="StyleBoxEmpty_2v8ms"] [node name="Trailer" type="Control"] layout_mode = 3 @@ -13,6 +19,23 @@ grow_horizontal = 2 grow_vertical = 2 script = ExtResource("1_tess7") +[node name="SfxClick" type="AudioStreamPlayer" parent="."] +stream = ExtResource("4_y2lxw") +bus = &"game_sfx" +script = ExtResource("5_yb8ks") +metadata/_custom_type_script = "uid://rq6w1vuhuq1m" + +[node name="遮罩" type="ColorRect" parent="."] +layout_mode = 1 +anchors_preset = 15 +anchor_right = 1.0 +anchor_bottom = 1.0 +offset_top = -1.0 +offset_bottom = -1.0 +grow_horizontal = 2 +grow_vertical = 2 +color = Color(0, 0, 0, 1) + [node name="VideoStreamPlayer" type="VideoStreamPlayer" parent="."] layout_mode = 1 anchors_preset = 15 @@ -25,24 +48,132 @@ volume_db = -8.0 expand = true bus = &"game_sfx" -[node name="遮罩" type="ColorRect" parent="."] -visible = false -layout_mode = 1 -anchors_preset = 15 -anchor_right = 1.0 -anchor_bottom = 1.0 -grow_horizontal = 2 -grow_vertical = 2 -color = Color(0, 0, 0, 1) - [node name="耳机提示" type="TextureRect" parent="."] -visible = false layout_mode = 1 anchors_preset = 15 anchor_right = 1.0 anchor_bottom = 1.0 grow_horizontal = 2 grow_vertical = 2 -texture = ExtResource("3_8aq0n") +texture = ExtResource("3_a6l8g") expand_mode = 1 stretch_mode = 5 + +[node name="设置界面" type="MarginContainer" parent="耳机提示"] +unique_name_in_owner = true +layout_mode = 1 +anchors_preset = 7 +anchor_left = 0.5 +anchor_top = 1.0 +anchor_right = 0.5 +anchor_bottom = 1.0 +offset_left = -85.0 +offset_top = -65.0 +offset_right = 85.0 +grow_horizontal = 2 +grow_vertical = 0 + +[node name="VBoxContainer" type="VBoxContainer" parent="耳机提示/设置界面"] +custom_minimum_size = Vector2(0, 100) +layout_mode = 2 +size_flags_horizontal = 4 +size_flags_vertical = 4 +theme = ExtResource("6_a6l8g") + +[node name="语言" type="HBoxContainer" parent="耳机提示/设置界面/VBoxContainer"] +layout_mode = 2 +size_flags_horizontal = 4 + +[node name="Label" type="Label" parent="耳机提示/设置界面/VBoxContainer/语言"] +custom_minimum_size = Vector2(50, 0) +layout_mode = 2 +text = "setting_语言" + +[node name="VSeparator" type="VSeparator" parent="耳机提示/设置界面/VBoxContainer/语言"] +layout_mode = 2 +theme_override_constants/separation = 31 +theme_override_styles/separator = SubResource("StyleBoxEmpty_2v8ms") + +[node name="LangLeft" type="Button" parent="耳机提示/设置界面/VBoxContainer/语言"] +unique_name_in_owner = true +layout_mode = 2 +focus_neighbor_right = NodePath("../LangRight") +focus_neighbor_bottom = NodePath("../../CaptionBox/CaptionLeft") +focus_next = NodePath("../LangRight") +focus_previous = NodePath("../../ConfirmButton") +text = "<" +flat = true + +[node name="LangLabel" type="Label" parent="耳机提示/设置界面/VBoxContainer/语言"] +unique_name_in_owner = true +custom_minimum_size = Vector2(50, 0) +layout_mode = 2 +text = "中文" +horizontal_alignment = 1 + +[node name="LangRight" type="Button" parent="耳机提示/设置界面/VBoxContainer/语言"] +unique_name_in_owner = true +layout_mode = 2 +focus_neighbor_left = NodePath("../LangLeft") +focus_neighbor_bottom = NodePath("../../CaptionBox/CaptionRight") +focus_next = NodePath("../../CaptionBox/CaptionLeft") +focus_previous = NodePath("../LangLeft") +text = ">" +flat = true + +[node name="CaptionBox" type="HBoxContainer" parent="耳机提示/设置界面/VBoxContainer"] +unique_name_in_owner = true +layout_mode = 2 +size_flags_horizontal = 4 + +[node name="Label" type="Label" parent="耳机提示/设置界面/VBoxContainer/CaptionBox"] +custom_minimum_size = Vector2(50, 0) +layout_mode = 2 +text = "setting_字幕" + +[node name="VSeparator" type="VSeparator" parent="耳机提示/设置界面/VBoxContainer/CaptionBox"] +layout_mode = 2 +theme_override_constants/separation = 31 +theme_override_styles/separator = SubResource("StyleBoxEmpty_2v8ms") + +[node name="CaptionLeft" type="Button" parent="耳机提示/设置界面/VBoxContainer/CaptionBox"] +unique_name_in_owner = true +layout_mode = 2 +focus_neighbor_top = NodePath("../../语言/LangLeft") +focus_neighbor_right = NodePath("../CaptionRight") +focus_neighbor_bottom = NodePath("../../ConfirmButton") +focus_next = NodePath("../CaptionRight") +focus_previous = NodePath("../../语言/LangRight") +text = "<" +flat = true + +[node name="CaptionLabel" type="Label" parent="耳机提示/设置界面/VBoxContainer/CaptionBox"] +unique_name_in_owner = true +custom_minimum_size = Vector2(50, 0) +layout_mode = 2 +text = "普通话" +horizontal_alignment = 1 + +[node name="CaptionRight" type="Button" parent="耳机提示/设置界面/VBoxContainer/CaptionBox"] +unique_name_in_owner = true +layout_mode = 2 +focus_neighbor_left = NodePath("../CaptionLeft") +focus_neighbor_top = NodePath("../../语言/LangRight") +focus_neighbor_right = NodePath("../../ConfirmButton") +focus_neighbor_bottom = NodePath("../../ConfirmButton") +focus_next = NodePath("../../ConfirmButton") +focus_previous = NodePath("../CaptionLeft") +text = ">" +flat = true + +[node name="ConfirmButton" type="Button" parent="耳机提示/设置界面/VBoxContainer"] +unique_name_in_owner = true +layout_mode = 2 +size_flags_horizontal = 6 +size_flags_vertical = 4 +focus_neighbor_top = NodePath("../CaptionBox/CaptionLeft") +focus_next = NodePath("../语言/LangLeft") +focus_previous = NodePath("../CaptionBox/CaptionRight") +theme_override_fonts/font = ExtResource("7_pe403") +theme_override_font_sizes/font_size = 11 +text = "setting_确认"