9.19上午
This commit is contained in:
parent
e806a46c68
commit
fe8d8fba0e
80
autoload/global/script/global.gd
Normal file
80
autoload/global/script/global.gd
Normal file
@ -0,0 +1,80 @@
|
||||
extends Node
|
||||
#全局数据json的加载
|
||||
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
|
||||
var script_type_divide_data:Array=[]
|
||||
var event_json_path:String="res://json/event.json"
|
||||
var event_data:Dictionary
|
||||
var scene_json_path:String="res://json/scene.json"
|
||||
var scene_data:Dictionary
|
||||
func _ready() -> void:
|
||||
load_texture_data()
|
||||
load_script_data()
|
||||
load_event_data()
|
||||
load_scene_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)
|
||||
script_type_divide_data=[{},{},{},{}]
|
||||
for i in dictionary.keys():
|
||||
dictionary[i]["id"]=i
|
||||
var data=dictionary[i]
|
||||
if data.has("type"):
|
||||
var type:int=int(data["type"])
|
||||
script_type_divide_data[type][i]=data
|
||||
script_data=dictionary
|
||||
func load_event_data():
|
||||
var file=FileAccess.open(event_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
|
||||
event_data=dictionary
|
||||
func load_scene_data():
|
||||
var file=FileAccess.open(scene_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
|
||||
scene_data=dictionary
|
||||
pass
|
||||
func get_texture(id:String):
|
||||
if texture_data.has(id):
|
||||
return texture_data[id]
|
||||
else:
|
||||
return null
|
||||
|
||||
func get_script_data(id:String):
|
||||
if script_data.has(id):
|
||||
var dictionary:Dictionary=script_data[id]
|
||||
return dictionary.duplicate()
|
||||
else:
|
||||
return null
|
||||
func get_all_script_data():
|
||||
return script_type_divide_data.duplicate()
|
||||
func get_event_data(id:String):
|
||||
if event_data.has(id):
|
||||
var dictionary:Dictionary=event_data[id]
|
||||
return dictionary.duplicate()
|
||||
else:
|
||||
return null
|
||||
func get_scene_data(id:String):
|
||||
if scene_data.has(id):
|
||||
var dictionary:Dictionary=scene_data[id]
|
||||
return dictionary.duplicate()
|
||||
else:
|
||||
return null
|
@ -1,6 +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"]
|
||||
[ext_resource type="Script" path="res://autoload/global/script/global.gd" id="1_vfs8x"]
|
||||
|
||||
[node name="Global" type="Node"]
|
||||
script = ExtResource("1_vfs8x")
|
60
autoload/scene_manager/script/scene_manager.gd
Normal file
60
autoload/scene_manager/script/scene_manager.gd
Normal file
@ -0,0 +1,60 @@
|
||||
extends CanvasLayer
|
||||
|
||||
@onready var animation_player: AnimationPlayer = $AnimationPlayer
|
||||
@onready var h_box_container: HBoxContainer = $ColorRect/HBoxContainer
|
||||
@onready var color_rect: ColorRect = $ColorRect
|
||||
@onready var percent: Label = $ColorRect/HBoxContainer/percent
|
||||
@onready var breath: AnimationPlayer = $breath
|
||||
|
||||
# Called when the node enters the scene tree for the first time.
|
||||
func _ready() -> void:
|
||||
set_process(false)
|
||||
pass # Replace with function body.
|
||||
var load_path:String=""
|
||||
func change_scene_to(path:String):
|
||||
color_rect.show()
|
||||
animation_player.play("open")
|
||||
await animation_player.animation_finished
|
||||
h_box_container.show()
|
||||
percent.text="0"
|
||||
breath.play("breath")
|
||||
await get_tree().create_timer(0.2).timeout
|
||||
percent.text="20"
|
||||
await get_tree().create_timer(0.2).timeout
|
||||
load_path=path
|
||||
ResourceLoader.load_threaded_request(path,"PackedScene",true)
|
||||
set_process(true)
|
||||
# Called every frame. 'delta' is the elapsed time since the previous frame.
|
||||
func _process(delta: float) -> void:
|
||||
if load_path=="":
|
||||
return
|
||||
var progress=[]
|
||||
var status:ResourceLoader.ThreadLoadStatus=ResourceLoader.load_threaded_get_status(load_path,progress)
|
||||
match status:
|
||||
ResourceLoader.THREAD_LOAD_INVALID_RESOURCE:
|
||||
percent.text="100"
|
||||
load_end()
|
||||
|
||||
ResourceLoader.THREAD_LOAD_IN_PROGRESS:
|
||||
percent.text=str(int(progress[0]*100))
|
||||
ResourceLoader.THREAD_LOAD_FAILED:
|
||||
percent.text="100"
|
||||
var scene=ResourceLoader.load_threaded_get(load_path)
|
||||
get_tree().change_scene_to_packed(scene)
|
||||
load_end()
|
||||
ResourceLoader.THREAD_LOAD_LOADED:
|
||||
percent.text="100"
|
||||
var scene=ResourceLoader.load_threaded_get(load_path)
|
||||
get_tree().change_scene_to_packed(scene)
|
||||
load_end()
|
||||
pass
|
||||
pass
|
||||
func load_end():
|
||||
load_path=""
|
||||
set_process(false)
|
||||
await get_tree().create_timer(0.2).timeout
|
||||
h_box_container.hide()
|
||||
breath.stop()
|
||||
animation_player.play_backwards("open")
|
||||
await animation_player.animation_finished
|
||||
color_rect.hide()
|
142
autoload/scene_manager/tscn/scene_manager.tscn
Normal file
142
autoload/scene_manager/tscn/scene_manager.tscn
Normal file
@ -0,0 +1,142 @@
|
||||
[gd_scene load_steps=12 format=3 uid="uid://c50u1lwpif73i"]
|
||||
|
||||
[ext_resource type="Script" path="res://autoload/scene_manager/script/scene_manager.gd" id="1_q8xsu"]
|
||||
[ext_resource type="Shader" path="res://res/shader/change_scene.gdshader" id="2_dbqpg"]
|
||||
|
||||
[sub_resource type="Gradient" id="Gradient_mo3jy"]
|
||||
|
||||
[sub_resource type="GradientTexture2D" id="GradientTexture2D_keqt8"]
|
||||
gradient = SubResource("Gradient_mo3jy")
|
||||
width = 1920
|
||||
height = 1080
|
||||
fill_from = Vector2(0, 0.5)
|
||||
fill_to = Vector2(1, 0.5)
|
||||
|
||||
[sub_resource type="ShaderMaterial" id="ShaderMaterial_8n216"]
|
||||
shader = ExtResource("2_dbqpg")
|
||||
shader_parameter/cutoff = 1.0
|
||||
shader_parameter/smooth_size = null
|
||||
shader_parameter/mask = SubResource("GradientTexture2D_keqt8")
|
||||
|
||||
[sub_resource type="Animation" id="Animation_xlhdq"]
|
||||
length = 0.001
|
||||
tracks/0/type = "value"
|
||||
tracks/0/imported = false
|
||||
tracks/0/enabled = true
|
||||
tracks/0/path = NodePath("ColorRect:material:shader_parameter/cutoff")
|
||||
tracks/0/interp = 1
|
||||
tracks/0/loop_wrap = true
|
||||
tracks/0/keys = {
|
||||
"times": PackedFloat32Array(0),
|
||||
"transitions": PackedFloat32Array(1),
|
||||
"update": 0,
|
||||
"values": [1.0]
|
||||
}
|
||||
|
||||
[sub_resource type="Animation" id="Animation_ftmeh"]
|
||||
resource_name = "open"
|
||||
length = 0.3
|
||||
tracks/0/type = "value"
|
||||
tracks/0/imported = false
|
||||
tracks/0/enabled = true
|
||||
tracks/0/path = NodePath("ColorRect:material:shader_parameter/cutoff")
|
||||
tracks/0/interp = 1
|
||||
tracks/0/loop_wrap = true
|
||||
tracks/0/keys = {
|
||||
"times": PackedFloat32Array(0, 0.3),
|
||||
"transitions": PackedFloat32Array(1, 1),
|
||||
"update": 0,
|
||||
"values": [1.0, 0.0]
|
||||
}
|
||||
|
||||
[sub_resource type="AnimationLibrary" id="AnimationLibrary_pcb11"]
|
||||
_data = {
|
||||
"RESET": SubResource("Animation_xlhdq"),
|
||||
"open": SubResource("Animation_ftmeh")
|
||||
}
|
||||
|
||||
[sub_resource type="Animation" id="Animation_nhee0"]
|
||||
length = 0.001
|
||||
tracks/0/type = "value"
|
||||
tracks/0/imported = false
|
||||
tracks/0/enabled = true
|
||||
tracks/0/path = NodePath("ColorRect/HBoxContainer:modulate")
|
||||
tracks/0/interp = 1
|
||||
tracks/0/loop_wrap = true
|
||||
tracks/0/keys = {
|
||||
"times": PackedFloat32Array(0),
|
||||
"transitions": PackedFloat32Array(1),
|
||||
"update": 0,
|
||||
"values": [Color(1, 1, 1, 1)]
|
||||
}
|
||||
|
||||
[sub_resource type="Animation" id="Animation_m3y4q"]
|
||||
resource_name = "breath"
|
||||
loop_mode = 1
|
||||
tracks/0/type = "value"
|
||||
tracks/0/imported = false
|
||||
tracks/0/enabled = true
|
||||
tracks/0/path = NodePath("ColorRect/HBoxContainer:modulate")
|
||||
tracks/0/interp = 1
|
||||
tracks/0/loop_wrap = true
|
||||
tracks/0/keys = {
|
||||
"times": PackedFloat32Array(0, 0.5, 1),
|
||||
"transitions": PackedFloat32Array(1, 1, 1),
|
||||
"update": 0,
|
||||
"values": [Color(1, 1, 1, 1), Color(0.54099, 0.54099, 0.54099, 1), Color(1, 1, 1, 1)]
|
||||
}
|
||||
|
||||
[sub_resource type="AnimationLibrary" id="AnimationLibrary_8ttym"]
|
||||
_data = {
|
||||
"RESET": SubResource("Animation_nhee0"),
|
||||
"breath": SubResource("Animation_m3y4q")
|
||||
}
|
||||
|
||||
[node name="SceneManager" type="CanvasLayer"]
|
||||
layer = 100
|
||||
script = ExtResource("1_q8xsu")
|
||||
|
||||
[node name="ColorRect" type="ColorRect" parent="."]
|
||||
visible = false
|
||||
material = SubResource("ShaderMaterial_8n216")
|
||||
anchors_preset = 15
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
color = Color(0, 0, 0, 1)
|
||||
|
||||
[node name="HBoxContainer" type="HBoxContainer" parent="ColorRect"]
|
||||
visible = false
|
||||
layout_mode = 1
|
||||
anchors_preset = 3
|
||||
anchor_left = 1.0
|
||||
anchor_top = 1.0
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
offset_left = -122.0
|
||||
offset_top = -85.0
|
||||
offset_right = -18.0
|
||||
offset_bottom = -16.0
|
||||
grow_horizontal = 0
|
||||
grow_vertical = 0
|
||||
|
||||
[node name="percent" type="Label" parent="ColorRect/HBoxContainer"]
|
||||
layout_mode = 2
|
||||
theme_override_font_sizes/font_size = 50
|
||||
text = "99"
|
||||
|
||||
[node name="Label2" type="Label" parent="ColorRect/HBoxContainer"]
|
||||
layout_mode = 2
|
||||
theme_override_font_sizes/font_size = 50
|
||||
text = "%"
|
||||
|
||||
[node name="AnimationPlayer" type="AnimationPlayer" parent="."]
|
||||
libraries = {
|
||||
"": SubResource("AnimationLibrary_pcb11")
|
||||
}
|
||||
|
||||
[node name="breath" type="AnimationPlayer" parent="."]
|
||||
libraries = {
|
||||
"": SubResource("AnimationLibrary_8ttym")
|
||||
}
|
@ -1,31 +0,0 @@
|
||||
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
|
15
json/event.json
Normal file
15
json/event.json
Normal file
@ -0,0 +1,15 @@
|
||||
{
|
||||
"event_01":{
|
||||
"name":"测试事件1",
|
||||
"texture":"test_scene",
|
||||
"text":"测试事件",
|
||||
"choice":[
|
||||
{
|
||||
"name":"测试选项1"
|
||||
},
|
||||
{
|
||||
"name":"测试选项2"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
16
json/scene.json
Normal file
16
json/scene.json
Normal file
@ -0,0 +1,16 @@
|
||||
{
|
||||
"scene_01":{
|
||||
"name":"测试场景1",
|
||||
"texture":"test_scene",
|
||||
"quick_event":[
|
||||
{
|
||||
"name":"测试场景事件",
|
||||
"event":"event_01"
|
||||
},
|
||||
{
|
||||
"name":"测试场景事件",
|
||||
"event":"event_02"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
@ -2,10 +2,72 @@
|
||||
"script_001":{
|
||||
|
||||
"name":"测试剧本001",
|
||||
"texture":"texture_test",
|
||||
"texture":"test_scene",
|
||||
"side_texture":"texture_test",
|
||||
"introduction":"这是一个测试剧本",
|
||||
"type":0,
|
||||
"init_date":{
|
||||
"year":1860,
|
||||
"month":1,
|
||||
"day":1,
|
||||
"week":1
|
||||
}
|
||||
},
|
||||
"script_002":{
|
||||
|
||||
"name":"测试剧本002",
|
||||
"texture":"texture_test",
|
||||
"side_texture":"test_scene",
|
||||
"introduction":"这是一个测试剧本",
|
||||
"type":0
|
||||
}
|
||||
},
|
||||
"script_003":{
|
||||
|
||||
"name":"测试剧本003",
|
||||
"texture":"texture_test",
|
||||
"side_texture":"test_scene",
|
||||
"introduction":"这是一个测试剧本",
|
||||
"type":1
|
||||
},
|
||||
"script_004":{
|
||||
|
||||
"name":"测试剧本001",
|
||||
"texture":"test_scene",
|
||||
"side_texture":"texture_test",
|
||||
"introduction":"这是一个测试剧本",
|
||||
"type":1
|
||||
},
|
||||
"script_005":{
|
||||
|
||||
"name":"测试剧本001",
|
||||
"texture":"texture_test",
|
||||
"side_texture":"test_scene",
|
||||
"introduction":"这是一个测试剧本",
|
||||
"type":2
|
||||
},
|
||||
"script_006":{
|
||||
|
||||
"name":"测试剧本001",
|
||||
"texture":"test_scene",
|
||||
"side_texture":"texture_test",
|
||||
"introduction":"这是一个测试剧本",
|
||||
"type":2
|
||||
},
|
||||
"script_007":{
|
||||
|
||||
"name":"测试剧本001",
|
||||
"texture":"texture_test",
|
||||
"side_texture":"test_scene",
|
||||
"introduction":"这是一个测试剧本",
|
||||
"type":3
|
||||
},
|
||||
"script_008":{
|
||||
|
||||
"name":"测试剧本001",
|
||||
"texture":"test_scene",
|
||||
"side_texture":"texture_test",
|
||||
"introduction":"这是一个测试剧本",
|
||||
"type":3
|
||||
},
|
||||
|
||||
}
|
||||
|
@ -1,3 +1,5 @@
|
||||
{
|
||||
"texture_test":"res://test/texture/test_texture.png"
|
||||
"texture_test":"res://test/texture/test_texture.png",
|
||||
"test_scene":"res://test/texture/test_scene.png",
|
||||
"test_character":"res://test/texture/test_character.png"
|
||||
}
|
||||
|
@ -18,7 +18,8 @@ config/icon="res://icon.svg"
|
||||
[autoload]
|
||||
|
||||
PopUpWindow="*res://addons/popupwindow/PopUpWindow.tscn"
|
||||
Global="*res://autoload/tscn/global.tscn"
|
||||
Global="*res://autoload/global/tscn/global.tscn"
|
||||
SceneManager="*res://autoload/scene_manager/tscn/scene_manager.tscn"
|
||||
|
||||
[display]
|
||||
|
||||
|
12
res/shader/change_scene.gdshader
Normal file
12
res/shader/change_scene.gdshader
Normal file
@ -0,0 +1,12 @@
|
||||
shader_type canvas_item;
|
||||
render_mode unshaded;
|
||||
uniform float cutoff:hint_range(0.0, 1.0, 0.1);
|
||||
uniform float smooth_size: hint_range(0.0,1.0,0.1);
|
||||
uniform sampler2D mask;
|
||||
void fragment()
|
||||
{
|
||||
float value =texture(mask,UV).r;
|
||||
float alpha =smoothstep(cutoff,cutoff,value);
|
||||
COLOR=vec4(COLOR.rgb,alpha);
|
||||
}
|
||||
|
16
scene/banner.gd
Normal file
16
scene/banner.gd
Normal file
@ -0,0 +1,16 @@
|
||||
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_back_pressed() -> void:
|
||||
get_parent().change_open(false)
|
||||
pass # Replace with function body.
|
@ -1,5 +1,6 @@
|
||||
[gd_scene load_steps=18 format=3 uid="uid://batc5tlfgbqm5"]
|
||||
[gd_scene load_steps=20 format=3 uid="uid://batc5tlfgbqm5"]
|
||||
|
||||
[ext_resource type="Script" path="res://scene/banner.gd" id="1_5ak3s"]
|
||||
[ext_resource type="Texture2D" uid="uid://s07n63marhbe" path="res://res/ui/ui_014_banner/tuceng1.png" id="1_pitv7"]
|
||||
[ext_resource type="Texture2D" uid="uid://ntcjrafc73k2" path="res://res/ui/ui_014_banner/back.png" id="2_33u7c"]
|
||||
[ext_resource type="Texture2D" uid="uid://bny3npt67jewn" path="res://res/ui/ui_014_banner/tuceng2.png" id="3_w0102"]
|
||||
@ -17,6 +18,7 @@
|
||||
[ext_resource type="Texture2D" uid="uid://c81mesvvsvfnp" path="res://res/ui/ui_002_main/zuanshi.png" id="13_dqs0f"]
|
||||
[ext_resource type="Texture2D" uid="uid://dcoj37l5nq6xy" path="res://res/ui/ui_002_main/dinglan4.png" id="14_u5qya"]
|
||||
[ext_resource type="Texture2D" uid="uid://bq6v0t5bov8ck" path="res://res/ui/ui_002_main/physical.png" id="15_qt6ra"]
|
||||
[ext_resource type="PackedScene" uid="uid://cn3s171ioei4v" path="res://scene/banner_detail.tscn" id="19_mb4ei"]
|
||||
|
||||
[node name="banner" type="Control"]
|
||||
layout_mode = 3
|
||||
@ -25,6 +27,7 @@ anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
script = ExtResource("1_5ak3s")
|
||||
|
||||
[node name="TextureRect" type="TextureRect" parent="."]
|
||||
layout_mode = 1
|
||||
@ -62,7 +65,7 @@ layout_mode = 2
|
||||
size_flags_horizontal = 0
|
||||
texture = ExtResource("2_33u7c")
|
||||
|
||||
[node name="ToolButton" parent="MarginContainer/HBoxContainer/VBoxContainer/TextureRect" instance=ExtResource("6_k3cic")]
|
||||
[node name="back" parent="MarginContainer/HBoxContainer/VBoxContainer/TextureRect" instance=ExtResource("6_k3cic")]
|
||||
layout_mode = 1
|
||||
|
||||
[node name="VBoxContainer" type="VBoxContainer" parent="MarginContainer/HBoxContainer/VBoxContainer"]
|
||||
@ -350,3 +353,8 @@ stretch_mode = 5
|
||||
layout_mode = 2
|
||||
theme_override_font_sizes/font_size = 34
|
||||
text = "9999"
|
||||
|
||||
[node name="banner_detail" parent="." instance=ExtResource("19_mb4ei")]
|
||||
layout_mode = 1
|
||||
|
||||
[connection signal="pressed" from="MarginContainer/HBoxContainer/VBoxContainer/TextureRect/back" to="." method="_on_back_pressed"]
|
||||
|
16
scene/banner_detail.gd
Normal file
16
scene/banner_detail.gd
Normal file
@ -0,0 +1,16 @@
|
||||
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_back_pressed() -> void:
|
||||
self.hide()
|
||||
pass # Replace with function body.
|
@ -1,5 +1,6 @@
|
||||
[gd_scene load_steps=10 format=3 uid="uid://cn3s171ioei4v"]
|
||||
[gd_scene load_steps=11 format=3 uid="uid://cn3s171ioei4v"]
|
||||
|
||||
[ext_resource type="Script" path="res://scene/banner_detail.gd" id="1_tbwhc"]
|
||||
[ext_resource type="Texture2D" uid="uid://diroovqs7byb7" path="res://res/ui/ui_015_banner_detail/tuceng2.png" id="1_xmjwj"]
|
||||
[ext_resource type="Texture2D" uid="uid://lijpeimp30qs" path="res://res/ui/ui_015_banner_detail/juxing20.png" id="2_lovwe"]
|
||||
[ext_resource type="Texture2D" uid="uid://ci5bxgrk3ati0" path="res://res/ui/ui_015_banner_detail/juxing10.png" id="3_d8v2i"]
|
||||
@ -25,6 +26,7 @@ anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
script = ExtResource("1_tbwhc")
|
||||
|
||||
[node name="TextureRect" type="TextureRect" parent="."]
|
||||
layout_mode = 1
|
||||
@ -194,5 +196,7 @@ offset_bottom = 40.0
|
||||
grow_horizontal = 0
|
||||
texture = ExtResource("6_u2tej")
|
||||
|
||||
[node name="ToolButton" parent="MarginContainer/Panel/back" instance=ExtResource("7_r1qyi")]
|
||||
[node name="back" parent="MarginContainer/Panel/back" instance=ExtResource("7_r1qyi")]
|
||||
layout_mode = 1
|
||||
|
||||
[connection signal="pressed" from="MarginContainer/Panel/back/back" to="." method="_on_back_pressed"]
|
||||
|
32
scene/event.gd
Normal file
32
scene/event.gd
Normal file
@ -0,0 +1,32 @@
|
||||
extends Control
|
||||
const EVENT_CHOICE_BUTTON = preload("res://scene/event_choice_button.tscn")
|
||||
@onready var choice_add_pos: VBoxContainer = $MarginContainer/NinePatchRect/VBoxContainer/VBoxContainer/choice_add_pos
|
||||
@onready var event_texture: TextureRect = $MarginContainer/HBoxContainer/event_texture
|
||||
@onready var event_intro: Label = $MarginContainer/NinePatchRect/VBoxContainer/event_intro
|
||||
@onready var event_name: Label = $MarginContainer/NinePatchRect/TextureRect/event_name
|
||||
|
||||
var data:Dictionary
|
||||
# Called when the node enters the scene tree for the first time.
|
||||
func _ready() -> void:
|
||||
set_event_data("event_01")
|
||||
pass # Replace with function body.
|
||||
|
||||
|
||||
# Called every frame. 'delta' is the elapsed time since the previous frame.
|
||||
func _process(delta: float) -> void:
|
||||
pass
|
||||
#通过事件ID初始化界面
|
||||
func set_event_data(id:String):
|
||||
data=Global.get_event_data(id)
|
||||
for i in choice_add_pos.get_children():
|
||||
i.queue_free()
|
||||
event_texture.texture=Global.get_texture(data["texture"])
|
||||
event_intro.text=data["text"]
|
||||
event_name.text=data["name"]
|
||||
var choice_data=data["choice"]
|
||||
for i in choice_data:
|
||||
var new_btn=EVENT_CHOICE_BUTTON.instantiate()
|
||||
choice_add_pos.add_child(new_btn)
|
||||
new_btn.set_data(i)
|
||||
|
||||
|
@ -1,5 +1,6 @@
|
||||
[gd_scene load_steps=9 format=3 uid="uid://b3hw4w5shpyu0"]
|
||||
[gd_scene load_steps=10 format=3 uid="uid://b3hw4w5shpyu0"]
|
||||
|
||||
[ext_resource type="Script" path="res://scene/event.gd" id="1_cpmb4"]
|
||||
[ext_resource type="Texture2D" uid="uid://ctfm87nw7xemy" path="res://res/ui/ui_020_event/tuceng1.png" id="1_u31m8"]
|
||||
[ext_resource type="Texture2D" uid="uid://cst6mgs75xl26" path="res://res/ui/ui_020_event/tuceng306.png" id="2_25k7b"]
|
||||
[ext_resource type="Shader" path="res://res/shader/blur.gdshader" id="2_l482b"]
|
||||
@ -27,6 +28,7 @@ anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
script = ExtResource("1_cpmb4")
|
||||
|
||||
[node name="TextureRect" type="TextureRect" parent="."]
|
||||
layout_mode = 1
|
||||
@ -55,7 +57,7 @@ theme_override_constants/margin_bottom = 39
|
||||
show_behind_parent = true
|
||||
layout_mode = 2
|
||||
|
||||
[node name="TextureRect" type="TextureRect" parent="MarginContainer/HBoxContainer"]
|
||||
[node name="event_texture" type="TextureRect" parent="MarginContainer/HBoxContainer"]
|
||||
show_behind_parent = true
|
||||
material = SubResource("ShaderMaterial_2da64")
|
||||
layout_mode = 2
|
||||
@ -81,7 +83,7 @@ offset_bottom = -61.0
|
||||
texture = ExtResource("3_wfu8f")
|
||||
metadata/_edit_use_anchors_ = true
|
||||
|
||||
[node name="Label" type="Label" parent="MarginContainer/NinePatchRect/TextureRect"]
|
||||
[node name="event_name" type="Label" parent="MarginContainer/NinePatchRect/TextureRect"]
|
||||
layout_mode = 0
|
||||
anchor_left = 0.102521
|
||||
anchor_right = 0.860504
|
||||
@ -109,7 +111,7 @@ anchor_right = 0.425764
|
||||
anchor_bottom = 1.0
|
||||
metadata/_edit_use_anchors_ = true
|
||||
|
||||
[node name="Label" type="Label" parent="MarginContainer/NinePatchRect/VBoxContainer"]
|
||||
[node name="event_intro" type="Label" parent="MarginContainer/NinePatchRect/VBoxContainer"]
|
||||
layout_mode = 2
|
||||
size_flags_vertical = 0
|
||||
theme_override_font_sizes/font_size = 32
|
||||
@ -124,18 +126,18 @@ size_flags_vertical = 2
|
||||
custom_minimum_size = Vector2(0, 47.975)
|
||||
layout_mode = 2
|
||||
|
||||
[node name="VBoxContainer" type="VBoxContainer" parent="MarginContainer/NinePatchRect/VBoxContainer/VBoxContainer"]
|
||||
[node name="choice_add_pos" type="VBoxContainer" parent="MarginContainer/NinePatchRect/VBoxContainer/VBoxContainer"]
|
||||
layout_mode = 2
|
||||
theme_override_constants/separation = 36
|
||||
|
||||
[node name="event_choice_button" parent="MarginContainer/NinePatchRect/VBoxContainer/VBoxContainer/VBoxContainer" instance=ExtResource("7_o3va1")]
|
||||
[node name="event_choice_button" parent="MarginContainer/NinePatchRect/VBoxContainer/VBoxContainer/choice_add_pos" instance=ExtResource("7_o3va1")]
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 4
|
||||
|
||||
[node name="event_choice_button2" parent="MarginContainer/NinePatchRect/VBoxContainer/VBoxContainer/VBoxContainer" instance=ExtResource("7_o3va1")]
|
||||
[node name="event_choice_button2" parent="MarginContainer/NinePatchRect/VBoxContainer/VBoxContainer/choice_add_pos" instance=ExtResource("7_o3va1")]
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 4
|
||||
|
||||
[node name="event_choice_button3" parent="MarginContainer/NinePatchRect/VBoxContainer/VBoxContainer/VBoxContainer" instance=ExtResource("7_o3va1")]
|
||||
[node name="event_choice_button3" parent="MarginContainer/NinePatchRect/VBoxContainer/VBoxContainer/choice_add_pos" instance=ExtResource("7_o3va1")]
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 4
|
||||
|
24
scene/event_choice_button.gd
Normal file
24
scene/event_choice_button.gd
Normal file
@ -0,0 +1,24 @@
|
||||
extends NinePatchRect
|
||||
signal click
|
||||
var data:Dictionary
|
||||
@onready var label: Label = $Label
|
||||
|
||||
func set_data(d:Dictionary):
|
||||
|
||||
data=d
|
||||
label.text=data.name
|
||||
pass
|
||||
|
||||
# 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_tool_button_pressed() -> void:
|
||||
click.emit()
|
||||
pass # Replace with function body.
|
@ -1,6 +1,7 @@
|
||||
[gd_scene load_steps=3 format=3 uid="uid://lleg0undaq1q"]
|
||||
[gd_scene load_steps=4 format=3 uid="uid://lleg0undaq1q"]
|
||||
|
||||
[ext_resource type="Texture2D" uid="uid://cpy1wo8fwnnr2" path="res://res/ui/ui_020_event/tuceng307.png" id="1_6roma"]
|
||||
[ext_resource type="Script" path="res://scene/event_choice_button.gd" id="2_mr7bp"]
|
||||
[ext_resource type="PackedScene" uid="uid://bdlo2wn4qnygv" path="res://scene/tool/tool_button.tscn" id="2_wanh2"]
|
||||
|
||||
[node name="event_choice_button" type="NinePatchRect"]
|
||||
@ -12,6 +13,7 @@ patch_margin_left = 12
|
||||
patch_margin_top = 5
|
||||
patch_margin_right = 41
|
||||
patch_margin_bottom = 12
|
||||
script = ExtResource("2_mr7bp")
|
||||
|
||||
[node name="Label" type="Label" parent="."]
|
||||
layout_mode = 1
|
||||
@ -27,3 +29,5 @@ vertical_alignment = 1
|
||||
|
||||
[node name="ToolButton" parent="." instance=ExtResource("2_wanh2")]
|
||||
layout_mode = 1
|
||||
|
||||
[connection signal="pressed" from="ToolButton" to="." method="_on_tool_button_pressed"]
|
||||
|
17
scene/game_flow.gd
Normal file
17
scene/game_flow.gd
Normal file
@ -0,0 +1,17 @@
|
||||
extends Control
|
||||
@onready var back: TextureRect = $back
|
||||
@onready var event: HBoxContainer = $bottom_container/event
|
||||
const GAME_FLOW_EVENT = preload("res://scene/game_flow_event.tscn")
|
||||
var scene_data:Dictionary
|
||||
func _ready() -> void:
|
||||
set_scene("scene_01")
|
||||
func set_scene(id:String):
|
||||
scene_data=Global.get_scene_data(id)
|
||||
back.texture=Global.get_texture(scene_data["texture"])
|
||||
for i in event.get_children():
|
||||
i.queue_free()
|
||||
for i in scene_data["quick_event"]:
|
||||
var new_btn=GAME_FLOW_EVENT.instantiate()
|
||||
event.add_child(new_btn)
|
||||
new_btn.set_data(i)
|
||||
pass
|
@ -1,6 +1,7 @@
|
||||
[gd_scene load_steps=16 format=3 uid="uid://bht5sd88340s5"]
|
||||
[gd_scene load_steps=18 format=3 uid="uid://bht5sd88340s5"]
|
||||
|
||||
[ext_resource type="Texture2D" uid="uid://5vyvaedcfv38" path="res://res/ui/ui_019_game_flow/tuceng1.png" id="1_gjw3y"]
|
||||
[ext_resource type="Script" path="res://scene/game_flow.gd" id="1_w6afk"]
|
||||
[ext_resource type="Texture2D" uid="uid://bfxq2lfnecjue" path="res://res/ui/ui_019_game_flow/juxing505.png" id="2_w5ej7"]
|
||||
[ext_resource type="PackedScene" uid="uid://clhtya30fwcwp" path="res://scene/game_flow_card.tscn" id="3_c6hhr"]
|
||||
[ext_resource type="PackedScene" uid="uid://bsegldhx3w3ws" path="res://scene/game_flow_event.tscn" id="3_h6xm4"]
|
||||
@ -15,6 +16,7 @@
|
||||
[ext_resource type="Texture2D" uid="uid://mxpgc8rjbhhe" path="res://res/ui/ui_019_game_flow/tuceng280.png" id="13_ll8xc"]
|
||||
[ext_resource type="Texture2D" uid="uid://cfkrivnhdpg8l" path="res://res/ui/ui_019_game_flow/tuceng281.png" id="14_5tsah"]
|
||||
[ext_resource type="PackedScene" uid="uid://dr7aeaevf1qun" path="res://scene/game_flow_place.tscn" id="15_2cypk"]
|
||||
[ext_resource type="PackedScene" uid="uid://b3hw4w5shpyu0" path="res://scene/event.tscn" id="17_xt42m"]
|
||||
|
||||
[node name="game_flow" type="Control"]
|
||||
layout_mode = 3
|
||||
@ -23,6 +25,7 @@ anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
script = ExtResource("1_w6afk")
|
||||
|
||||
[node name="back" type="TextureRect" parent="."]
|
||||
layout_mode = 1
|
||||
@ -355,3 +358,7 @@ layout_mode = 2
|
||||
|
||||
[node name="game_flow_place4" parent="VBoxContainer" instance=ExtResource("15_2cypk")]
|
||||
layout_mode = 2
|
||||
|
||||
[node name="event" parent="." instance=ExtResource("17_xt42m")]
|
||||
visible = false
|
||||
layout_mode = 1
|
||||
|
7
scene/game_flow_event.gd
Normal file
7
scene/game_flow_event.gd
Normal file
@ -0,0 +1,7 @@
|
||||
extends Panel
|
||||
@onready var label: Label = $Label
|
||||
|
||||
var data:Dictionary
|
||||
func set_data(d:Dictionary):
|
||||
data=d
|
||||
label.text=data.name
|
@ -1,7 +1,8 @@
|
||||
[gd_scene load_steps=4 format=3 uid="uid://bsegldhx3w3ws"]
|
||||
[gd_scene load_steps=5 format=3 uid="uid://bsegldhx3w3ws"]
|
||||
|
||||
[ext_resource type="Texture2D" uid="uid://bl6dhkx6ryu7r" path="res://res/ui/ui_019_game_flow/tuceng291.png" id="1_6cbmv"]
|
||||
[ext_resource type="PackedScene" uid="uid://bdlo2wn4qnygv" path="res://scene/tool/tool_button.tscn" id="2_cbja7"]
|
||||
[ext_resource type="Script" path="res://scene/game_flow_event.gd" id="2_x3nbb"]
|
||||
|
||||
[sub_resource type="StyleBoxTexture" id="StyleBoxTexture_xe0iq"]
|
||||
texture = ExtResource("1_6cbmv")
|
||||
@ -18,6 +19,7 @@ offset_bottom = 255.0
|
||||
size_flags_horizontal = 8
|
||||
size_flags_vertical = 10
|
||||
theme_override_styles/panel = SubResource("StyleBoxTexture_xe0iq")
|
||||
script = ExtResource("2_x3nbb")
|
||||
|
||||
[node name="Label" type="Label" parent="."]
|
||||
layout_mode = 2
|
||||
|
@ -19,3 +19,8 @@ func _on_new_story_pressed() -> void:
|
||||
func _on_control_back() -> void:
|
||||
$DrawerContainer.change_open(false)
|
||||
pass # Replace with function body.
|
||||
|
||||
|
||||
func _on_zhaomu_pressed() -> void:
|
||||
$DrawerContainer2.change_open(true)
|
||||
pass # Replace with function body.
|
||||
|
@ -455,7 +455,7 @@ offset_right = 1.52588e-05
|
||||
texture = ExtResource("17_l8nah")
|
||||
metadata/_edit_use_anchors_ = true
|
||||
|
||||
[node name="ToolButton" parent="MarginContainer/HBoxContainer/VBoxContainer2/VBoxContainer/HBoxContainer2/TextureRect2" instance=ExtResource("17_37v8w")]
|
||||
[node name="zhaomu" parent="MarginContainer/HBoxContainer/VBoxContainer2/VBoxContainer/HBoxContainer2/TextureRect2" instance=ExtResource("17_37v8w")]
|
||||
layout_mode = 1
|
||||
|
||||
[node name="tab" type="Control" parent="MarginContainer/HBoxContainer/VBoxContainer2/VBoxContainer/HBoxContainer2"]
|
||||
@ -646,4 +646,5 @@ rag = 1.0
|
||||
layout_mode = 2
|
||||
|
||||
[connection signal="pressed" from="MarginContainer/HBoxContainer/VBoxContainer2/VBoxContainer/HBoxContainer/TextureRect/new_story" to="." method="_on_new_story_pressed"]
|
||||
[connection signal="pressed" from="MarginContainer/HBoxContainer/VBoxContainer2/VBoxContainer/HBoxContainer2/TextureRect2/zhaomu" to="." method="_on_zhaomu_pressed"]
|
||||
[connection signal="back" from="DrawerContainer/select" to="." method="_on_control_back"]
|
||||
|
@ -27,7 +27,8 @@ var now_selected_script:String="history"
|
||||
var now_selected_script_id:String
|
||||
func _ready() -> void:
|
||||
init_button_connection()
|
||||
generate_debug_data(20)
|
||||
#generate_debug_data(20)
|
||||
get_global_script_data()
|
||||
load_now_script()
|
||||
func load_now_script():
|
||||
btn_group.clear()
|
||||
@ -38,7 +39,7 @@ func load_now_script():
|
||||
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.set_texture(Global.get_texture(now_select_array[i]["side_texture"]))
|
||||
new_btn.pressed.connect(side_btn_clicked.bind(i))
|
||||
btn_group.append(new_btn)
|
||||
side_btn_clicked(0)
|
||||
@ -47,6 +48,9 @@ func load_now_script():
|
||||
func _process(delta: float) -> void:
|
||||
pass
|
||||
func side_btn_clicked(ind:int):
|
||||
if ind>=btn_group.size():
|
||||
now_selected_script_id=""
|
||||
return
|
||||
var btn=btn_group[ind]
|
||||
|
||||
if btn!=selected_button:
|
||||
@ -55,12 +59,18 @@ func side_btn_clicked(ind:int):
|
||||
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"]))
|
||||
set_script_texture(Global.get_texture(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 get_global_script_data():
|
||||
var glbdt=Global.get_all_script_data()
|
||||
data["history"]=glbdt[0].values()
|
||||
data["fantasy"]=glbdt[1].values()
|
||||
data["reality"]=glbdt[2].values()
|
||||
data["eschatological"]=glbdt[3].values()
|
||||
func generate_debug_data(debug_size:int):
|
||||
var arr=[[],[],[],[]]
|
||||
for i in debug_size:
|
||||
|
@ -49,3 +49,13 @@ func _on_button_3_mouse_entered() -> void:
|
||||
func _on_button_4_mouse_entered() -> void:
|
||||
target = %Button4
|
||||
pass # Replace with function body.
|
||||
|
||||
|
||||
func _on_button_4_pressed() -> void:
|
||||
get_tree().quit()
|
||||
pass # Replace with function body.
|
||||
|
||||
|
||||
func _on_button_pressed() -> void:
|
||||
SceneManager.change_scene_to("res://scene/main.tscn")
|
||||
pass # Replace with function body.
|
||||
|
@ -155,6 +155,8 @@ mouse_filter = 2
|
||||
texture = ExtResource("5_yiext")
|
||||
|
||||
[connection signal="mouse_entered" from="MarginContainer/VBoxContainer2/VBoxContainer/Button" to="." method="_on_button_mouse_entered"]
|
||||
[connection signal="pressed" from="MarginContainer/VBoxContainer2/VBoxContainer/Button" to="." method="_on_button_pressed"]
|
||||
[connection signal="mouse_entered" from="MarginContainer/VBoxContainer2/VBoxContainer/Button2" to="." method="_on_button_2_mouse_entered"]
|
||||
[connection signal="mouse_entered" from="MarginContainer/VBoxContainer2/VBoxContainer/Button3" to="." method="_on_button_3_mouse_entered"]
|
||||
[connection signal="mouse_entered" from="MarginContainer/VBoxContainer2/VBoxContainer/Button4" to="." method="_on_button_4_mouse_entered"]
|
||||
[connection signal="pressed" from="MarginContainer/VBoxContainer2/VBoxContainer/Button4" to="." method="_on_button_4_pressed"]
|
||||
|
BIN
test/texture/test_character.png
Normal file
BIN
test/texture/test_character.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 45 KiB |
34
test/texture/test_character.png.import
Normal file
34
test/texture/test_character.png.import
Normal file
@ -0,0 +1,34 @@
|
||||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://dsovcr2v3bhb0"
|
||||
path="res://.godot/imported/test_character.png-516576976e207e70285aa2c3898ddaf8.ctex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://test/texture/test_character.png"
|
||||
dest_files=["res://.godot/imported/test_character.png-516576976e207e70285aa2c3898ddaf8.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
|
BIN
test/texture/test_scene.png
Normal file
BIN
test/texture/test_scene.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 8.7 MiB |
34
test/texture/test_scene.png.import
Normal file
34
test/texture/test_scene.png.import
Normal file
@ -0,0 +1,34 @@
|
||||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://0nmyul46p1ss"
|
||||
path="res://.godot/imported/test_scene.png-a96b2cf4e56e059a60fff4bf73f3db05.ctex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://test/texture/test_scene.png"
|
||||
dest_files=["res://.godot/imported/test_scene.png-a96b2cf4e56e059a60fff4bf73f3db05.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
|
Loading…
Reference in New Issue
Block a user