diff --git a/autoload/script/global.gd b/autoload/script/global.gd new file mode 100644 index 0000000..51e15d4 --- /dev/null +++ b/autoload/script/global.gd @@ -0,0 +1,31 @@ +extends Node +var texture_json_path:String="res://json/texture.json" +var texture_data:Dictionary +var card_json_path:String="res://json/card.json" +var card_data:Dictionary +var script_json_path:String="res://json/script.json" +var script_data:Dictionary +func _ready() -> void: + load_texture_data() + load_script_data() +func load_texture_data(): + var file=FileAccess.open(texture_json_path,FileAccess.READ) + var str=file.get_as_text() + var dictionary:Dictionary=JSON.parse_string(str) + for i in dictionary.keys(): + var texture=load(dictionary[i]) + if texture is Texture2D: + dictionary[i]=texture + texture_data=dictionary +func load_script_data(): + var file=FileAccess.open(script_json_path,FileAccess.READ) + var str=file.get_as_text() + var dictionary:Dictionary=JSON.parse_string(str) + for i in dictionary.keys(): + dictionary[i]["id"]=i + script_data=dictionary +func get_texture(id:String): + if texture_data.has(id): + return texture_data[id] + else: + return null diff --git a/autoload/tscn/global.tscn b/autoload/tscn/global.tscn new file mode 100644 index 0000000..b4b3e43 --- /dev/null +++ b/autoload/tscn/global.tscn @@ -0,0 +1,6 @@ +[gd_scene load_steps=2 format=3 uid="uid://ci7reu1dfp0os"] + +[ext_resource type="Script" path="res://autoload/script/global.gd" id="1_vfs8x"] + +[node name="Global" type="Node"] +script = ExtResource("1_vfs8x") diff --git a/class/tool/DrawerContainer.gd b/class/tool/DrawerContainer.gd index 2e6d3d6..201778c 100644 --- a/class/tool/DrawerContainer.gd +++ b/class/tool/DrawerContainer.gd @@ -155,10 +155,10 @@ func fit_children()->void: fit_child_in_rect(i,rect) ##更改窗口的开闭状态,使用动画 -func change_open(): +func change_open(opened:bool=false): if now_keep_tween!=null: now_keep_tween.kill() - if is_open: + if !opened: if is_auto_hide: hide_timer.start(animation_time) pass @@ -172,7 +172,7 @@ func change_open(): if is_auto_hide: show() hide_timer.stop() - is_open=!is_open + is_open=opened diff --git a/json/card.json b/json/card.json new file mode 100644 index 0000000..36a3713 --- /dev/null +++ b/json/card.json @@ -0,0 +1,3 @@ +{ + +} diff --git a/json/script.json b/json/script.json new file mode 100644 index 0000000..04dfa80 --- /dev/null +++ b/json/script.json @@ -0,0 +1,11 @@ +{ + "script_001":{ + + "name":"测试剧本001", + "texture":"texture_test", + "side_texture":"texture_test", + "introduction":"这是一个测试剧本", + "type":0 + } + +} diff --git a/json/texture.json b/json/texture.json new file mode 100644 index 0000000..1f06312 --- /dev/null +++ b/json/texture.json @@ -0,0 +1,3 @@ +{ + "texture_test":"res://test/texture/test_texture.png" +} diff --git a/project.godot b/project.godot index 16fb894..a3c2eb7 100644 --- a/project.godot +++ b/project.godot @@ -11,12 +11,14 @@ config_version=5 [application] config/name="剧本模拟器" +run/main_scene="res://scene/start_the_game.tscn" config/features=PackedStringArray("4.3", "Forward Plus") config/icon="res://icon.svg" [autoload] PopUpWindow="*res://addons/popupwindow/PopUpWindow.tscn" +Global="*res://autoload/tscn/global.tscn" [display] diff --git a/scene/basic_message.tscn b/scene/basic_message.tscn index 61a447d..0f695ff 100644 --- a/scene/basic_message.tscn +++ b/scene/basic_message.tscn @@ -336,11 +336,12 @@ layout_mode = 2 size_flags_vertical = 3 size_flags_stretch_ratio = 939.0 theme_override_styles/panel = SubResource("StyleBoxEmpty_81i7t") -current_tab = 0 +current_tab = 4 clip_tabs = false tabs_visible = false [node name="basic_mes" type="MarginContainer" parent="VBoxContainer/TabContainer"] +visible = false layout_mode = 2 theme_override_constants/margin_right = 19 theme_override_constants/margin_bottom = 43 @@ -1621,7 +1622,6 @@ text = "9999" vertical_alignment = 1 [node name="skill_config" type="MarginContainer" parent="VBoxContainer/TabContainer"] -visible = false layout_mode = 2 theme_override_constants/margin_left = 54 theme_override_constants/margin_top = 8 diff --git a/scene/character_select.gd b/scene/character_select.gd new file mode 100644 index 0000000..237a609 --- /dev/null +++ b/scene/character_select.gd @@ -0,0 +1,21 @@ +extends Control +signal back +const CHARACTER_SELECT_CARD = preload("res://scene/character_select_card.tscn") +var data:Dictionary={ + +} +func _on_back_pressed() -> void: + back.emit() + pass # Replace with function body. + +func generate_debug_data(debug_size:int): + for i in debug_size: + var new_card_data={ + "id":"card"+str(i), + "texture":"texture_test", + + } + + + + pass diff --git a/scene/character_select.tscn b/scene/character_select.tscn index 2d152e3..266b775 100644 --- a/scene/character_select.tscn +++ b/scene/character_select.tscn @@ -1,6 +1,7 @@ -[gd_scene load_steps=11 format=3 uid="uid://b84kbwrjhux1m"] +[gd_scene load_steps=12 format=3 uid="uid://b84kbwrjhux1m"] [ext_resource type="Texture2D" uid="uid://eajqa3if8ibs" path="res://res/ui/ui_017_character_select/tuceng1.png" id="1_6lrgt"] +[ext_resource type="Script" path="res://scene/character_select.gd" id="1_tntvj"] [ext_resource type="Texture2D" uid="uid://ckxvlfayu5pli" path="res://res/ui/ui_016_warehouse/back.png" id="2_047wo"] [ext_resource type="Texture2D" uid="uid://oe22fkv267ao" path="res://res/ui/ui_017_character_select/tuceng270.png" id="3_e0iw6"] [ext_resource type="Texture2D" uid="uid://ejnvqpr11l2w" path="res://res/ui/ui_017_character_select/tuceng263.png" id="4_1n8q6"] @@ -18,6 +19,7 @@ anchor_right = 1.0 anchor_bottom = 1.0 grow_horizontal = 2 grow_vertical = 2 +script = ExtResource("1_tntvj") [node name="TextureRect" type="TextureRect" parent="."] layout_mode = 1 @@ -56,7 +58,7 @@ size_flags_horizontal = 0 size_flags_vertical = 0 texture = ExtResource("2_047wo") -[node name="ToolButton" parent="VBoxContainer/HBoxContainer/VBoxContainer/MarginContainer/TextureRect" instance=ExtResource("9_mkt3x")] +[node name="back" parent="VBoxContainer/HBoxContainer/VBoxContainer/MarginContainer/TextureRect" instance=ExtResource("9_mkt3x")] layout_mode = 1 [node name="TextureRect" type="TextureRect" parent="VBoxContainer/HBoxContainer/VBoxContainer"] @@ -190,3 +192,5 @@ vertical_alignment = 1 [node name="ToolButton" parent="VBoxContainer/HBoxContainer2/TextureRect" instance=ExtResource("9_mkt3x")] layout_mode = 1 + +[connection signal="pressed" from="VBoxContainer/HBoxContainer/VBoxContainer/MarginContainer/TextureRect/back" to="." method="_on_back_pressed"] diff --git a/scene/character_select_card.gd b/scene/character_select_card.gd index e726443..6d85f15 100644 --- a/scene/character_select_card.gd +++ b/scene/character_select_card.gd @@ -1,4 +1,5 @@ extends TextureRect + var is_selected:bool=false: set(val): if val!=is_selected: diff --git a/scene/difficulty_selection.gd b/scene/difficulty_selection.gd index 8798559..05f0f1e 100644 --- a/scene/difficulty_selection.gd +++ b/scene/difficulty_selection.gd @@ -1,5 +1,5 @@ extends Control - +signal back const JUXING_15 = preload("res://res/ui/ui_018_difficulty_selection/juxing15.png") @onready var t_button:Array[TextureButton]=[$CenterContainer/HBoxContainer/TextureRect, $CenterContainer/HBoxContainer/TextureRect2, $CenterContainer/HBoxContainer/TextureRect3] # Called when the node enters the scene tree for the first time. @@ -17,3 +17,8 @@ func _ready() -> void: # Called every frame. 'delta' is the elapsed time since the previous frame. func _process(delta: float) -> void: pass + + +func _on_back_pressed() -> void: + back.emit() + pass # Replace with function body. diff --git a/scene/difficulty_selection.tscn b/scene/difficulty_selection.tscn index 5cbfbf5..febb981 100644 --- a/scene/difficulty_selection.tscn +++ b/scene/difficulty_selection.tscn @@ -183,5 +183,7 @@ offset_bottom = 85.0 texture = ExtResource("1_fxlie") metadata/_edit_use_anchors_ = true -[node name="ToolButton" parent="TextureRect" instance=ExtResource("2_geis3")] +[node name="back" parent="TextureRect" instance=ExtResource("2_geis3")] layout_mode = 1 + +[connection signal="pressed" from="TextureRect/back" to="." method="_on_back_pressed"] diff --git a/scene/main.gd b/scene/main.gd new file mode 100644 index 0000000..4902822 --- /dev/null +++ b/scene/main.gd @@ -0,0 +1,21 @@ +extends Control + + +# Called when the node enters the scene tree for the first time. +func _ready() -> void: + pass # Replace with function body. + + +# Called every frame. 'delta' is the elapsed time since the previous frame. +func _process(delta: float) -> void: + pass + + +func _on_new_story_pressed() -> void: + $DrawerContainer.change_open(true) + pass # Replace with function body. + + +func _on_control_back() -> void: + $DrawerContainer.change_open(false) + pass # Replace with function body. diff --git a/scene/main.tscn b/scene/main.tscn index de25c09..12d4e53 100644 --- a/scene/main.tscn +++ b/scene/main.tscn @@ -1,5 +1,6 @@ -[gd_scene load_steps=33 format=3 uid="uid://bbsr3gcxo3lcl"] +[gd_scene load_steps=37 format=3 uid="uid://bbsr3gcxo3lcl"] +[ext_resource type="Script" path="res://scene/main.gd" id="1_aevx8"] [ext_resource type="Texture2D" uid="uid://bchvegwghynrm" path="res://res/ui/ui_002_main/tuceng1.png" id="1_q2tgu"] [ext_resource type="Texture2D" uid="uid://owkdlpx5thgc" path="res://res/ui/ui_002_main/tuceng439.png" id="2_revac"] [ext_resource type="Texture2D" uid="uid://b87pagjh2lvna" path="res://res/ui/ui_002_main/tuceng19.png" id="3_eyh3w"] @@ -31,6 +32,9 @@ [ext_resource type="Texture2D" uid="uid://cbhr2yxydexem" path="res://res/ui/ui_002_main/task.png" id="25_efhgu"] [ext_resource type="Texture2D" uid="uid://bpu1hoqam7gtv" path="res://res/ui/ui_002_main/tubiao8.png" id="26_sqj5u"] [ext_resource type="Texture2D" uid="uid://sooj5ptn2ejd" path="res://res/ui/ui_002_main/liuyantubiao.png" id="27_5uosb"] +[ext_resource type="Script" path="res://class/tool/DrawerContainer.gd" id="33_2nl8b"] +[ext_resource type="PackedScene" uid="uid://33lcg23hy4mi" path="res://scene/select.tscn" id="34_wkvs0"] +[ext_resource type="PackedScene" uid="uid://batc5tlfgbqm5" path="res://scene/banner.tscn" id="35_qckx8"] [sub_resource type="StyleBoxEmpty" id="StyleBoxEmpty_1b8r4"] @@ -41,6 +45,7 @@ anchor_right = 1.0 anchor_bottom = 1.0 grow_horizontal = 2 grow_vertical = 2 +script = ExtResource("1_aevx8") [node name="background" type="TextureRect" parent="."] layout_mode = 1 @@ -376,7 +381,7 @@ horizontal_alignment = 1 vertical_alignment = 1 metadata/_edit_use_anchors_ = true -[node name="ToolButton" parent="MarginContainer/HBoxContainer/VBoxContainer2/VBoxContainer/HBoxContainer/TextureRect" instance=ExtResource("17_37v8w")] +[node name="new_story" parent="MarginContainer/HBoxContainer/VBoxContainer2/VBoxContainer/HBoxContainer/TextureRect" instance=ExtResource("17_37v8w")] layout_mode = 1 [node name="tab" type="Control" parent="MarginContainer/HBoxContainer/VBoxContainer2/VBoxContainer/HBoxContainer"] @@ -604,3 +609,41 @@ layout_mode = 1 custom_minimum_size = Vector2(8, 0) layout_mode = 2 size_flags_horizontal = 8 + +[node name="DrawerContainer" type="Container" parent="."] +layout_mode = 1 +anchors_preset = 15 +anchor_right = 1.0 +anchor_bottom = 1.0 +grow_horizontal = 2 +grow_vertical = 2 +mouse_filter = 2 +script = ExtResource("33_2nl8b") +button_model = 2 +disable_button = true +animation_model = 8 +is_open = false +rag = 1.0 + +[node name="select" parent="DrawerContainer" instance=ExtResource("34_wkvs0")] +layout_mode = 2 + +[node name="DrawerContainer2" type="Container" parent="."] +layout_mode = 1 +anchors_preset = 15 +anchor_right = 1.0 +anchor_bottom = 1.0 +grow_horizontal = 2 +grow_vertical = 2 +mouse_filter = 2 +script = ExtResource("33_2nl8b") +disable_button = true +animation_model = 8 +is_open = false +rag = 1.0 + +[node name="banner" parent="DrawerContainer2" instance=ExtResource("35_qckx8")] +layout_mode = 2 + +[connection signal="pressed" from="MarginContainer/HBoxContainer/VBoxContainer2/VBoxContainer/HBoxContainer/TextureRect/new_story" to="." method="_on_new_story_pressed"] +[connection signal="back" from="DrawerContainer/select" to="." method="_on_control_back"] diff --git a/scene/select.gd b/scene/select.gd index 47b5b7f..de23ea2 100644 --- a/scene/select.gd +++ b/scene/select.gd @@ -4,6 +4,7 @@ var selected_button:Button signal enter_script(id:String) signal continue_script +signal back const SELECTED = preload("res://res/ui/ui_003_select/selected.tres") const UNSELECTED = preload("res://res/ui/ui_003_select/unselected.tres") const SELECT_BUTTON = preload("res://scene/select_button.tscn") @@ -133,6 +134,7 @@ func init_button_connection(): func _on_enter_button_pressed() -> void: enter_script.emit(now_selected_script_id) + $DrawerContainer.change_open(true) pass # Replace with function body. @@ -142,4 +144,15 @@ func _on_continue_button_pressed() -> void: func _on_back_button_pressed() -> void: + back.emit() + pass # Replace with function body. + + +func _on_character_select_back() -> void: + $DrawerContainer.change_open(false) + pass # Replace with function body. + + +func _on_difficulty_selection_back() -> void: + $DrawerContainer2.change_open(false) pass # Replace with function body. diff --git a/scene/select.tscn b/scene/select.tscn index 70baa42..e55c7fe 100644 --- a/scene/select.tscn +++ b/scene/select.tscn @@ -1,4 +1,4 @@ -[gd_scene load_steps=23 format=3 uid="uid://33lcg23hy4mi"] +[gd_scene load_steps=27 format=3 uid="uid://33lcg23hy4mi"] [ext_resource type="Script" path="res://scene/select.gd" id="1_cgnul"] [ext_resource type="Texture2D" uid="uid://li8e5ntlgcpg" path="res://res/ui/ui_003_select/test.png" id="3_jw1jl"] @@ -14,8 +14,12 @@ [ext_resource type="Texture2D" uid="uid://3j0a4ta8ww4y" path="res://res/ui/ui_003_select/xianshitubiao.png" id="12_qqyd6"] [ext_resource type="Texture2D" uid="uid://y03c11caxq5g" path="res://res/ui/ui_003_select/moshitubiao.png" id="13_06h8p"] [ext_resource type="Texture2D" uid="uid://cukrtaeu70hc5" path="res://res/ui/ui_003_select/jixutubiao.png" id="15_jcwu5"] +[ext_resource type="PackedScene" uid="uid://bdlo2wn4qnygv" path="res://scene/tool/tool_button.tscn" id="16_boe34"] +[ext_resource type="PackedScene" uid="uid://b84kbwrjhux1m" path="res://scene/character_select.tscn" id="17_cueqv"] +[ext_resource type="Script" path="res://class/tool/DrawerContainer.gd" id="18_qtiy2"] [ext_resource type="Texture2D" uid="uid://bt5qrcsynsp6j" path="res://res/ui/ui_004_character_bag/tuceng231.png" id="18_qwfod"] [ext_resource type="Texture2D" uid="uid://bdnuk1oe6bhjv" path="res://res/ui/ui_003_select/tuceng29.png" id="19_ubknp"] +[ext_resource type="PackedScene" uid="uid://c6ucq32jlpjd6" path="res://scene/difficulty_selection.tscn" id="20_168x8"] [sub_resource type="ShaderMaterial" id="ShaderMaterial_ly4bd"] resource_local_to_scene = true @@ -473,17 +477,18 @@ horizontal_alignment = 1 vertical_alignment = 1 metadata/_edit_use_anchors_ = true -[node name="back_button" type="Button" parent="."] +[node name="back_button" type="TextureRect" parent="."] layout_mode = 0 anchor_left = 0.00677083 anchor_top = 0.0138889 anchor_right = 0.0677083 anchor_bottom = 0.0833333 -offset_right = -8.0 -offset_bottom = -8.0 -focus_mode = 0 -icon = ExtResource("18_qwfod") -flat = true +offset_right = 6.10352e-05 +offset_bottom = 5.34058e-05 +texture = ExtResource("18_qwfod") + +[node name="ToolButton" parent="back_button" instance=ExtResource("16_boe34")] +layout_mode = 1 [node name="enter_texture" type="NinePatchRect" parent="."] unique_name_in_owner = true @@ -536,6 +541,42 @@ libraries = { "": SubResource("AnimationLibrary_8lk2v") } +[node name="DrawerContainer" type="Container" parent="."] +z_index = 1 +layout_mode = 1 +anchors_preset = 15 +anchor_right = 1.0 +anchor_bottom = 1.0 +grow_horizontal = 2 +grow_vertical = 2 +mouse_filter = 2 +script = ExtResource("18_qtiy2") +is_open = false +rag = 1.0 + +[node name="character_select" parent="DrawerContainer" instance=ExtResource("17_cueqv")] +layout_mode = 2 + +[node name="DrawerContainer2" type="Container" parent="."] +z_index = 1 +layout_mode = 1 +anchors_preset = 15 +anchor_right = 1.0 +anchor_bottom = 1.0 +grow_horizontal = 2 +grow_vertical = 2 +mouse_filter = 2 +script = ExtResource("18_qtiy2") +button_model = 2 +disable_button = true +is_open = false +rag = 1.0 + +[node name="difficulty_selection" parent="DrawerContainer2" instance=ExtResource("20_168x8")] +layout_mode = 2 + [connection signal="pressed" from="HBoxContainer/continue_texture/continue_button" to="." method="_on_continue_button_pressed"] -[connection signal="pressed" from="back_button" to="." method="_on_back_button_pressed"] +[connection signal="pressed" from="back_button/ToolButton" to="." method="_on_back_button_pressed"] [connection signal="pressed" from="enter_texture/enter_button" to="." method="_on_enter_button_pressed"] +[connection signal="back" from="DrawerContainer/character_select" to="." method="_on_character_select_back"] +[connection signal="back" from="DrawerContainer2/difficulty_selection" to="." method="_on_difficulty_selection_back"] diff --git a/test/texture/test_texture.png b/test/texture/test_texture.png new file mode 100644 index 0000000..eaf2910 Binary files /dev/null and b/test/texture/test_texture.png differ diff --git a/test/texture/test_texture.png.import b/test/texture/test_texture.png.import new file mode 100644 index 0000000..348a79d --- /dev/null +++ b/test/texture/test_texture.png.import @@ -0,0 +1,34 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://cla7m1ytnm1hj" +path="res://.godot/imported/test_texture.png-34f8d8674726712bb3ec7901b334924a.ctex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://test/texture/test_texture.png" +dest_files=["res://.godot/imported/test_texture.png-34f8d8674726712bb3ec7901b334924a.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