diff --git a/scene/basic_message.tscn b/scene/basic_message.tscn index 0790535..00eef5f 100644 --- a/scene/basic_message.tscn +++ b/scene/basic_message.tscn @@ -1,4 +1,4 @@ -[gd_scene load_steps=31 format=3 uid="uid://chh7gr3qbkr8u"] +[gd_scene load_steps=32 format=3 uid="uid://chh7gr3qbkr8u"] [ext_resource type="Script" path="res://scene/basic_message.gd" id="1_0470d"] [ext_resource type="Texture2D" uid="uid://dygka5vk5qdhs" path="res://res/ui/ui_005_basic_message/图层 2.png" id="1_vhe21"] @@ -20,6 +20,7 @@ [ext_resource type="Texture2D" uid="uid://i155mvisr7dv" path="res://res/ui/ui_007_interpersonal_relationship/图层147.png" id="16_w11hg"] [ext_resource type="Texture2D" uid="uid://b2yujmwh3dmbk" path="res://res/ui/ui_007_interpersonal_relationship/图层146.png" id="17_wsayg"] [ext_resource type="Texture2D" uid="uid://cof6sk14yden1" path="res://res/ui/ui_007_interpersonal_relationship/图层148.png" id="18_4wxn4"] +[ext_resource type="Texture2D" uid="uid://4vh7r32sndeq" path="res://res/ui/ui_005_basic_message/图层230.png" id="21_boe0q"] [sub_resource type="StyleBoxTexture" id="StyleBoxTexture_7cm0j"] texture = ExtResource("2_u0tfq") @@ -286,12 +287,11 @@ layout_mode = 2 size_flags_vertical = 3 size_flags_stretch_ratio = 939.0 theme_override_styles/panel = SubResource("StyleBoxEmpty_81i7t") -current_tab = 1 +current_tab = 0 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 @@ -1107,6 +1107,7 @@ vertical_alignment = 1 metadata/_edit_use_anchors_ = true [node name="special_ability" type="MarginContainer" parent="VBoxContainer/TabContainer"] +visible = false layout_mode = 2 theme_override_constants/margin_left = 54 theme_override_constants/margin_top = 8 @@ -1283,6 +1284,7 @@ size_flags_stretch_ratio = 344.0 theme_override_styles/panel = SubResource("StyleBoxTexture_5dran") [node name="TextureRect" type="TextureRect" parent="VBoxContainer/TabContainer/interpersonal_relationship/VBoxContainer/Panel2"] +layout_mode = 0 offset_top = 5.0 offset_right = 287.0 offset_bottom = 78.0 @@ -1347,3 +1349,14 @@ theme_override_font_sizes/font_size = 46 text = "角色姓名" vertical_alignment = 1 metadata/_edit_use_anchors_ = true + +[node name="back_button" type="Button" parent="."] +layout_mode = 0 +anchor_left = 0.00677083 +anchor_top = 0.0138889 +anchor_right = 0.0635417 +anchor_bottom = 0.0759259 +focus_mode = 0 +icon = ExtResource("21_boe0q") +flat = true +metadata/_edit_use_anchors_ = true diff --git a/scene/select.gd b/scene/select.gd index b037b5e..47b5b7f 100644 --- a/scene/select.gd +++ b/scene/select.gd @@ -1,30 +1,145 @@ extends Control -@onready var selected_button:Button=$VBoxContainer/Button1 -@onready var btn_group:Array[Button]=[$VBoxContainer/Button1, $VBoxContainer/Button2, $VBoxContainer/Button3, $VBoxContainer/Button4, $VBoxContainer/Button5, $VBoxContainer/Button6] +var selected_button:Button +@onready var btn_group:Array[Button]=[] + +signal enter_script(id:String) +signal continue_script const SELECTED = preload("res://res/ui/ui_003_select/selected.tres") const UNSELECTED = preload("res://res/ui/ui_003_select/unselected.tres") -# Called when the node enters the scene tree for the first time. +const SELECT_BUTTON = preload("res://scene/select_button.tscn") + +var data:Dictionary={ + "history":[ + ], + "fantasy":[ + ], + "reality":[ + ], + "eschatological":[ + + ], + "continue":{ + + } +} +var now_selected_script:String="history" +var now_selected_script_id:String func _ready() -> void: - pass # Replace with function body. - - + init_button_connection() + generate_debug_data(20) + load_now_script() +func load_now_script(): + btn_group.clear() + for i in %btn_add_pos.get_children(): + i.queue_free() + var now_select_array:Array=data[now_selected_script] + for i in now_select_array.size(): + var new_btn=SELECT_BUTTON.instantiate() + new_btn.id=now_select_array[i]["id"] + %btn_add_pos.add_child(new_btn) + new_btn.set_texture(load(now_select_array[i]["btn_texture"])) + new_btn.pressed.connect(side_btn_clicked.bind(i)) + btn_group.append(new_btn) + side_btn_clicked(0) + %btn_scroll.set_deferred("scroll_vertical", 0) # Called every frame. 'delta' is the elapsed time since the previous frame. func _process(delta: float) -> void: pass func side_btn_clicked(ind:int): - selected_button.add_theme_stylebox_override("normal",UNSELECTED) - selected_button.add_theme_stylebox_override("pressed",UNSELECTED) - selected_button.add_theme_stylebox_override("hover",UNSELECTED) - selected_button.add_theme_stylebox_override("hover_pressed",UNSELECTED) - var tween = get_tree().create_tween() - tween.tween_property(selected_button, "custom_minimum_size:x", 320, 0.1) - selected_button.z_index-=1 - btn_group[ind].add_theme_stylebox_override("normal",SELECTED) - btn_group[ind].add_theme_stylebox_override("pressed",SELECTED) - btn_group[ind].add_theme_stylebox_override("hover",SELECTED) - btn_group[ind].add_theme_stylebox_override("hover_pressed",SELECTED) - btn_group[ind].z_index+=1 - var tween2= get_tree().create_tween() - tween2.tween_property(btn_group[ind], "custom_minimum_size:x", 385, 0.1) - selected_button=btn_group[ind] + var btn=btn_group[ind] + + if btn!=selected_button: + if selected_button!=null: + selected_button.is_selected=false + btn.is_selected=true + selected_button=btn + var now_select_array:Array=data[now_selected_script] + set_script_texture(load(now_select_array[ind]["texture"])) + %script_name.text=now_select_array[ind]["name"] + %script_introduction.text=now_select_array[ind]["introduction"] + now_selected_script_id=btn.id + print(btn.id) pass +func generate_debug_data(debug_size:int): + var arr=[[],[],[],[]] + for i in debug_size: + arr[0].append({ + "name":"历史测试剧本"+str(i), + "id":"history"+str(i), + "introduction":"历史测试剧本"+str(i)+"介绍测试", + "btn_texture":"res://res/ui/ui_003_select/test.png", + "texture":"res://res/ui/ui_003_select/test.png" + }) + arr[1].append({ + "name":"奇幻测试剧本"+str(i), + "id":"fantasy"+str(i), + "introduction":"奇幻测试剧本"+str(i)+"介绍测试", + "btn_texture":"res://res/ui/ui_003_select/test.png", + "texture":"res://res/ui/ui_003_select/test.png" + }) + arr[2].append({ + "name":"现实测试剧本"+str(i), + "id":"reality"+str(i), + "introduction":"现实测试剧本"+str(i)+"介绍测试", + "btn_texture":"res://res/ui/ui_003_select/test.png", + "texture":"res://res/ui/ui_003_select/test.png" + }) + arr[3].append({ + "name":"末世测试剧本"+str(i), + "id":"eschatological"+str(i), + "introduction":"末世测试剧本"+str(i)+"介绍测试", + "btn_texture":"res://res/ui/ui_003_select/test.png", + "texture":"res://res/ui/ui_003_select/test.png" + }) + data={ + "history":arr[0], + "fantasy":arr[1], + "reality":arr[2], + "eschatological":arr[3], + } +func set_script_texture(texture:Texture2D): + %script_texture.texture=texture + %texture_animation.stop() + %texture_animation.play("open") + +func on_button_down(texture:Control) -> void: + texture.modulate=Color(0.5,0.5,0.5,1) + pass # Replace with function body. +func on_button_up(texture:Control) -> void: + texture.modulate=Color(1,1,1,1) + pass # Replace with function body. +func bottom_button_pressed(script_name:String): + if now_selected_script!=script_name: + now_selected_script=script_name + load_now_script() +func init_button_connection(): + %history_button.button_down.connect(on_button_down.bind(%history_texture)) + %fantasy_button.button_down.connect(on_button_down.bind(%fantasy_texture)) + %reality_button.button_down.connect(on_button_down.bind(%reality_texture)) + %eschatological_button.button_down.connect(on_button_down.bind(%eschatological_texture)) + %continue_button.button_down.connect(on_button_down.bind(%continue_texture)) + %history_button.button_up.connect(on_button_up.bind(%history_texture)) + %fantasy_button.button_up.connect(on_button_up.bind(%fantasy_texture)) + %reality_button.button_up.connect(on_button_up.bind(%reality_texture)) + %eschatological_button.button_up.connect(on_button_up.bind(%eschatological_texture)) + %continue_button.button_up.connect(on_button_up.bind(%continue_texture)) + %history_button.pressed.connect(bottom_button_pressed.bind("history")) + %fantasy_button.pressed.connect(bottom_button_pressed.bind("fantasy")) + %reality_button.pressed.connect(bottom_button_pressed.bind("reality")) + %eschatological_button.pressed.connect(bottom_button_pressed.bind("eschatological")) + %enter_button.button_down.connect(on_button_down.bind(%enter_texture)) + %enter_button.button_up.connect(on_button_up.bind(%enter_texture)) + + +func _on_enter_button_pressed() -> void: + enter_script.emit(now_selected_script_id) + pass # Replace with function body. + + +func _on_continue_button_pressed() -> void: + continue_script.emit() + pass # Replace with function body. + + +func _on_back_button_pressed() -> void: + pass # Replace with function body. diff --git a/scene/select.tscn b/scene/select.tscn index b94a89f..ff86724 100644 --- a/scene/select.tscn +++ b/scene/select.tscn @@ -1,12 +1,9 @@ -[gd_scene load_steps=24 format=3 uid="uid://33lcg23hy4mi"] +[gd_scene load_steps=23 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"] [ext_resource type="Texture2D" uid="uid://c6l3t83jiltjw" path="res://res/ui/ui_003_select/图层 1.png" id="3_yij7q"] -[ext_resource type="StyleBox" uid="uid://dyx7fisnfqmfx" path="res://res/ui/ui_003_select/selected.tres" id="4_7pqsv"] [ext_resource type="Shader" path="res://res/shader/blur.gdshader" id="4_dco75"] -[ext_resource type="StyleBox" uid="uid://criiod0onsrre" path="res://res/ui/ui_003_select/unselected.tres" id="5_f0q5x"] -[ext_resource type="Texture2D" uid="uid://bbfw824b7sexe" path="res://res/ui/ui_003_select/图层449.png" id="5_xaitc"] [ext_resource type="Texture2D" uid="uid://ncsff7bf6sni" path="res://res/ui/ui_003_select/图层25.png" id="8_6wknl"] [ext_resource type="Texture2D" uid="uid://nht4ovhe7xvy" path="res://res/ui/ui_003_select/图层 3.png" id="8_wqdui"] [ext_resource type="Texture2D" uid="uid://c2trkapa6c4p8" path="res://res/ui/ui_003_select/图层30.png" id="9_ke4j3"] @@ -23,11 +20,11 @@ [sub_resource type="ShaderMaterial" id="ShaderMaterial_ly4bd"] resource_local_to_scene = true shader = ExtResource("4_dco75") -shader_parameter/power = 0.8 +shader_parameter/power = 4.0 shader_parameter/up = 0.3 shader_parameter/down = 0.3 -shader_parameter/left = 0.3 -shader_parameter/right = 0.3 +shader_parameter/left = 1.0 +shader_parameter/right = 1.0 shader_parameter/up_clip = 0.0 shader_parameter/down_clip = 0.0 shader_parameter/left_clip = 0.0 @@ -41,8 +38,90 @@ colors = PackedColorArray(0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1) [sub_resource type="GradientTexture1D" id="GradientTexture1D_lyq3l"] gradient = SubResource("Gradient_k04ai") -[sub_resource type="StyleBoxTexture" id="StyleBoxTexture_gkr7a"] -texture = ExtResource("5_xaitc") +[sub_resource type="Animation" id="Animation_elxtp"] +resource_name = "open" +length = 0.4 +tracks/0/type = "value" +tracks/0/imported = false +tracks/0/enabled = true +tracks/0/path = NodePath("back/script_texture:material:shader_parameter/power") +tracks/0/interp = 2 +tracks/0/loop_wrap = true +tracks/0/keys = { +"times": PackedFloat32Array(0, 0.366667), +"transitions": PackedFloat32Array(1, 1), +"update": 0, +"values": [4.0, 0.8] +} +tracks/1/type = "value" +tracks/1/imported = false +tracks/1/enabled = true +tracks/1/path = NodePath("back/script_texture:material:shader_parameter/left") +tracks/1/interp = 1 +tracks/1/loop_wrap = true +tracks/1/keys = { +"times": PackedFloat32Array(0, 0.366667), +"transitions": PackedFloat32Array(1, 1), +"update": 0, +"values": [1.0, 0.3] +} +tracks/2/type = "value" +tracks/2/imported = false +tracks/2/enabled = true +tracks/2/path = NodePath("back/script_texture:material:shader_parameter/right") +tracks/2/interp = 1 +tracks/2/loop_wrap = true +tracks/2/keys = { +"times": PackedFloat32Array(0, 0.366667), +"transitions": PackedFloat32Array(1, 1), +"update": 0, +"values": [1.0, 0.3] +} + +[sub_resource type="Animation" id="Animation_icany"] +length = 0.001 +tracks/0/type = "value" +tracks/0/imported = false +tracks/0/enabled = true +tracks/0/path = NodePath("back/script_texture:material:shader_parameter/power") +tracks/0/interp = 1 +tracks/0/loop_wrap = true +tracks/0/keys = { +"times": PackedFloat32Array(0), +"transitions": PackedFloat32Array(1), +"update": 0, +"values": [4.0] +} +tracks/1/type = "value" +tracks/1/imported = false +tracks/1/enabled = true +tracks/1/path = NodePath("back/script_texture:material:shader_parameter/left") +tracks/1/interp = 1 +tracks/1/loop_wrap = true +tracks/1/keys = { +"times": PackedFloat32Array(0), +"transitions": PackedFloat32Array(1), +"update": 0, +"values": [1.0] +} +tracks/2/type = "value" +tracks/2/imported = false +tracks/2/enabled = true +tracks/2/path = NodePath("back/script_texture:material:shader_parameter/right") +tracks/2/interp = 1 +tracks/2/loop_wrap = true +tracks/2/keys = { +"times": PackedFloat32Array(0), +"transitions": PackedFloat32Array(1), +"update": 0, +"values": [1.0] +} + +[sub_resource type="AnimationLibrary" id="AnimationLibrary_8lk2v"] +_data = { +"RESET": SubResource("Animation_icany"), +"open": SubResource("Animation_elxtp") +} [node name="Control" type="Control"] layout_mode = 3 @@ -64,7 +143,8 @@ texture = ExtResource("3_yij7q") expand_mode = 1 stretch_mode = 6 -[node name="icon" type="TextureRect" parent="back"] +[node name="script_texture" type="TextureRect" parent="back"] +unique_name_in_owner = true z_index = 1 material = SubResource("ShaderMaterial_ly4bd") layout_mode = 2 @@ -79,7 +159,7 @@ expand_mode = 1 stretch_mode = 5 metadata/_edit_use_anchors_ = true -[node name="black" type="TextureRect" parent="back/icon"] +[node name="black" type="TextureRect" parent="back/script_texture"] show_behind_parent = true layout_mode = 1 anchors_preset = -1 @@ -92,185 +172,28 @@ texture = SubResource("GradientTexture1D_lyq3l") expand_mode = 1 metadata/_edit_use_anchors_ = true -[node name="VBoxContainer" type="VBoxContainer" parent="."] +[node name="btn_scroll" type="ScrollContainer" parent="."] +unique_name_in_owner = true layout_mode = 1 anchors_preset = -1 anchor_left = 0.0614583 anchor_top = 0.0851852 anchor_right = 0.262 anchor_bottom = 0.803 -offset_right = -0.0401001 +offset_right = -0.0400391 offset_bottom = -0.240051 -theme_override_constants/separation = 35 +follow_focus = true +horizontal_scroll_mode = 0 +vertical_scroll_mode = 3 +scroll_deadzone = 1 metadata/_edit_use_anchors_ = true -[node name="Button1" type="Button" parent="VBoxContainer"] -z_index = 1 -clip_contents = true -custom_minimum_size = Vector2(385, 99) +[node name="btn_add_pos" type="VBoxContainer" parent="btn_scroll"] +unique_name_in_owner = true layout_mode = 2 -size_flags_horizontal = 0 +size_flags_horizontal = 3 size_flags_vertical = 0 -focus_mode = 0 -theme_override_styles/hover_pressed = ExtResource("4_7pqsv") -theme_override_styles/hover = ExtResource("4_7pqsv") -theme_override_styles/pressed = ExtResource("4_7pqsv") -theme_override_styles/normal = ExtResource("4_7pqsv") - -[node name="TextureRect" type="TextureRect" parent="VBoxContainer/Button1"] -show_behind_parent = true -layout_mode = 1 -anchors_preset = -1 -anchor_top = 0.0891089 -anchor_right = 1.0 -anchor_bottom = 0.901 -offset_bottom = -0.000999451 -grow_horizontal = 2 -grow_vertical = 2 -mouse_filter = 2 -texture = ExtResource("3_jw1jl") -expand_mode = 1 -stretch_mode = 6 - -[node name="Button2" type="Button" parent="VBoxContainer"] -clip_contents = true -custom_minimum_size = Vector2(320, 99) -layout_mode = 2 -size_flags_horizontal = 0 -size_flags_vertical = 0 -focus_mode = 0 -theme_override_styles/hover_pressed = ExtResource("5_f0q5x") -theme_override_styles/hover = ExtResource("5_f0q5x") -theme_override_styles/pressed = ExtResource("5_f0q5x") -theme_override_styles/normal = ExtResource("5_f0q5x") - -[node name="TextureRect" type="TextureRect" parent="VBoxContainer/Button2"] -show_behind_parent = true -layout_mode = 1 -anchors_preset = -1 -anchor_left = 0.04 -anchor_top = 0.09 -anchor_right = 0.963333 -anchor_bottom = 0.9 -grow_horizontal = 2 -grow_vertical = 2 -mouse_filter = 2 -texture = ExtResource("3_jw1jl") -expand_mode = 1 -stretch_mode = 6 -metadata/_edit_use_anchors_ = true - -[node name="Button3" type="Button" parent="VBoxContainer"] -clip_contents = true -custom_minimum_size = Vector2(320, 99) -layout_mode = 2 -size_flags_horizontal = 0 -size_flags_vertical = 0 -focus_mode = 0 -theme_override_styles/hover_pressed = ExtResource("5_f0q5x") -theme_override_styles/hover = ExtResource("5_f0q5x") -theme_override_styles/pressed = ExtResource("5_f0q5x") -theme_override_styles/normal = SubResource("StyleBoxTexture_gkr7a") - -[node name="TextureRect" type="TextureRect" parent="VBoxContainer/Button3"] -show_behind_parent = true -layout_mode = 1 -anchors_preset = -1 -anchor_left = 0.04 -anchor_top = 0.09 -anchor_right = 0.963333 -anchor_bottom = 0.9 -grow_horizontal = 2 -grow_vertical = 2 -mouse_filter = 2 -texture = ExtResource("3_jw1jl") -expand_mode = 1 -stretch_mode = 6 -metadata/_edit_use_anchors_ = true - -[node name="Button4" type="Button" parent="VBoxContainer"] -clip_contents = true -custom_minimum_size = Vector2(320, 99) -layout_mode = 2 -size_flags_horizontal = 0 -size_flags_vertical = 0 -focus_mode = 0 -theme_override_styles/hover_pressed = ExtResource("5_f0q5x") -theme_override_styles/hover = ExtResource("5_f0q5x") -theme_override_styles/pressed = ExtResource("5_f0q5x") -theme_override_styles/normal = SubResource("StyleBoxTexture_gkr7a") - -[node name="TextureRect" type="TextureRect" parent="VBoxContainer/Button4"] -show_behind_parent = true -layout_mode = 1 -anchors_preset = -1 -anchor_left = 0.04 -anchor_top = 0.09 -anchor_right = 0.963333 -anchor_bottom = 0.9 -grow_horizontal = 2 -grow_vertical = 2 -mouse_filter = 2 -texture = ExtResource("3_jw1jl") -expand_mode = 1 -stretch_mode = 6 -metadata/_edit_use_anchors_ = true - -[node name="Button5" type="Button" parent="VBoxContainer"] -clip_contents = true -custom_minimum_size = Vector2(320, 99) -layout_mode = 2 -size_flags_horizontal = 0 -size_flags_vertical = 0 -focus_mode = 0 -theme_override_styles/hover_pressed = ExtResource("5_f0q5x") -theme_override_styles/hover = ExtResource("5_f0q5x") -theme_override_styles/pressed = ExtResource("5_f0q5x") -theme_override_styles/normal = SubResource("StyleBoxTexture_gkr7a") - -[node name="TextureRect" type="TextureRect" parent="VBoxContainer/Button5"] -show_behind_parent = true -layout_mode = 1 -anchors_preset = -1 -anchor_left = 0.04 -anchor_top = 0.09 -anchor_right = 0.963333 -anchor_bottom = 0.9 -grow_horizontal = 2 -grow_vertical = 2 -mouse_filter = 2 -texture = ExtResource("3_jw1jl") -expand_mode = 1 -stretch_mode = 6 -metadata/_edit_use_anchors_ = true - -[node name="Button6" type="Button" parent="VBoxContainer"] -clip_contents = true -custom_minimum_size = Vector2(320, 99) -layout_mode = 2 -size_flags_horizontal = 0 -size_flags_vertical = 0 -focus_mode = 0 -theme_override_styles/hover_pressed = ExtResource("5_f0q5x") -theme_override_styles/hover = ExtResource("5_f0q5x") -theme_override_styles/pressed = ExtResource("5_f0q5x") -theme_override_styles/normal = SubResource("StyleBoxTexture_gkr7a") - -[node name="TextureRect" type="TextureRect" parent="VBoxContainer/Button6"] -show_behind_parent = true -layout_mode = 1 -anchors_preset = -1 -anchor_left = 0.04 -anchor_top = 0.09 -anchor_right = 0.963333 -anchor_bottom = 0.9 -grow_horizontal = 2 -grow_vertical = 2 -mouse_filter = 2 -texture = ExtResource("3_jw1jl") -expand_mode = 1 -stretch_mode = 6 -metadata/_edit_use_anchors_ = true +theme_override_constants/separation = 40 [node name="HBoxContainer" type="HBoxContainer" parent="."] z_index = 1 @@ -284,22 +207,23 @@ offset_bottom = -60.0 theme_override_constants/separation = -29 metadata/_edit_use_anchors_ = true -[node name="TextureRect" type="TextureRect" parent="HBoxContainer"] +[node name="history_texture" type="TextureRect" parent="HBoxContainer"] +unique_name_in_owner = true layout_mode = 2 size_flags_horizontal = 3 texture = ExtResource("8_wqdui") -[node name="TextureRect" type="TextureRect" parent="HBoxContainer/TextureRect"] +[node name="TextureRect" type="TextureRect" parent="HBoxContainer/history_texture"] layout_mode = 0 anchor_left = -0.00268097 anchor_top = -0.557377 anchor_right = 0.268097 anchor_bottom = 1.09836 -offset_right = -61.0 -offset_bottom = -61.0 +offset_right = -2.97874 +offset_bottom = 4.57764e-05 texture = ExtResource("9_wp7c8") -[node name="Label" type="Label" parent="HBoxContainer/TextureRect"] +[node name="Label" type="Label" parent="HBoxContainer/history_texture"] layout_mode = 1 anchors_preset = -1 anchor_left = 0.292225 @@ -311,7 +235,8 @@ horizontal_alignment = 1 vertical_alignment = 1 metadata/_edit_use_anchors_ = true -[node name="Button" type="Button" parent="HBoxContainer/TextureRect"] +[node name="history_button" type="Button" parent="HBoxContainer/history_texture"] +unique_name_in_owner = true layout_mode = 1 anchors_preset = 15 anchor_right = 1.0 @@ -321,23 +246,24 @@ grow_vertical = 2 focus_mode = 0 flat = true -[node name="TextureRect2" type="TextureRect" parent="HBoxContainer"] +[node name="fantasy_texture" type="TextureRect" parent="HBoxContainer"] +unique_name_in_owner = true layout_mode = 2 size_flags_horizontal = 3 texture = ExtResource("10_iblo5") -[node name="TextureRect" type="TextureRect" parent="HBoxContainer/TextureRect2"] +[node name="TextureRect" type="TextureRect" parent="HBoxContainer/fantasy_texture"] layout_mode = 1 anchors_preset = -1 anchor_left = -0.00268097 anchor_top = -0.557377 anchor_right = 0.268097 anchor_bottom = 1.09836 -offset_right = -61.0 -offset_bottom = -61.0 +offset_right = -9.76964 +offset_bottom = -5.99995 texture = ExtResource("11_hv6di") -[node name="Label" type="Label" parent="HBoxContainer/TextureRect2"] +[node name="Label" type="Label" parent="HBoxContainer/fantasy_texture"] layout_mode = 1 anchors_preset = -1 anchor_left = 0.292225 @@ -349,7 +275,8 @@ horizontal_alignment = 1 vertical_alignment = 1 metadata/_edit_use_anchors_ = true -[node name="Button" type="Button" parent="HBoxContainer/TextureRect2"] +[node name="fantasy_button" type="Button" parent="HBoxContainer/fantasy_texture"] +unique_name_in_owner = true layout_mode = 1 anchors_preset = 15 anchor_right = 1.0 @@ -359,12 +286,13 @@ grow_vertical = 2 focus_mode = 0 flat = true -[node name="TextureRect3" type="TextureRect" parent="HBoxContainer"] +[node name="reality_texture" type="TextureRect" parent="HBoxContainer"] +unique_name_in_owner = true layout_mode = 2 size_flags_horizontal = 3 texture = ExtResource("10_iblo5") -[node name="TextureRect" type="TextureRect" parent="HBoxContainer/TextureRect3"] +[node name="TextureRect" type="TextureRect" parent="HBoxContainer/reality_texture"] layout_mode = 1 anchors_preset = -1 anchor_left = 0.045 @@ -377,7 +305,7 @@ offset_right = 0.297585 offset_bottom = -6.0 texture = ExtResource("12_qqyd6") -[node name="Label" type="Label" parent="HBoxContainer/TextureRect3"] +[node name="Label" type="Label" parent="HBoxContainer/reality_texture"] layout_mode = 1 anchors_preset = -1 anchor_left = 0.292225 @@ -389,7 +317,8 @@ horizontal_alignment = 1 vertical_alignment = 1 metadata/_edit_use_anchors_ = true -[node name="Button" type="Button" parent="HBoxContainer/TextureRect3"] +[node name="reality_button" type="Button" parent="HBoxContainer/reality_texture"] +unique_name_in_owner = true layout_mode = 1 anchors_preset = 15 anchor_right = 1.0 @@ -399,12 +328,13 @@ grow_vertical = 2 focus_mode = 0 flat = true -[node name="TextureRect4" type="TextureRect" parent="HBoxContainer"] +[node name="eschatological_texture" type="TextureRect" parent="HBoxContainer"] +unique_name_in_owner = true layout_mode = 2 size_flags_horizontal = 3 texture = ExtResource("10_iblo5") -[node name="TextureRect" type="TextureRect" parent="HBoxContainer/TextureRect4"] +[node name="TextureRect" type="TextureRect" parent="HBoxContainer/eschatological_texture"] layout_mode = 1 anchors_preset = -1 anchor_left = 0.073 @@ -417,7 +347,7 @@ offset_right = -0.702415 offset_bottom = 3.0 texture = ExtResource("13_06h8p") -[node name="Label" type="Label" parent="HBoxContainer/TextureRect4"] +[node name="Label" type="Label" parent="HBoxContainer/eschatological_texture"] layout_mode = 1 anchors_preset = -1 anchor_left = 0.292225 @@ -429,7 +359,8 @@ horizontal_alignment = 1 vertical_alignment = 1 metadata/_edit_use_anchors_ = true -[node name="Button" type="Button" parent="HBoxContainer/TextureRect4"] +[node name="eschatological_button" type="Button" parent="HBoxContainer/eschatological_texture"] +unique_name_in_owner = true layout_mode = 1 anchors_preset = 15 anchor_right = 1.0 @@ -439,12 +370,13 @@ grow_vertical = 2 focus_mode = 0 flat = true -[node name="TextureRect5" type="TextureRect" parent="HBoxContainer"] +[node name="continue_texture" type="TextureRect" parent="HBoxContainer"] +unique_name_in_owner = true layout_mode = 2 size_flags_horizontal = 3 texture = ExtResource("11_tvykm") -[node name="TextureRect" type="TextureRect" parent="HBoxContainer/TextureRect5"] +[node name="TextureRect" type="TextureRect" parent="HBoxContainer/continue_texture"] layout_mode = 1 anchors_preset = -1 anchor_left = 0.0618812 @@ -455,7 +387,7 @@ offset_bottom = 7.0 texture = ExtResource("15_jcwu5") metadata/_edit_use_anchors_ = true -[node name="Label" type="Label" parent="HBoxContainer/TextureRect5"] +[node name="Label" type="Label" parent="HBoxContainer/continue_texture"] layout_mode = 1 anchors_preset = -1 anchor_left = 0.292225 @@ -468,7 +400,8 @@ horizontal_alignment = 1 vertical_alignment = 1 metadata/_edit_use_anchors_ = true -[node name="Button" type="Button" parent="HBoxContainer/TextureRect5"] +[node name="continue_button" type="Button" parent="HBoxContainer/continue_texture"] +unique_name_in_owner = true layout_mode = 1 anchors_preset = 15 anchor_right = 1.0 @@ -492,7 +425,8 @@ patch_margin_right = 90 patch_margin_bottom = 56 metadata/_edit_use_anchors_ = true -[node name="Label" type="Label" parent="NinePatchRect"] +[node name="script_introduction" type="Label" parent="NinePatchRect"] +unique_name_in_owner = true layout_mode = 1 anchors_preset = -1 anchor_left = 0.0976744 @@ -526,7 +460,8 @@ expand_mode = 1 stretch_mode = 5 metadata/_edit_use_anchors_ = true -[node name="Label" type="Label" parent="NinePatchRect/TextureRect"] +[node name="script_name" type="Label" parent="NinePatchRect/TextureRect"] +unique_name_in_owner = true layout_mode = 0 anchor_left = 0.355372 anchor_top = 0.464789 @@ -538,7 +473,7 @@ horizontal_alignment = 1 vertical_alignment = 1 metadata/_edit_use_anchors_ = true -[node name="Button" type="Button" parent="."] +[node name="back_button" type="Button" parent="."] layout_mode = 0 anchor_left = 0.00677083 anchor_top = 0.0138889 @@ -550,7 +485,8 @@ focus_mode = 0 icon = ExtResource("18_qwfod") flat = true -[node name="TextureRect" type="NinePatchRect" parent="."] +[node name="enter_texture" type="NinePatchRect" parent="."] +unique_name_in_owner = true z_index = 1 layout_mode = 0 anchor_left = 0.766146 @@ -562,7 +498,7 @@ patch_margin_left = 30 patch_margin_right = 30 metadata/_edit_use_anchors_ = true -[node name="MarginContainer" type="MarginContainer" parent="TextureRect"] +[node name="MarginContainer" type="MarginContainer" parent="enter_texture"] layout_mode = 1 anchors_preset = 15 anchor_right = 1.0 @@ -572,7 +508,7 @@ grow_vertical = 2 theme_override_constants/margin_left = 30 theme_override_constants/margin_right = 30 -[node name="Label" type="Label" parent="TextureRect/MarginContainer"] +[node name="Label" type="Label" parent="enter_texture/MarginContainer"] layout_mode = 2 size_flags_vertical = 1 theme_override_colors/font_color = Color(0, 0, 0, 1) @@ -583,7 +519,8 @@ text = "进入剧本" horizontal_alignment = 1 vertical_alignment = 1 -[node name="enter" type="Button" parent="TextureRect"] +[node name="enter_button" type="Button" parent="enter_texture"] +unique_name_in_owner = true layout_mode = 1 anchors_preset = 15 anchor_right = 1.0 @@ -593,9 +530,12 @@ grow_vertical = 2 focus_mode = 0 flat = true -[connection signal="pressed" from="VBoxContainer/Button1" to="." method="side_btn_clicked" binds= [0]] -[connection signal="pressed" from="VBoxContainer/Button2" to="." method="side_btn_clicked" binds= [1]] -[connection signal="pressed" from="VBoxContainer/Button3" to="." method="side_btn_clicked" binds= [2]] -[connection signal="pressed" from="VBoxContainer/Button4" to="." method="side_btn_clicked" binds= [3]] -[connection signal="pressed" from="VBoxContainer/Button5" to="." method="side_btn_clicked" binds= [4]] -[connection signal="pressed" from="VBoxContainer/Button6" to="." method="side_btn_clicked" binds= [5]] +[node name="texture_animation" type="AnimationPlayer" parent="."] +unique_name_in_owner = true +libraries = { +"": SubResource("AnimationLibrary_8lk2v") +} + +[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="enter_texture/enter_button" to="." method="_on_enter_button_pressed"] diff --git a/scene/select_button.gd b/scene/select_button.gd new file mode 100644 index 0000000..9ddbf00 --- /dev/null +++ b/scene/select_button.gd @@ -0,0 +1,29 @@ +extends Button +const SELECTED = preload("res://res/ui/ui_003_select/selected.tres") +const UNSELECTED = preload("res://res/ui/ui_003_select/unselected.tres") +var id:String="" +var is_selected:bool=false: + set(val): + if is_selected!=val: + match val: + true: + var tween=get_tree().create_tween() + add_theme_stylebox_override("normal",SELECTED) + add_theme_stylebox_override("pressed",SELECTED) + add_theme_stylebox_override("hover",SELECTED) + add_theme_stylebox_override("hover_pressed",SELECTED) + z_index+=1 + tween.tween_property(self, "custom_minimum_size:x", 385, 0.2) + pass + false: + var tween=get_tree().create_tween() + add_theme_stylebox_override("normal",UNSELECTED) + add_theme_stylebox_override("pressed",UNSELECTED) + add_theme_stylebox_override("hover",UNSELECTED) + add_theme_stylebox_override("hover_pressed",UNSELECTED) + z_index-=1 + tween.tween_property(self, "custom_minimum_size:x", 320, 0.2) + pass + is_selected=val +func set_texture(texture:Texture2D): + $TextureRect.texture=texture diff --git a/scene/select_button.tscn b/scene/select_button.tscn new file mode 100644 index 0000000..87869ea --- /dev/null +++ b/scene/select_button.tscn @@ -0,0 +1,29 @@ +[gd_scene load_steps=4 format=3 uid="uid://dnhitpsup8wh4"] + +[ext_resource type="StyleBox" uid="uid://criiod0onsrre" path="res://res/ui/ui_003_select/unselected.tres" id="1_xw1y0"] +[ext_resource type="Script" path="res://scene/select_button.gd" id="2_nvp3e"] +[ext_resource type="Texture2D" uid="uid://li8e5ntlgcpg" path="res://res/ui/ui_003_select/test.png" id="3_3q3ca"] + +[node name="Button" type="Button"] +clip_contents = true +custom_minimum_size = Vector2(320, 99) +offset_right = 8.0 +offset_bottom = 8.0 +size_flags_horizontal = 0 +theme_override_styles/hover_pressed = ExtResource("1_xw1y0") +theme_override_styles/hover = ExtResource("1_xw1y0") +theme_override_styles/pressed = ExtResource("1_xw1y0") +theme_override_styles/normal = ExtResource("1_xw1y0") +script = ExtResource("2_nvp3e") + +[node name="TextureRect" type="TextureRect" parent="."] +show_behind_parent = true +layout_mode = 1 +anchors_preset = 15 +anchor_right = 1.0 +anchor_bottom = 1.0 +grow_horizontal = 2 +grow_vertical = 2 +texture = ExtResource("3_3q3ca") +expand_mode = 1 +stretch_mode = 6