From bc7c73ba69f3a5064ac9460f36764e1b3cc7fd3a Mon Sep 17 00:00:00 2001 From: cakipaul Date: Tue, 15 Jul 2025 18:37:00 +0800 Subject: [PATCH] =?UTF-8?q?=E5=90=AF=E5=8A=A8=E7=95=8C=E9=9D=A2=E5=A2=9E?= =?UTF-8?q?=E5=8A=A0=E8=AF=AD=E8=A8=80=E8=AE=BE=E7=BD=AE=E9=80=89=E9=A1=B9?= =?UTF-8?q?;=20=E7=9B=92=E5=AD=90=E7=8C=AB=E4=BA=8C=E6=A5=BC=E7=8C=AA?= =?UTF-8?q?=E5=A4=B4=E6=80=AAbug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- asset/art/ui/index/佩戴耳机提示_下方无字.png | Bin 0 -> 16269 bytes .../ui/index/佩戴耳机提示_下方无字.png.import | 34 +++++ asset/dialogue/item_description.csv | 1 + asset/dialogue/item_description.dialogue | 2 + manager/config_manager/global_config.gd | 4 +- .../config_manager/global_config_manager.gd | 44 ++++-- scene/ground/scene/c02/s13_盒子猫二楼.gd | 2 +- scene/settings/settings.gd | 74 ++++++--- scene/settings/settings.tscn | 54 ++++++- scene/trailer.gd | 105 ++++++++++++- scene/trailer.tscn | 142 +++++++++++++++++- 11 files changed, 402 insertions(+), 60 deletions(-) create mode 100644 asset/art/ui/index/佩戴耳机提示_下方无字.png create mode 100644 asset/art/ui/index/佩戴耳机提示_下方无字.png.import diff --git a/asset/art/ui/index/佩戴耳机提示_下方无字.png b/asset/art/ui/index/佩戴耳机提示_下方无字.png new file mode 100644 index 0000000000000000000000000000000000000000..bad41cabb95af1c532ea88d737b0f4083f550e9f GIT binary patch literal 16269 zcmeHN^;Z^Aw;qd-P((md8l;s536U4Xrw_&B^8AiP(Zo_LAsHal$5@E zUcZ0gTlcQJcz+mY&YZL3*>RpT7;;lxf#@{VX#_!tloVw(5d@zHK~AyY9fy$wYoiD7 z&oLKG1sNp2jb;u(=n*B^YucWP3&YIV_g^_je`P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Zw&T&Az{FSEpD+17Vx-Pl_+vvGwykrhMkWm7q}f7HL98;-G@%85;Jqh@|I zIwAF(!ewRKaL$weFMMuUz;bu1`Q>GY1zF=?3uGpbqC|s}*Cf+rbvHLi)$Lm53Ev4Bdhqo__Z}%_WZOh8y%u8>zY!e z#jvedIqi$s7jsJDIabyxSSd^>?DwP`L*5V z(k2xfDPv$+Zq@>&FoeSkA**&<(t!~Cp9R#T@8JRrDiS8jaG>{TY+mqd1FiSb~ z3APz(j!?lVi1Ya266`PN0NT*sJZ5xRmlwXy9Q}?EI6~kEfg=Qt5I92M2!SI6{+kG_ zjBbvFp$epb9QIc59r3UKCfG-^j}SOQ;QtN+zQ;|2H^$jl+pSQWl;qT9^JPpQ{tv 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_CN", "zh_SH"], 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/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/settings/settings.gd b/scene/settings/settings.gd index 03b4f446..8356c5fd 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 @@ -60,14 +67,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) @@ -119,20 +127,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 680767c1..c46cab8d 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 bd8b923d..c76128df 100644 --- a/scene/trailer.gd +++ b/scene/trailer.gd @@ -4,21 +4,112 @@ extends Control @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("res://scene/index_page.tscn") +var first_launching_game := true + func _ready() -> void: - if GlobalConfigManager.config and GlobalConfigManager.config.skip_trailer: - SceneManager.checkout_index_page(false) - return + 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 + video_player.finished.connect(_on_video_finished) + + 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: mask.visible = true 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: 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..10c8dd10 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,12 @@ 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="VideoStreamPlayer" type="VideoStreamPlayer" parent="."] layout_mode = 1 anchors_preset = 15 @@ -36,13 +48,135 @@ 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 +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 +text = ">" +flat = true + +[node name="OptionButtonLanguage" type="OptionButton" parent="耳机提示/设置界面/VBoxContainer/语言"] +unique_name_in_owner = true +visible = false +layout_mode = 2 +focus_neighbor_bottom = NodePath("../../CaptionBox/OptionButtonCaption") +selected = 0 +allow_reselect = true +item_count = 2 +popup/item_0/text = "简体中文" +popup/item_0/id = 0 +popup/item_1/text = "English" +popup/item_1/id = 2 + +[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="OptionButtonCaption" type="OptionButton" parent="耳机提示/设置界面/VBoxContainer/CaptionBox"] +unique_name_in_owner = true +visible = false +layout_mode = 2 +focus_neighbor_top = NodePath("../../语言/OptionButtonLanguage") +selected = 0 +allow_reselect = true +item_count = 2 +popup/item_0/text = "上海话" +popup/item_0/id = 1 +popup/item_1/text = "普通话" +popup/item_1/id = 0 + +[node name="CaptionLeft" type="Button" parent="耳机提示/设置界面/VBoxContainer/CaptionBox"] +unique_name_in_owner = true +layout_mode = 2 +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 +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 +theme_override_fonts/font = ExtResource("7_pe403") +theme_override_font_sizes/font_size = 11 +text = "setting_确认"