启动界面增加语言设置选项; 盒子猫二楼猪头怪bug
This commit is contained in:
parent
3ca0437651
commit
bc7c73ba69
BIN
asset/art/ui/index/佩戴耳机提示_下方无字.png
Normal file
BIN
asset/art/ui/index/佩戴耳机提示_下方无字.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 16 KiB |
34
asset/art/ui/index/佩戴耳机提示_下方无字.png.import
Normal file
34
asset/art/ui/index/佩戴耳机提示_下方无字.png.import
Normal file
@ -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
|
@ -19,6 +19,7 @@ setting_置顶,窗口置顶,,,,,Always on Top
|
|||||||
setting_自动保存,自动保存,,,,,Auto Save
|
setting_自动保存,自动保存,,,,,Auto Save
|
||||||
ui_秒,秒,,,,,seconds
|
ui_秒,秒,,,,,seconds
|
||||||
setting_返回,返回,,,,,Back
|
setting_返回,返回,,,,,Back
|
||||||
|
setting_确认,确认,,,,,Confirm
|
||||||
bag_tab_笔记,线索,,,,,Clues
|
bag_tab_笔记,线索,,,,,Clues
|
||||||
bag_tab_物品,物件,,,,,Items
|
bag_tab_物品,物件,,,,,Items
|
||||||
bag_tab_记忆,记忆,,,,,Memories
|
bag_tab_记忆,记忆,,,,,Memories
|
||||||
|
|
@ -10,6 +10,7 @@
|
|||||||
返回主菜单 [ID:ux_panel_返回主菜单]
|
返回主菜单 [ID:ux_panel_返回主菜单]
|
||||||
退出游戏 [ID:ux_panel_退出游戏]
|
退出游戏 [ID:ux_panel_退出游戏]
|
||||||
|
|
||||||
|
|
||||||
总音量[ID:setting_总音量]
|
总音量[ID:setting_总音量]
|
||||||
音效音量[ID:setting_音效音量]
|
音效音量[ID:setting_音效音量]
|
||||||
对话音量[ID:setting_对话音量]
|
对话音量[ID:setting_对话音量]
|
||||||
@ -22,6 +23,7 @@
|
|||||||
自动保存[ID:setting_自动保存]
|
自动保存[ID:setting_自动保存]
|
||||||
秒 [ID:ui_秒]
|
秒 [ID:ui_秒]
|
||||||
返回[ID:setting_返回]
|
返回[ID:setting_返回]
|
||||||
|
确认[ID:setting_确认]
|
||||||
|
|
||||||
|
|
||||||
线索[ID:bag_tab_笔记]
|
线索[ID:bag_tab_笔记]
|
||||||
|
@ -56,6 +56,7 @@ signal auto_save_seconds_changed
|
|||||||
@export var debug_mode := false # 开启 debug 模式
|
@export var debug_mode := false # 开启 debug 模式
|
||||||
@export var skip_trailer := false # 跳过 trailer
|
@export var skip_trailer := false # 跳过 trailer
|
||||||
@export var version: int #存档版本
|
@export var version: int #存档版本
|
||||||
|
@export var game_launched_times := 0 # 启动游戏次数
|
||||||
@export var game_total_seconds := 0 # 游戏总时长
|
@export var game_total_seconds := 0 # 游戏总时长
|
||||||
@export var game_rounds := 1 # 当前周目数
|
@export var game_rounds := 1 # 当前周目数
|
||||||
@export var current_selected_archive_id := -1: # 当前选定存档, -1 为未选择
|
@export var current_selected_archive_id := -1: # 当前选定存档, -1 为未选择
|
||||||
@ -79,9 +80,8 @@ signal auto_save_seconds_changed
|
|||||||
@export var db_dialog := linear_to_db(0.7) + Settings.dialog_db_offset
|
@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
|
@export var db_game_sfx := linear_to_db(0.7) + Settings.sfx_db_offset
|
||||||
# language
|
# language
|
||||||
# -1 null; 0 zh; 2 en
|
# -1 null; 0 zh; 1 en
|
||||||
@export var language := 0
|
@export var language := 0
|
||||||
# zh: 0 _SH, 1 _CN; en: [null];
|
|
||||||
@export var caption := 0
|
@export var caption := 0
|
||||||
# 最大范围为 10 秒,精度 0.1
|
# 最大范围为 10 秒,精度 0.1
|
||||||
@export var os_wait_time := 3.0
|
@export var os_wait_time := 3.0
|
||||||
|
@ -44,26 +44,42 @@ func _set_config(val: GlobalConfig) -> void:
|
|||||||
update_locale(config.language, config.caption)
|
update_locale(config.language, config.caption)
|
||||||
|
|
||||||
|
|
||||||
func update_locale(lang_id: int, caption_id: int):
|
# -1 null; 0 zh; 1 en
|
||||||
# -1 null; 0 zh; 2 en
|
var language_options = ["中文", "English"]
|
||||||
# var lang_id = language_options.selected
|
var caption_options_dict = {0: ["简体中文", "上海话"], 1: [""]}
|
||||||
# zh: 0 _SH, 1 _CN; en: [null];
|
var caption_loacles_dict = {0: ["zh_CN", "zh_SH"], 1: ["en"]}
|
||||||
# var caption_id = caption_options.selected
|
|
||||||
var lang = ""
|
|
||||||
match lang_id:
|
# return example: "中文_简体中文" "English_"
|
||||||
0:
|
func update_locale(lang_id: int, caption_id: int) -> void:
|
||||||
if caption_id == 0:
|
lang_id = wrapi(lang_id, 0, language_options.size())
|
||||||
lang = "zh_SH"
|
var caption_loacles = caption_loacles_dict.get(lang_id)
|
||||||
elif caption_id == 1:
|
caption_id = wrapi(caption_id, 0, caption_loacles.size())
|
||||||
lang = "zh_CN"
|
var lang = caption_loacles[caption_id]
|
||||||
1:
|
|
||||||
lang = "en"
|
|
||||||
GlobalConfigManager.config.language = lang_id
|
GlobalConfigManager.config.language = lang_id
|
||||||
GlobalConfigManager.config.caption = caption_id
|
GlobalConfigManager.config.caption = caption_id
|
||||||
print("set language to: ", lang)
|
print("set language to: ", lang)
|
||||||
TranslationServer.set_locale(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
|
var _on_timer_timeout_counter := 0
|
||||||
|
|
||||||
|
|
||||||
|
@ -28,7 +28,7 @@ func knock_light_door():
|
|||||||
boss = get_node_or_null("../DeployLayer/追猫猪头怪_右侧")
|
boss = get_node_or_null("../DeployLayer/追猫猪头怪_右侧")
|
||||||
if boss:
|
if boss:
|
||||||
boss.allow_restart_game = false
|
boss.allow_restart_game = false
|
||||||
boss = get_node_or_null("追猫猪头怪_传送")
|
boss = get_node_or_null("../DeployLayer/追猫猪头怪_传送")
|
||||||
if boss:
|
if boss:
|
||||||
boss.allow_restart_game = false
|
boss.allow_restart_game = false
|
||||||
do_knock_light_door.call_deferred()
|
do_knock_light_door.call_deferred()
|
||||||
|
@ -8,9 +8,16 @@ const dialog_db_offset := -10.0
|
|||||||
@onready var master_bus_slider = %HSliderMasterBus as HSlider
|
@onready var master_bus_slider = %HSliderMasterBus as HSlider
|
||||||
@onready var sfx_bus_slider = %HSliderSfxBus as HSlider
|
@onready var sfx_bus_slider = %HSliderSfxBus as HSlider
|
||||||
@onready var dialog_bus_slider = %HSliderDialogBus 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 lang_label = %LangLabel as Label
|
||||||
@onready var caption_options = %OptionButtonCaption as OptionButton
|
@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_auto_end = %OSAutoEnd as CheckBox
|
||||||
@onready var os_wait_time_box = %OSWaitTimeBox as BoxContainer
|
@onready var os_wait_time_box = %OSWaitTimeBox as BoxContainer
|
||||||
@onready var h_slider_os_wait_time = %HSliderOSWaitTime as HSlider
|
@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)
|
master_bus_slider.value_changed.connect(_on_master_bus_slider_value_changed)
|
||||||
sfx_bus_slider.value_changed.connect(_on_sfx_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)
|
dialog_bus_slider.value_changed.connect(_on_dialog_bus_slider_value_changed)
|
||||||
# language
|
# language & caption
|
||||||
language_options.selected = GlobalConfigManager.config.language
|
lang_left_btn.pressed.connect(_on_lang_left_btn_pressed)
|
||||||
language_options.item_selected.connect(_on_language_or_caption_options_selected)
|
lang_right_btn.pressed.connect(_on_lang_right_btn_pressed)
|
||||||
# caption
|
caption_left_btn.pressed.connect(_on_caption_left_btn_pressed)
|
||||||
caption_options.selected = GlobalConfigManager.config.caption
|
caption_right_btn.pressed.connect(_on_caption_right_btn_pressed)
|
||||||
caption_options.item_selected.connect(_on_language_or_caption_options_selected)
|
# setup language & caption
|
||||||
# setup language
|
lang_label.text = GlobalConfigManager.get_locale_language_name()
|
||||||
_on_language_or_caption_options_selected()
|
caption_label.text = GlobalConfigManager.get_locale_caption_name()
|
||||||
|
caption_box.visible = caption_label.text != ""
|
||||||
# os auto finish
|
# os auto finish
|
||||||
os_auto_end.button_pressed = GlobalConfigManager.config.os_auto_end
|
os_auto_end.button_pressed = GlobalConfigManager.config.os_auto_end
|
||||||
os_auto_end.toggled.connect(_on_os_auto_end_toggled)
|
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)
|
AudioServer.set_bus_volume_db(AudioServer.get_bus_index("dialog"), db_value)
|
||||||
|
|
||||||
|
|
||||||
func _on_language_or_caption_options_selected(_id = null) -> void:
|
func _on_lang_left_btn_pressed() -> void:
|
||||||
# -1 null; 0 zh; 2 en
|
GlobalConfigManager.update_locale(
|
||||||
var lang_id = language_options.selected
|
GlobalConfigManager.config.language - 1, GlobalConfigManager.config.caption
|
||||||
# zh: 0 _CN, _SH; en: [null];
|
)
|
||||||
var caption_id = caption_options.selected
|
lang_label.text = GlobalConfigManager.get_locale_language_name()
|
||||||
if lang_id != 0:
|
caption_label.text = GlobalConfigManager.get_locale_caption_name()
|
||||||
caption_box.hide()
|
caption_box.visible = caption_label.text != ""
|
||||||
language_options.focus_neighbor_bottom = os_auto_end.get_path()
|
|
||||||
os_auto_end.focus_neighbor_top = language_options.get_path()
|
|
||||||
else:
|
func _on_lang_right_btn_pressed() -> void:
|
||||||
caption_box.show()
|
GlobalConfigManager.update_locale(
|
||||||
language_options.focus_neighbor_bottom = caption_options.get_path()
|
GlobalConfigManager.config.language + 1, GlobalConfigManager.config.caption
|
||||||
os_auto_end.focus_neighbor_top = caption_options.get_path()
|
)
|
||||||
GlobalConfigManager.update_locale(lang_id, caption_id)
|
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:
|
func _on_os_auto_end_toggled(is_pressed: bool) -> void:
|
||||||
|
@ -156,11 +156,31 @@ layout_mode = 2
|
|||||||
theme_override_constants/separation = 31
|
theme_override_constants/separation = 31
|
||||||
theme_override_styles/separator = SubResource("StyleBoxEmpty_n2b1f")
|
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
|
unique_name_in_owner = true
|
||||||
layout_mode = 2
|
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_top = NodePath("../../对话音量/HSliderDialogBus")
|
||||||
focus_neighbor_bottom = NodePath("../../字幕/OptionButtonCaption")
|
focus_neighbor_bottom = NodePath("../../CaptionBox/OptionButtonCaption")
|
||||||
selected = 0
|
selected = 0
|
||||||
allow_reselect = true
|
allow_reselect = true
|
||||||
item_count = 2
|
item_count = 2
|
||||||
@ -169,23 +189,24 @@ popup/item_0/id = 0
|
|||||||
popup/item_1/text = "English"
|
popup/item_1/text = "English"
|
||||||
popup/item_1/id = 2
|
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
|
unique_name_in_owner = true
|
||||||
layout_mode = 2
|
layout_mode = 2
|
||||||
size_flags_horizontal = 4
|
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)
|
custom_minimum_size = Vector2(50, 0)
|
||||||
layout_mode = 2
|
layout_mode = 2
|
||||||
text = "setting_字幕"
|
text = "setting_字幕"
|
||||||
|
|
||||||
[node name="VSeparator" type="VSeparator" parent="MarginContainer/VBoxContainer/字幕"]
|
[node name="VSeparator" type="VSeparator" parent="MarginContainer/VBoxContainer/CaptionBox"]
|
||||||
layout_mode = 2
|
layout_mode = 2
|
||||||
theme_override_constants/separation = 31
|
theme_override_constants/separation = 31
|
||||||
theme_override_styles/separator = SubResource("StyleBoxEmpty_n2b1f")
|
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
|
unique_name_in_owner = true
|
||||||
|
visible = false
|
||||||
layout_mode = 2
|
layout_mode = 2
|
||||||
focus_neighbor_top = NodePath("../../语言/OptionButtonLanguage")
|
focus_neighbor_top = NodePath("../../语言/OptionButtonLanguage")
|
||||||
focus_neighbor_bottom = NodePath("../../OSAutoEnd")
|
focus_neighbor_bottom = NodePath("../../OSAutoEnd")
|
||||||
@ -197,6 +218,25 @@ popup/item_0/id = 1
|
|||||||
popup/item_1/text = "普通话"
|
popup/item_1/text = "普通话"
|
||||||
popup/item_1/id = 0
|
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"]
|
[node name="HSeparator2" type="HSeparator" parent="MarginContainer/VBoxContainer"]
|
||||||
visible = false
|
visible = false
|
||||||
layout_mode = 2
|
layout_mode = 2
|
||||||
@ -205,7 +245,7 @@ layout_mode = 2
|
|||||||
unique_name_in_owner = true
|
unique_name_in_owner = true
|
||||||
layout_mode = 2
|
layout_mode = 2
|
||||||
size_flags_horizontal = 4
|
size_flags_horizontal = 4
|
||||||
focus_neighbor_top = NodePath("../字幕/OptionButtonCaption")
|
focus_neighbor_top = NodePath("../CaptionBox/OptionButtonCaption")
|
||||||
focus_neighbor_bottom = NodePath("../OSWaitTimeBox/HSliderOSWaitTime")
|
focus_neighbor_bottom = NodePath("../OSWaitTimeBox/HSliderOSWaitTime")
|
||||||
text = "setting_气泡文字自动结束"
|
text = "setting_气泡文字自动结束"
|
||||||
|
|
||||||
|
101
scene/trailer.gd
101
scene/trailer.gd
@ -4,21 +4,112 @@ extends Control
|
|||||||
@onready var mask = $"遮罩"
|
@onready var mask = $"遮罩"
|
||||||
@onready var earplug_notice = $"耳机提示"
|
@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 packed_index_page := preload("res://scene/index_page.tscn")
|
||||||
|
|
||||||
|
var first_launching_game := true
|
||||||
|
|
||||||
|
|
||||||
func _ready() -> void:
|
func _ready() -> void:
|
||||||
if GlobalConfigManager.config and GlobalConfigManager.config.skip_trailer:
|
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)
|
SceneManager.checkout_index_page(false)
|
||||||
return
|
return
|
||||||
video_player.play()
|
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
|
mask.visible = true
|
||||||
earplug_notice.visible = true
|
earplug_notice.visible = true
|
||||||
earplug_notice.modulate.a = 0
|
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()
|
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)
|
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)
|
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()
|
||||||
|
@ -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="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="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"]
|
[node name="Trailer" type="Control"]
|
||||||
layout_mode = 3
|
layout_mode = 3
|
||||||
@ -13,6 +19,12 @@ grow_horizontal = 2
|
|||||||
grow_vertical = 2
|
grow_vertical = 2
|
||||||
script = ExtResource("1_tess7")
|
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="."]
|
[node name="VideoStreamPlayer" type="VideoStreamPlayer" parent="."]
|
||||||
layout_mode = 1
|
layout_mode = 1
|
||||||
anchors_preset = 15
|
anchors_preset = 15
|
||||||
@ -36,13 +48,135 @@ grow_vertical = 2
|
|||||||
color = Color(0, 0, 0, 1)
|
color = Color(0, 0, 0, 1)
|
||||||
|
|
||||||
[node name="耳机提示" type="TextureRect" parent="."]
|
[node name="耳机提示" type="TextureRect" parent="."]
|
||||||
visible = false
|
|
||||||
layout_mode = 1
|
layout_mode = 1
|
||||||
anchors_preset = 15
|
anchors_preset = 15
|
||||||
anchor_right = 1.0
|
anchor_right = 1.0
|
||||||
anchor_bottom = 1.0
|
anchor_bottom = 1.0
|
||||||
grow_horizontal = 2
|
grow_horizontal = 2
|
||||||
grow_vertical = 2
|
grow_vertical = 2
|
||||||
texture = ExtResource("3_8aq0n")
|
texture = ExtResource("3_a6l8g")
|
||||||
expand_mode = 1
|
expand_mode = 1
|
||||||
stretch_mode = 5
|
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_确认"
|
||||||
|
Loading…
Reference in New Issue
Block a user