From ab2c6933e1a2ab567ff4d2884996f257d94b2823 Mon Sep 17 00:00:00 2001 From: cakipaul Date: Sat, 28 Jun 2025 02:41:37 +0800 Subject: [PATCH] =?UTF-8?q?settings=20locale=20=E5=8A=9F=E8=83=BD=EF=BC=9A?= =?UTF-8?q?lang=20+=20caption?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../c02/s03_公寓一楼院子/f_院子内墙上文字.png | Bin 2684 -> 5700 bytes asset/dialogue/item_description.csv | 22 +- asset/dialogue/item_description.dialogue | 13 +- config/default_theme.tres | 6 +- manager/archive_manager/assembled_archive.gd | 4 +- manager/config_manager/global_config.gd | 4 +- .../config_manager/global_config_manager.gd | 22 ++ manager/scene/global_functor.gd | 2 + scene/ground/scene/c02/s03_院子.tscn | 9 +- scene/ground/scene/c02/s08_瞎子卧室.gd | 3 +- scene/little_game/书架/书架.gd | 4 +- scene/little_game/书架/书架.tscn | 4 + scene/main.gd | 8 +- scene/settings/settings.gd | 59 ++--- scene/settings/settings.tscn | 218 ++++++++++-------- 15 files changed, 222 insertions(+), 156 deletions(-) diff --git a/asset/art/scene/c02/s03_公寓一楼院子/f_院子内墙上文字.png b/asset/art/scene/c02/s03_公寓一楼院子/f_院子内墙上文字.png index fb1424d6f56a38d874c115570798acf01538a4d6..4a56558c4f4990452d8da67121f609b67e741514 100644 GIT binary patch literal 5700 zcmXw62Rzj8AO9jU%gWA9WF;db!i6K_P(}#(*$&wwy37zxwlmKbBFe~$kj=@6lkKcC z3YXbm?*7l~b$8!;KI{E_=JSn$=xWeVvQYv6K%)tMU;qGQ(dW+&!ub;#` zHkaMvLKlAw3fRVCk0*|sFqxQ>LI0tvFgkjHgcYO{AZHMMPkxdsUJv}Wrx`|k4Lo;= zn|7tI-JY})0Cq_H{er!!?w=67cLRt4_c1Yk`tJF^p^Xp$V}LsWnB%3#P!YimfNx@t zzA*ydSb!?Sn*S()Bmi*nf1%0?l+gg2dzwn5z+`D6ni-f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W0ipJ zb3cJLR@vrSPt1&3rnX=rwCGXDN^E>5t!O(mZ;w^jyXvU3o{{w3z$v3~T+V%Mge>LN%|6PTOBd#2BoMIZ zTXefAk-2$R7ZN@;G#b3)yvE-{x3zH;*8t~oa1)eouG+`2Q$_4gp2+#93+c!vA6Z=& zd?c{IDP4ejjI^OvQi2q-2cPTbJ7qpa3Kakj;11A17heX{6}Y^Xv^?tF#dRDBWmJ-6 zBMmY!-nuG1i#oR>YX-IC;$$GPkB_BEXLCKUHU2#1bj>*=NVDM#fUC30l&B4?-hi5g zlgmC|YL4wj0)86Hv%x0DKk+*5M*R;;cWc!It1u+X&ldDwrPaj$$Eob=UeU_n41w%= z;f|kJN1|$I84V{REqN`%@;4} zwBb4cY6F{cm%LIk=wW&yaewLA4%B7h;R@0>a#5&wJXpM7A4++ppV2@;2QB2qaf@o`rF&j-*>s0rJj8fwcVLgKHw9-DReoMLp~ zJ0PJXEa;D4+>4ynwea_c==z~p4okD!MutS%7Ebe9bBSp@req(u8DWtp6Cj^=)e&I! zvzd9IA773P1byH~hy^{ywh)}NB7_j`NQ7wW`hP$zoLc)lGe4DEzs7p^RnN*Ag8K_e zRzpG8Be&6B+#USHY`>cGqSgn@ZFx*oU*D)Yy}G(2JpQC?$8riEzVwFY7YA*4Us>+( z*(qLLe+((J;pBQciOu-%z8y4yj&Jk_6a*xs`A$@}bw%V5Hm0)re@^+?sd` z_rr71;9{sYPTUT*##cDX+`iw@M5x_jY?cz$)bkO2-I46ZuaI$gs{ppj7nu>s0CEzP z<+J>Y47&Ow(#Lxp8rwSzA&8~Xcuqv6CsCUu>=PT`J+U<=f^bK6H`Jq5_g*E$n#sW4 zjXq6HUGFHhhn7z& void: config.db_game_sfx, config.db_dialog ) + # set locale + 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" + GlobalConfigManager.config.language = lang_id + GlobalConfigManager.config.caption = caption_id + print("set language to: ", lang) + TranslationServer.set_locale(lang) func _on_timer_timeout(): diff --git a/manager/scene/global_functor.gd b/manager/scene/global_functor.gd index 84369d56..3fd73dd8 100644 --- a/manager/scene/global_functor.gd +++ b/manager/scene/global_functor.gd @@ -54,6 +54,7 @@ func c02_fire_count_down_try_start(): func _on_c02_fire_count_down_timeout(): + SceneManager.lock_player(0) SceneManager.pop_debug_dialog_info("音效", "【重开】霸凌救小蝉倒计时") c02_fire_count_down_timer.stop() AudioManager.stop_bgm_music("霸凌救小蝉倒计时") @@ -61,6 +62,7 @@ func _on_c02_fire_count_down_timeout(): await get_tree().create_timer(1.0).timeout SceneManager.show_black_hand(true, 0.5) await get_tree().create_timer(3.0).timeout + SceneManager.unlock_player() SceneManager.get_ground_loader().transition_to_scene("c02_s03", "4") # TODO 音效 # res://asset/audio/BGM/心跳背景音.mp3 diff --git a/scene/ground/scene/c02/s03_院子.tscn b/scene/ground/scene/c02/s03_院子.tscn index af128467..4fdb0fc8 100644 --- a/scene/ground/scene/c02/s03_院子.tscn +++ b/scene/ground/scene/c02/s03_院子.tscn @@ -403,10 +403,11 @@ energy = 0.5 texture = ExtResource("11_em2ma") [node name="PointLight2D" type="PointLight2D" parent="Ground/DeployLayer/灯笼/灯笼"] -position = Vector2(0, 26) +position = Vector2(0, 56) color = Color(1, 0.0980392, 0, 1) energy = 0.7 texture = SubResource("GradientTexture2D_kyfht") +texture_scale = 2.2 [node name="灯笼2" type="Sprite2D" parent="Ground/DeployLayer/灯笼"] position = Vector2(1166, -94) @@ -418,10 +419,11 @@ energy = 0.5 texture = ExtResource("11_em2ma") [node name="PointLight2D" type="PointLight2D" parent="Ground/DeployLayer/灯笼/灯笼2"] -position = Vector2(0, 26) +position = Vector2(0, 49) color = Color(1, 0.0980392, 0, 1) energy = 0.7 texture = SubResource("GradientTexture2D_kyfht") +texture_scale = 2.2 [node name="灯笼3" type="Sprite2D" parent="Ground/DeployLayer/灯笼"] position = Vector2(1764, -86) @@ -433,10 +435,11 @@ energy = 0.5 texture = ExtResource("11_em2ma") [node name="PointLight2D" type="PointLight2D" parent="Ground/DeployLayer/灯笼/灯笼3"] -position = Vector2(0, 26) +position = Vector2(0, 55) color = Color(1, 0.0980392, 0, 1) energy = 0.7 texture = SubResource("GradientTexture2D_kyfht") +texture_scale = 2.2 [node name="新背景_奠" type="Node2D" parent="Ground/DeployLayer" index="10"] visible = false diff --git a/scene/ground/scene/c02/s08_瞎子卧室.gd b/scene/ground/scene/c02/s08_瞎子卧室.gd index 2a4307eb..9d51e8d8 100644 --- a/scene/ground/scene/c02/s08_瞎子卧室.gd +++ b/scene/ground/scene/c02/s08_瞎子卧室.gd @@ -54,7 +54,8 @@ func _on_ground_ready() -> void: boxcat_portal.get_node("Sprite2D").texture = preload("uid://efhwoqtn21d8") # e_墙上纸张_boxcat else: $"../DeployLayer/Closeup画".enabled = true - $"../DeployLayer/癞子偷窥/Sfx2D癞子呼吸".play() + if gaslight.interacted_times > 0: + $"../DeployLayer/癞子偷窥/Sfx2D癞子呼吸".play() if boxcat_played: $"../DeployLayer/portal_left".status = "opened" # 玩过小猫游戏,画框内容更新 禁止再进入 diff --git a/scene/little_game/书架/书架.gd b/scene/little_game/书架/书架.gd index ec80bef6..2a44064d 100644 --- a/scene/little_game/书架/书架.gd +++ b/scene/little_game/书架/书架.gd @@ -6,7 +6,7 @@ signal success const NON_SELECTED = [-1, -1] -@export var shuffle_times := 20 +@export var shuffle_times := 4 @export var debug_relocate := false: set(value): debug_relocate = false @@ -86,7 +86,7 @@ func _shuffle_books() -> void: SceneManager.pop_debug_dialog_info( "备注", "debug模式每列随机洗牌 1 次,正常模式每列随机洗牌 " + str(shuffle_times) + " 次" ) - shuffle_times = 1 + shuffle_times = 4 suffling = true rand_from_seed(Time.get_ticks_usec()) for row in range(3): diff --git a/scene/little_game/书架/书架.tscn b/scene/little_game/书架/书架.tscn index 8b71fa8d..bbbe29c3 100644 --- a/scene/little_game/书架/书架.tscn +++ b/scene/little_game/书架/书架.tscn @@ -180,24 +180,28 @@ layer = 5 script = ExtResource("1_8af23") [node name="Sfx书本掉落" type="AudioStreamPlayer" parent="."] +process_mode = 1 stream = ExtResource("2_c6xiu") bus = &"game_sfx" script = ExtResource("3_5brf2") metadata/_custom_type_script = "uid://rq6w1vuhuq1m" [node name="Sfx扶正书本" type="AudioStreamPlayer" parent="."] +process_mode = 1 stream = ExtResource("3_o6bsw") bus = &"game_sfx" script = ExtResource("3_5brf2") metadata/_custom_type_script = "uid://rq6w1vuhuq1m" [node name="SfxInterchange" type="AudioStreamPlayer" parent="."] +process_mode = 1 stream = ExtResource("3_c6xiu") bus = &"game_sfx" script = ExtResource("3_5brf2") metadata/_custom_type_script = "uid://rq6w1vuhuq1m" [node name="SfxSelect" type="AudioStreamPlayer" parent="."] +process_mode = 1 stream = ExtResource("3_pfav2") bus = &"game_sfx" script = ExtResource("3_5brf2") diff --git a/scene/main.gd b/scene/main.gd index 3653a079..f4ff9b16 100644 --- a/scene/main.gd +++ b/scene/main.gd @@ -1,9 +1,9 @@ extends Node2D -@export var locale := "": - set(val): - TranslationServer.set_locale(val) - locale = val +# @export var locale := "": +# set(val): +# TranslationServer.set_locale(val) +# locale = val func _ready() -> void: diff --git a/scene/settings/settings.gd b/scene/settings/settings.gd index b76a82e6..c4b9f9fa 100644 --- a/scene/settings/settings.gd +++ b/scene/settings/settings.gd @@ -4,12 +4,13 @@ extends CanvasLayer @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 autosave_box = %AutoSaveCheckBox as CheckBox @onready var autosave_time_edit = %SaveTimeLineEdit as LineEdit @onready var fullscreen_box = %FullscreenBox as CheckBox @onready var top_box = %TopBox as CheckBox -@onready var index_btn = %IndexBtn as Button -@onready var exit_btn = %ExitBtn as Button +@onready var return_btn = %ReturnBtn as Button # 音量 DB 偏移 const sfx_db_offset := 6.0 @@ -17,6 +18,8 @@ const dialog_db_offset := -10.0 static func _init() -> void: + if not GlobalConfigManager.config: + return AudioServer.set_bus_volume_db( AudioServer.get_bus_index("Master"), GlobalConfigManager.config.db_master ) @@ -52,8 +55,12 @@ func _ready(): dialog_bus_slider.value_changed.connect(_on_dialog_bus_slider_value_changed) # language language_options.selected = GlobalConfigManager.config.language - _on_language_options_selected(language_options.selected) - language_options.item_selected.connect(_on_language_options_selected) + 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() # auto save autosave_box.button_pressed = GlobalConfigManager.config.auto_save_enabled autosave_time_edit.editable = GlobalConfigManager.config.auto_save_enabled @@ -67,12 +74,11 @@ func _ready(): fullscreen_box.toggled.connect(_on_fullscreen_box_toggled) top_box.toggled.connect(_on_top_box_toggled) # navigation - exit_btn.pressed.connect(_on_exit_btn_pressed) - index_btn.pressed.connect(_on_index_btn_pressed) + return_btn.pressed.connect(_on_return_btn_pressed) + return_btn.grab_focus() # open $"Sfx打开".play() SceneManager.toggle_pause_counter(true) - index_btn.grab_focus() func _on_master_bus_slider_value_changed(value: float) -> void: @@ -93,23 +99,16 @@ 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_options_selected(id: int) -> void: - # -1 null; 0 zh_CN; 1 zh_SH; 2 en - var lang = "" - match id: - 0: - lang = "zh_CN" - 1: - lang = "zh_SH" - 2: - lang = "en" - _: - lang = "zh_CN" - printerr("Unknown language id: ", id) - GlobalConfigManager.config.language = id - if GlobalConfig.DEBUG: - print("set language to: ", lang) - TranslationServer.set_locale(lang) +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() + else: + caption_box.show() + GlobalConfigManager.update_locale(lang_id, caption_id) func _on_autosave_box_toggled(is_pressed: bool) -> void: @@ -139,17 +138,7 @@ func _on_top_box_toggled(is_pressed: bool) -> void: GlobalConfigManager.config.window_top = is_pressed -func _on_exit_btn_pressed() -> void: - # 从 ArchiveManager 处理退出信号 - ArchiveManager.notification(NOTIFICATION_WM_CLOSE_REQUEST) - # 退出游戏过程隐藏 setting 界面 - exit_settings() - - -func _on_index_btn_pressed() -> void: - ArchiveManager.save_all() - SceneManager.checkout_index_page() - # 切换过程隐藏 setting 界面 +func _on_return_btn_pressed() -> void: exit_settings() diff --git a/scene/settings/settings.tscn b/scene/settings/settings.tscn index d0558955..d6ff04d3 100644 --- a/scene/settings/settings.tscn +++ b/scene/settings/settings.tscn @@ -1,9 +1,13 @@ -[gd_scene load_steps=5 format=3 uid="uid://beok2r6fgburn"] +[gd_scene load_steps=8 format=3 uid="uid://beok2r6fgburn"] [ext_resource type="Script" uid="uid://ciloxu1k8a1ll" path="res://scene/settings/settings.gd" id="1_7u4nq"] [ext_resource type="AudioStream" uid="uid://dlt4nv6qjhlpy" path="res://asset/audio/sfx/交互/sfx_打开设置.wav" id="2_6hxkf"] [ext_resource type="Script" uid="uid://rq6w1vuhuq1m" path="res://scene/entity/audio/sfx.gd" id="3_kn03d"] [ext_resource type="AudioStream" uid="uid://cmi6fd68s1ukb" path="res://asset/audio/sfx/交互/sfx_关闭设置.wav" id="4_n2b1f"] +[ext_resource type="Texture2D" uid="uid://f186lvt5y2ql" path="res://asset/art/ui/inspect/inspect背景遮罩.png" id="5_kn03d"] +[ext_resource type="FontVariation" uid="uid://1ryw42kej6lv" path="res://config/font_ui.tres" id="6_n2b1f"] + +[sub_resource type="StyleBoxEmpty" id="StyleBoxEmpty_n2b1f"] [node name="Settings" type="CanvasLayer"] process_mode = 3 @@ -26,202 +30,232 @@ bus = &"game_sfx" script = ExtResource("3_kn03d") metadata/_custom_type_script = "uid://rq6w1vuhuq1m" -[node name="ClickMask" type="Control" parent="."] -layout_mode = 3 +[node name="TextureRect" type="TextureRect" parent="."] anchors_preset = 15 anchor_right = 1.0 anchor_bottom = 1.0 grow_horizontal = 2 grow_vertical = 2 +mouse_filter = 0 +texture = ExtResource("5_kn03d") -[node name="PanelContainer" type="PanelContainer" parent="."] +[node name="VBoxContainer" type="VBoxContainer" parent="."] +custom_minimum_size = Vector2(0, 199) anchors_preset = 8 anchor_left = 0.5 anchor_top = 0.5 anchor_right = 0.5 anchor_bottom = 0.5 -offset_left = -119.0 -offset_top = -84.0 -offset_right = 119.0 -offset_bottom = 78.0 +offset_left = -95.0 +offset_top = -109.5 +offset_right = 95.0 +offset_bottom = 109.5 grow_horizontal = 2 grow_vertical = 2 - -[node name="VBoxContainer" type="VBoxContainer" parent="PanelContainer"] -layout_mode = 2 size_flags_horizontal = 4 -[node name="MarginContainer2" type="MarginContainer" parent="PanelContainer/VBoxContainer"] +[node name="总音量" type="HBoxContainer" parent="VBoxContainer"] layout_mode = 2 -theme_override_constants/margin_top = 6 -[node name="HBoxContainer" type="HBoxContainer" parent="PanelContainer/VBoxContainer"] -layout_mode = 2 -size_flags_horizontal = 4 - -[node name="Label" type="Label" parent="PanelContainer/VBoxContainer/HBoxContainer"] +[node name="Label" type="Label" parent="VBoxContainer/总音量"] custom_minimum_size = Vector2(50, 0) layout_mode = 2 +theme_override_fonts/font = ExtResource("6_n2b1f") +theme_override_font_sizes/font_size = 11 text = "setting_总音量" -[node name="HSliderMasterBus" type="HSlider" parent="PanelContainer/VBoxContainer/HBoxContainer"] +[node name="HSliderMasterBus" type="HSlider" parent="VBoxContainer/总音量"] unique_name_in_owner = true custom_minimum_size = Vector2(100, 5) layout_mode = 2 -focus_neighbor_bottom = NodePath("../../HBoxContainer2/HSliderSfxBus") -focus_next = NodePath("../../HBoxContainer2/HSliderSfxBus") +size_flags_horizontal = 10 +focus_neighbor_bottom = NodePath("../../音效音量/HSliderSfxBus") +focus_next = NodePath("../../音效音量/HSliderSfxBus") max_value = 1.0 step = 0.01 value = 1.0 -[node name="HBoxContainer2" type="HBoxContainer" parent="PanelContainer/VBoxContainer"] +[node name="音效音量" type="HBoxContainer" parent="VBoxContainer"] layout_mode = 2 -size_flags_horizontal = 4 -[node name="Label" type="Label" parent="PanelContainer/VBoxContainer/HBoxContainer2"] +[node name="Label" type="Label" parent="VBoxContainer/音效音量"] custom_minimum_size = Vector2(50, 0) layout_mode = 2 +theme_override_fonts/font = ExtResource("6_n2b1f") +theme_override_font_sizes/font_size = 11 text = "setting_音效音量" -[node name="HSliderSfxBus" type="HSlider" parent="PanelContainer/VBoxContainer/HBoxContainer2"] +[node name="HSliderSfxBus" type="HSlider" parent="VBoxContainer/音效音量"] unique_name_in_owner = true custom_minimum_size = Vector2(100, 5) layout_mode = 2 -focus_neighbor_top = NodePath("../../HBoxContainer/HSliderMasterBus") -focus_neighbor_bottom = NodePath("../../HBoxContainer5/HSliderDialogBus") +size_flags_horizontal = 10 +focus_neighbor_top = NodePath("../../总音量/HSliderMasterBus") +focus_neighbor_bottom = NodePath("../../对话音量/HSliderDialogBus") max_value = 1.0 step = 0.01 value = 1.0 -[node name="HBoxContainer5" type="HBoxContainer" parent="PanelContainer/VBoxContainer"] +[node name="对话音量" type="HBoxContainer" parent="VBoxContainer"] layout_mode = 2 -size_flags_horizontal = 4 -[node name="Label" type="Label" parent="PanelContainer/VBoxContainer/HBoxContainer5"] +[node name="Label" type="Label" parent="VBoxContainer/对话音量"] custom_minimum_size = Vector2(50, 0) layout_mode = 2 +theme_override_fonts/font = ExtResource("6_n2b1f") +theme_override_font_sizes/font_size = 11 text = "setting_对话音量" -[node name="HSliderDialogBus" type="HSlider" parent="PanelContainer/VBoxContainer/HBoxContainer5"] +[node name="HSliderDialogBus" type="HSlider" parent="VBoxContainer/对话音量"] unique_name_in_owner = true custom_minimum_size = Vector2(100, 5) layout_mode = 2 -focus_neighbor_top = NodePath("../../HBoxContainer2/HSliderSfxBus") -focus_neighbor_bottom = NodePath("../../HBoxContainer6/OptionButtonLanguage") +size_flags_horizontal = 10 +focus_neighbor_top = NodePath("../../音效音量/HSliderSfxBus") +focus_neighbor_bottom = NodePath("../../语言/OptionButtonLanguage") max_value = 1.0 step = 0.01 value = 1.0 -[node name="HSeparator" type="HSeparator" parent="PanelContainer/VBoxContainer"] +[node name="HSeparator" type="HSeparator" parent="VBoxContainer"] layout_mode = 2 -[node name="HBoxContainer6" type="HBoxContainer" parent="PanelContainer/VBoxContainer"] +[node name="语言" type="HBoxContainer" parent="VBoxContainer"] layout_mode = 2 size_flags_horizontal = 4 -[node name="Label" type="Label" parent="PanelContainer/VBoxContainer/HBoxContainer6"] +[node name="Label" type="Label" parent="VBoxContainer/语言"] custom_minimum_size = Vector2(50, 0) layout_mode = 2 +theme_override_fonts/font = ExtResource("6_n2b1f") +theme_override_font_sizes/font_size = 11 text = "setting_语言" -[node name="OptionButtonLanguage" type="OptionButton" parent="PanelContainer/VBoxContainer/HBoxContainer6"] +[node name="VSeparator" type="VSeparator" parent="VBoxContainer/语言"] +layout_mode = 2 +theme_override_constants/separation = 31 +theme_override_styles/separator = SubResource("StyleBoxEmpty_n2b1f") + +[node name="OptionButtonLanguage" type="OptionButton" parent="VBoxContainer/语言"] unique_name_in_owner = true layout_mode = 2 -focus_neighbor_top = NodePath("../../HBoxContainer5/HSliderDialogBus") -focus_neighbor_bottom = NodePath("../../HBoxContainer4/AutoSaveCheckBox") +focus_neighbor_top = NodePath("../../对话音量/HSliderDialogBus") +focus_neighbor_bottom = NodePath("../../自动保存/AutoSaveCheckBox") +theme_override_fonts/font = ExtResource("6_n2b1f") +theme_override_font_sizes/font_size = 11 selected = 0 allow_reselect = true -item_count = 3 -popup/item_0/text = "普通话(简体)" +item_count = 2 +popup/item_0/text = "简体中文" popup/item_0/id = 0 -popup/item_1/text = "上海话(简体)" -popup/item_1/id = 1 -popup/item_2/text = "English" -popup/item_2/id = 2 +popup/item_1/text = "English" +popup/item_1/id = 2 -[node name="HSeparator4" type="HSeparator" parent="PanelContainer/VBoxContainer"] -layout_mode = 2 - -[node name="HBoxContainer4" type="HBoxContainer" parent="PanelContainer/VBoxContainer"] +[node name="字幕" type="HBoxContainer" parent="VBoxContainer"] +unique_name_in_owner = true layout_mode = 2 size_flags_horizontal = 4 -[node name="AutoSaveCheckBox" type="CheckBox" parent="PanelContainer/VBoxContainer/HBoxContainer4"] +[node name="Label" type="Label" parent="VBoxContainer/字幕"] +custom_minimum_size = Vector2(50, 0) +layout_mode = 2 +theme_override_fonts/font = ExtResource("6_n2b1f") +theme_override_font_sizes/font_size = 11 +text = "setting_字幕" + +[node name="VSeparator" type="VSeparator" parent="VBoxContainer/字幕"] +layout_mode = 2 +theme_override_constants/separation = 31 +theme_override_styles/separator = SubResource("StyleBoxEmpty_n2b1f") + +[node name="OptionButtonCaption" type="OptionButton" parent="VBoxContainer/字幕"] unique_name_in_owner = true layout_mode = 2 -focus_neighbor_top = NodePath("../../HBoxContainer6/OptionButtonLanguage") +focus_neighbor_top = NodePath("../../对话音量/HSliderDialogBus") +focus_neighbor_bottom = NodePath("../../自动保存/AutoSaveCheckBox") +theme_override_fonts/font = ExtResource("6_n2b1f") +theme_override_font_sizes/font_size = 11 +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="HSeparator4" type="HSeparator" parent="VBoxContainer"] +layout_mode = 2 + +[node name="自动保存" type="HBoxContainer" parent="VBoxContainer"] +layout_mode = 2 + +[node name="AutoSaveCheckBox" type="CheckBox" parent="VBoxContainer/自动保存"] +unique_name_in_owner = true +layout_mode = 2 +focus_neighbor_top = NodePath("../../语言/OptionButtonLanguage") focus_neighbor_right = NodePath("../SaveTimeLineEdit") -focus_neighbor_bottom = NodePath("../../GridContainer/FullscreenBox") +focus_neighbor_bottom = NodePath("../../显示方式/FullscreenBox") focus_next = NodePath("../SaveTimeLineEdit") +theme_override_fonts/font = ExtResource("6_n2b1f") +theme_override_font_sizes/font_size = 11 text = "setting_自动保存" -[node name="SaveTimeLineEdit" type="LineEdit" parent="PanelContainer/VBoxContainer/HBoxContainer4"] +[node name="SaveTimeLineEdit" type="LineEdit" parent="VBoxContainer/自动保存"] unique_name_in_owner = true layout_mode = 2 +size_flags_horizontal = 10 focus_neighbor_left = NodePath("../AutoSaveCheckBox") -focus_neighbor_top = NodePath("../../HBoxContainer6/OptionButtonLanguage") -focus_neighbor_bottom = NodePath("../../GridContainer/FullscreenBox") -focus_next = NodePath("../../GridContainer/FullscreenBox") +focus_neighbor_top = NodePath("../../语言/OptionButtonLanguage") +focus_neighbor_bottom = NodePath("../../显示方式/FullscreenBox") +focus_next = NodePath("../../显示方式/FullscreenBox") max_length = 5 caret_blink = true -[node name="Label" type="Label" parent="PanelContainer/VBoxContainer/HBoxContainer4"] +[node name="Label" type="Label" parent="VBoxContainer/自动保存"] layout_mode = 2 +size_flags_horizontal = 8 +theme_override_fonts/font = ExtResource("6_n2b1f") +theme_override_font_sizes/font_size = 11 text = "ui_秒" -[node name="GridContainer" type="GridContainer" parent="PanelContainer/VBoxContainer"] +[node name="显示方式" type="GridContainer" parent="VBoxContainer"] custom_minimum_size = Vector2(0, 32) layout_mode = 2 -size_flags_horizontal = 4 columns = 2 -[node name="FullscreenBox" type="CheckBox" parent="PanelContainer/VBoxContainer/GridContainer"] +[node name="FullscreenBox" type="CheckBox" parent="VBoxContainer/显示方式"] unique_name_in_owner = true layout_mode = 2 size_flags_horizontal = 4 -focus_neighbor_top = NodePath("../../HBoxContainer4/SaveTimeLineEdit") +focus_neighbor_top = NodePath("../../自动保存/SaveTimeLineEdit") focus_neighbor_right = NodePath("../TopBox") -focus_neighbor_bottom = NodePath("../../HBoxContainer3/IndexBtn") focus_next = NodePath("../TopBox") -text = "setting_全屏游戏" +theme_override_fonts/font = ExtResource("6_n2b1f") +theme_override_font_sizes/font_size = 11 +text = "setting_全屏" -[node name="TopBox" type="CheckBox" parent="PanelContainer/VBoxContainer/GridContainer"] +[node name="TopBox" type="CheckBox" parent="VBoxContainer/显示方式"] unique_name_in_owner = true layout_mode = 2 -size_flags_horizontal = 4 +size_flags_horizontal = 10 focus_neighbor_left = NodePath("../FullscreenBox") -focus_neighbor_top = NodePath("../../HBoxContainer4/SaveTimeLineEdit") -focus_neighbor_bottom = NodePath("../../HBoxContainer3/ExitBtn") -focus_next = NodePath("../../HBoxContainer3/IndexBtn") +focus_neighbor_top = NodePath("../../自动保存/SaveTimeLineEdit") +focus_neighbor_bottom = NodePath("../../ReturnBtn") focus_previous = NodePath("../FullscreenBox") -text = "setting_窗口置顶" +theme_override_fonts/font = ExtResource("6_n2b1f") +theme_override_font_sizes/font_size = 11 +text = "setting_置顶" -[node name="HSeparator3" type="HSeparator" parent="PanelContainer/VBoxContainer"] -visible = false +[node name="HSeparator3" type="HSeparator" parent="VBoxContainer"] layout_mode = 2 -[node name="HBoxContainer3" type="HBoxContainer" parent="PanelContainer/VBoxContainer"] -visible = false -custom_minimum_size = Vector2(0, 35) -layout_mode = 2 - -[node name="IndexBtn" type="Button" parent="PanelContainer/VBoxContainer/HBoxContainer3"] +[node name="ReturnBtn" type="Button" parent="VBoxContainer"] unique_name_in_owner = true layout_mode = 2 size_flags_horizontal = 6 size_flags_vertical = 4 -focus_neighbor_top = NodePath("../../GridContainer/FullscreenBox") -focus_neighbor_right = NodePath("../ExitBtn") -focus_next = NodePath("../ExitBtn") -focus_previous = NodePath("../../GridContainer/TopBox") -text = "setting_主界面" - -[node name="ExitBtn" type="Button" parent="PanelContainer/VBoxContainer/HBoxContainer3"] -unique_name_in_owner = true -layout_mode = 2 -size_flags_horizontal = 6 -size_flags_vertical = 4 -focus_neighbor_left = NodePath("../IndexBtn") -focus_neighbor_top = NodePath("../../GridContainer/TopBox") -focus_previous = NodePath("../IndexBtn") -text = "setting_退出" +focus_neighbor_top = NodePath("../显示方式/TopBox") +focus_previous = NodePath("../显示方式/TopBox") +theme_override_fonts/font = ExtResource("6_n2b1f") +theme_override_font_sizes/font_size = 11 +text = "setting_返回"