9.21上午
This commit is contained in:
parent
467a98b069
commit
41a2ca8f72
@ -13,6 +13,8 @@ var scene_json_path:String="res://json/scene.json"
|
||||
var scene_data:Dictionary
|
||||
var character_json_path:String="res://json/character.json"
|
||||
var character_data:Dictionary
|
||||
var map_json_path:String="res://json/map.json"
|
||||
var map_data:Dictionary
|
||||
var system_config_data:Dictionary={
|
||||
|
||||
}
|
||||
@ -29,9 +31,11 @@ var now_game_data:Dictionary={
|
||||
},
|
||||
"now_scene":"scene_01",
|
||||
"difficulty":0,
|
||||
|
||||
"gold":9999,
|
||||
"health":100,
|
||||
"spirit":999
|
||||
}
|
||||
var now_game_flow
|
||||
var now_game_flow:GameFlow
|
||||
func get_now_character_data():
|
||||
return now_game_data["character_data"]
|
||||
func _ready() -> void:
|
||||
@ -83,6 +87,14 @@ func load_character_data():
|
||||
for i in dictionary.keys():
|
||||
dictionary[i]["id"]=i
|
||||
character_data=dictionary
|
||||
func load_map_data():
|
||||
var file=FileAccess.open(map_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
|
||||
map_data=dictionary
|
||||
|
||||
func get_texture(id:String):
|
||||
if texture_data.has(id):
|
||||
return texture_data[id]
|
||||
@ -115,3 +127,10 @@ func get_character_data(id:String):
|
||||
return dictionary.duplicate()
|
||||
else:
|
||||
return null
|
||||
func get_map_data(id:String):
|
||||
if map_data.has(id):
|
||||
var dictionary:Dictionary=map_data[id]
|
||||
return dictionary.duplicate()
|
||||
else:
|
||||
return null
|
||||
pass
|
||||
|
25
class/map/map_class.gd
Normal file
25
class/map/map_class.gd
Normal file
@ -0,0 +1,25 @@
|
||||
extends ScrollContainer
|
||||
|
||||
class_name Map
|
||||
signal click(scene_id:String)
|
||||
|
||||
|
||||
|
||||
func _gui_input(event: InputEvent) -> void:
|
||||
if event is InputEventMouseMotion and Input.is_action_pressed("mouse_left"):
|
||||
var relative:Vector2=event.relative
|
||||
scroll_horizontal-=relative.x
|
||||
scroll_vertical-=relative.y
|
||||
|
||||
|
||||
|
||||
pass
|
||||
|
||||
|
||||
func _on_linyi_pressed() -> void:
|
||||
click.emit("")
|
||||
pass # Replace with function body.
|
||||
|
||||
|
||||
func _on_jining_pressed() -> void:
|
||||
pass # Replace with function body.
|
@ -1,3 +1,5 @@
|
||||
{
|
||||
|
||||
"card_01":{
|
||||
"name":"测试卡01"
|
||||
}
|
||||
}
|
||||
|
@ -2,7 +2,9 @@
|
||||
"test_character_01":{
|
||||
"character":{
|
||||
"name":"朱雀院椿(测试)",
|
||||
|
||||
"star":3,
|
||||
|
||||
"skin":[
|
||||
{
|
||||
"name":"皮肤1",
|
||||
|
7
json/map.json
Normal file
7
json/map.json
Normal file
@ -0,0 +1,7 @@
|
||||
{
|
||||
"map_01":
|
||||
{
|
||||
"name":"测试地图01",
|
||||
"tscn":""
|
||||
}
|
||||
}
|
@ -29,7 +29,7 @@
|
||||
},
|
||||
{
|
||||
"name":"测试场景事件",
|
||||
"event":"event_02"
|
||||
"event":"event_01"
|
||||
}
|
||||
],
|
||||
"linked_scene":[
|
||||
|
@ -27,7 +27,7 @@ func _ready() -> void:
|
||||
character_add_pos.add_child(new_character)
|
||||
new_character.set_data(Global.get_character_data(i))
|
||||
new_character.pressed.connect(pressed)
|
||||
|
||||
|
||||
func pressed(data,node,is_select):
|
||||
|
||||
if is_select:
|
||||
|
@ -1,4 +1,5 @@
|
||||
extends Control
|
||||
class_name GameFlow
|
||||
@onready var back: TextureRect = $back
|
||||
@onready var event: HBoxContainer = $bottom_container/event
|
||||
@onready var place_add: VBoxContainer = $place_add
|
||||
@ -6,14 +7,17 @@ extends Control
|
||||
@onready var animation_mask: ColorRect = $animation_mask
|
||||
@onready var character_texture: TextureRect = $hbox/TextureRect/TextureRect/character_texture
|
||||
@onready var event_panel: Control = $event_panel
|
||||
@onready var character_name: Label = $hbox/TextureRect2/vbox/HBoxContainer/character_name
|
||||
|
||||
const GAME_FLOW_EVENT = preload("res://scene/game_flow_event.tscn")
|
||||
const GAME_FLOW_PLACE = preload("res://scene/game_flow_place.tscn")
|
||||
var scene_data:Dictionary
|
||||
func _ready() -> void:
|
||||
set_scene("scene_01")
|
||||
Global.now_game_flow=self
|
||||
var character_data=Global.get_now_character_data()
|
||||
character_texture.texture=Global.get_texture(character_data["character"]["skin"][character_data["character"]["skin_now_use"]]["card_face"])
|
||||
character_name.text=character_data["character"]["name"]
|
||||
func set_scene(id:String):
|
||||
scene_data=Global.get_scene_data(id)
|
||||
back.texture=Global.get_texture(scene_data["texture"])
|
||||
|
@ -32,6 +32,21 @@ shader_parameter/cutoff = 1.0
|
||||
shader_parameter/smooth_size = null
|
||||
shader_parameter/mask = SubResource("GradientTexture2D_jb43e")
|
||||
|
||||
[sub_resource type="Animation" id="Animation_bsgds"]
|
||||
length = 0.001
|
||||
tracks/0/type = "value"
|
||||
tracks/0/imported = false
|
||||
tracks/0/enabled = true
|
||||
tracks/0/path = NodePath("animation_mask: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_i6qty"]
|
||||
resource_name = "change"
|
||||
length = 0.5
|
||||
@ -48,21 +63,6 @@ tracks/0/keys = {
|
||||
"values": [1.0, 0.0]
|
||||
}
|
||||
|
||||
[sub_resource type="Animation" id="Animation_bsgds"]
|
||||
length = 0.001
|
||||
tracks/0/type = "value"
|
||||
tracks/0/imported = false
|
||||
tracks/0/enabled = true
|
||||
tracks/0/path = NodePath("animation_mask: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="AnimationLibrary" id="AnimationLibrary_ljrcq"]
|
||||
_data = {
|
||||
"RESET": SubResource("Animation_bsgds"),
|
||||
@ -209,7 +209,7 @@ size_flags_vertical = 3
|
||||
[node name="Control" type="Control" parent="hbox/TextureRect2/vbox/HBoxContainer"]
|
||||
layout_mode = 2
|
||||
|
||||
[node name="Label" type="Label" parent="hbox/TextureRect2/vbox/HBoxContainer"]
|
||||
[node name="character_name" type="Label" parent="hbox/TextureRect2/vbox/HBoxContainer"]
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 3
|
||||
size_flags_vertical = 1
|
||||
|
17
scene/map.gd
Normal file
17
scene/map.gd
Normal file
@ -0,0 +1,17 @@
|
||||
extends Control
|
||||
@onready var date: Label = $HBoxContainer/TextureRect/TextureRect/date
|
||||
@onready var time: Label = $HBoxContainer/TextureRect/TextureRect/time
|
||||
@onready var weather: Label = $HBoxContainer/TextureRect/TextureRect/weather
|
||||
@onready var pos: Label = $HBoxContainer/TextureRect/TextureRect/pos
|
||||
@onready var map_add_pos: Panel = $HBoxContainer/map_add_pos
|
||||
|
||||
|
||||
|
||||
# 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
|
124
scene/map.tscn
124
scene/map.tscn
@ -1,4 +1,9 @@
|
||||
[gd_scene format=3 uid="uid://ccsaeb8hm5lsu"]
|
||||
[gd_scene load_steps=5 format=3 uid="uid://ccsaeb8hm5lsu"]
|
||||
|
||||
[ext_resource type="Texture2D" uid="uid://bx2layh7wm6ft" path="res://res/ui/ui_021_map/tuceng309.png" id="1_e45qx"]
|
||||
[ext_resource type="Script" path="res://scene/map.gd" id="1_ifxi0"]
|
||||
[ext_resource type="Texture2D" uid="uid://bc4vkd7u4s4sb" path="res://res/ui/ui_021_map/tuceng308.png" id="2_slael"]
|
||||
[ext_resource type="Texture2D" uid="uid://bo84mljdw3my8" path="res://res/ui/ui_021_map/tuceng315.png" id="3_4y8t4"]
|
||||
|
||||
[node name="map" type="Control"]
|
||||
layout_mode = 3
|
||||
@ -7,3 +12,120 @@ anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
script = ExtResource("1_ifxi0")
|
||||
|
||||
[node name="HBoxContainer" type="HBoxContainer" parent="."]
|
||||
layout_mode = 1
|
||||
anchors_preset = 15
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
|
||||
[node name="TextureRect" type="TextureRect" parent="HBoxContainer"]
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 0
|
||||
texture = ExtResource("1_e45qx")
|
||||
expand_mode = 3
|
||||
|
||||
[node name="TextureRect" type="TextureRect" parent="HBoxContainer/TextureRect"]
|
||||
z_index = 1
|
||||
layout_mode = 1
|
||||
anchors_preset = 1
|
||||
anchor_left = 1.0
|
||||
anchor_right = 1.0
|
||||
offset_left = 3.94254
|
||||
offset_right = 515.943
|
||||
offset_bottom = 142.0
|
||||
grow_horizontal = 0
|
||||
texture = ExtResource("3_4y8t4")
|
||||
|
||||
[node name="date" type="Label" parent="HBoxContainer/TextureRect/TextureRect"]
|
||||
layout_mode = 0
|
||||
anchor_left = 0.347656
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 0.373239
|
||||
offset_bottom = -4.0
|
||||
theme_override_colors/font_color = Color(0, 0, 0, 1)
|
||||
theme_override_font_sizes/font_size = 38
|
||||
text = "1999/12/12"
|
||||
vertical_alignment = 1
|
||||
metadata/_edit_use_anchors_ = true
|
||||
|
||||
[node name="time" type="Label" parent="HBoxContainer/TextureRect/TextureRect"]
|
||||
layout_mode = 1
|
||||
anchors_preset = -1
|
||||
anchor_left = 0.347656
|
||||
anchor_top = 0.34507
|
||||
anchor_right = 0.556641
|
||||
anchor_bottom = 0.746479
|
||||
offset_bottom = -4.0
|
||||
theme_override_colors/font_color = Color(0, 0, 0, 1)
|
||||
theme_override_font_sizes/font_size = 38
|
||||
text = "12:12"
|
||||
vertical_alignment = 1
|
||||
metadata/_edit_use_anchors_ = true
|
||||
|
||||
[node name="Label3" type="Label" parent="HBoxContainer/TextureRect/TextureRect"]
|
||||
layout_mode = 1
|
||||
anchors_preset = -1
|
||||
anchor_left = 0.59375
|
||||
anchor_top = 0.34507
|
||||
anchor_right = 0.816406
|
||||
anchor_bottom = 0.746479
|
||||
offset_bottom = -4.0
|
||||
theme_override_colors/font_color = Color(0, 0, 0, 1)
|
||||
theme_override_font_sizes/font_size = 38
|
||||
text = "天气:"
|
||||
vertical_alignment = 1
|
||||
metadata/_edit_use_anchors_ = true
|
||||
|
||||
[node name="weather" type="Label" parent="HBoxContainer/TextureRect/TextureRect"]
|
||||
layout_mode = 1
|
||||
anchors_preset = -1
|
||||
anchor_left = 0.816406
|
||||
anchor_top = 0.34507
|
||||
anchor_right = 1.03906
|
||||
anchor_bottom = 0.746479
|
||||
offset_bottom = -4.0
|
||||
theme_override_colors/font_color = Color(0, 0, 0, 1)
|
||||
theme_override_font_sizes/font_size = 38
|
||||
text = "晴"
|
||||
vertical_alignment = 1
|
||||
metadata/_edit_use_anchors_ = true
|
||||
|
||||
[node name="pos" type="Label" parent="HBoxContainer/TextureRect/TextureRect"]
|
||||
layout_mode = 1
|
||||
anchors_preset = -1
|
||||
anchor_left = 0.347656
|
||||
anchor_top = 0.661972
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.06338
|
||||
offset_bottom = -4.0
|
||||
theme_override_colors/font_color = Color(0, 0, 0, 1)
|
||||
theme_override_font_sizes/font_size = 38
|
||||
text = "(000,000)"
|
||||
vertical_alignment = 1
|
||||
metadata/_edit_use_anchors_ = true
|
||||
|
||||
[node name="TextureRect2" type="TextureRect" parent="HBoxContainer"]
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 0
|
||||
texture = ExtResource("2_slael")
|
||||
expand_mode = 3
|
||||
|
||||
[node name="map_add_pos" type="Panel" parent="HBoxContainer"]
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 3
|
||||
|
||||
[node name="TextureRect4" type="TextureRect" parent="HBoxContainer"]
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 8
|
||||
texture = ExtResource("2_slael")
|
||||
expand_mode = 3
|
||||
|
||||
[node name="TextureRect3" type="TextureRect" parent="HBoxContainer"]
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 0
|
||||
texture = ExtResource("1_e45qx")
|
||||
expand_mode = 3
|
||||
|
BIN
test/map/00004.webp
Normal file
BIN
test/map/00004.webp
Normal file
Binary file not shown.
After Width: | Height: | Size: 46 KiB |
34
test/map/00004.webp.import
Normal file
34
test/map/00004.webp.import
Normal file
@ -0,0 +1,34 @@
|
||||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://dsphj1j6nr3j1"
|
||||
path="res://.godot/imported/00004.webp-dbbf622918282e7466b40e708692648d.ctex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://test/map/00004.webp"
|
||||
dest_files=["res://.godot/imported/00004.webp-dbbf622918282e7466b40e708692648d.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
|
39
test/scene/map_example.tscn
Normal file
39
test/scene/map_example.tscn
Normal file
@ -0,0 +1,39 @@
|
||||
[gd_scene load_steps=3 format=3 uid="uid://dtbfpnr54ifod"]
|
||||
|
||||
[ext_resource type="Texture2D" uid="uid://dsphj1j6nr3j1" path="res://test/map/00004.webp" id="1_i44dx"]
|
||||
[ext_resource type="Script" path="res://class/map/map_class.gd" id="1_iwfll"]
|
||||
|
||||
[node name="map_example" type="ScrollContainer"]
|
||||
anchors_preset = 15
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
horizontal_scroll_mode = 3
|
||||
vertical_scroll_mode = 3
|
||||
script = ExtResource("1_iwfll")
|
||||
|
||||
[node name="TextureRect" type="TextureRect" parent="."]
|
||||
custom_minimum_size = Vector2(3840, 2160)
|
||||
layout_mode = 2
|
||||
mouse_filter = 2
|
||||
texture = ExtResource("1_i44dx")
|
||||
|
||||
[node name="linyi" type="Button" parent="TextureRect"]
|
||||
layout_mode = 0
|
||||
anchor_left = 0.418229
|
||||
anchor_top = 0.588889
|
||||
anchor_right = 0.602083
|
||||
anchor_bottom = 0.706481
|
||||
metadata/_edit_use_anchors_ = true
|
||||
|
||||
[node name="jining" type="Button" parent="TextureRect"]
|
||||
layout_mode = 0
|
||||
anchor_left = 0.240625
|
||||
anchor_top = 0.531482
|
||||
anchor_right = 0.408854
|
||||
anchor_bottom = 0.667593
|
||||
metadata/_edit_use_anchors_ = true
|
||||
|
||||
[connection signal="pressed" from="TextureRect/linyi" to="." method="_on_linyi_pressed"]
|
||||
[connection signal="pressed" from="TextureRect/jining" to="." method="_on_jining_pressed"]
|
Loading…
Reference in New Issue
Block a user