9.23上午
This commit is contained in:
parent
7a68edea9f
commit
f2a5809732
@ -15,6 +15,12 @@ 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 npc_json_path:String="res://json/npc.json"
|
||||
var npc_data:Dictionary
|
||||
|
||||
|
||||
|
||||
var system_config_data:Dictionary={
|
||||
|
||||
}
|
||||
@ -73,6 +79,12 @@ func call_triger(triger_type:String,data):
|
||||
return triger[triger_type].call(data)
|
||||
else:
|
||||
return null
|
||||
var condition_triger:Dictionary={
|
||||
"date_limit":"",
|
||||
"time_limit":"",
|
||||
"rand":"",
|
||||
|
||||
}
|
||||
func move_scene(scene_id:String,distance):
|
||||
if scene_id==get_now_scene():
|
||||
return false
|
||||
@ -97,6 +109,7 @@ func _ready() -> void:
|
||||
load_scene_data()
|
||||
load_character_data()
|
||||
load_map_data()
|
||||
load_npc_data()
|
||||
func load_texture_data():
|
||||
var file=FileAccess.open(texture_json_path,FileAccess.READ)
|
||||
var str=file.get_as_text()
|
||||
@ -147,7 +160,13 @@ func load_map_data():
|
||||
for i in dictionary.keys():
|
||||
dictionary[i]["id"]=i
|
||||
map_data=dictionary
|
||||
|
||||
func load_npc_data():
|
||||
var file=FileAccess.open(npc_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
|
||||
npc_data=dictionary
|
||||
func get_texture(id:String):
|
||||
if texture_data.has(id):
|
||||
return texture_data[id]
|
||||
@ -187,3 +206,10 @@ func get_map_data(id:String):
|
||||
else:
|
||||
return null
|
||||
pass
|
||||
func get_npc_data(id:String):
|
||||
if npc_data.has(id):
|
||||
var dictionary:Dictionary=npc_data[id]
|
||||
return dictionary.duplicate()
|
||||
else:
|
||||
return null
|
||||
pass
|
||||
|
@ -155,6 +155,182 @@
|
||||
}
|
||||
],
|
||||
|
||||
"favor":[{
|
||||
"name":"姐姐",
|
||||
"value":100
|
||||
}
|
||||
],
|
||||
"reputation":[
|
||||
{
|
||||
"name":"某地区",
|
||||
"value":100
|
||||
}
|
||||
]
|
||||
},
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
"test_character_02":{
|
||||
"character":{
|
||||
"name":"朱雀院椿(NPC)",
|
||||
"star":3,
|
||||
|
||||
"skin":[
|
||||
{
|
||||
"name":"皮肤1",
|
||||
"card_face":"test_character_tsubaki",
|
||||
"character":"角色图片路径"
|
||||
}
|
||||
],
|
||||
"skin_now_use":0
|
||||
},
|
||||
"basic_mes":{
|
||||
"script_category":"剧本类别",
|
||||
"place":"地点",
|
||||
"sex":0,
|
||||
"race":"种族",
|
||||
"birthday":"xxxx-xx-xx",
|
||||
|
||||
"introduction":"这是一个介绍",
|
||||
"basic_attribute":[
|
||||
{
|
||||
"name":"体质",
|
||||
"value":100,
|
||||
},
|
||||
{
|
||||
"name":"敏捷",
|
||||
"value":100,
|
||||
},
|
||||
{
|
||||
"name":"智力",
|
||||
"value":100,
|
||||
},
|
||||
{
|
||||
"name":"感知",
|
||||
"value":100,
|
||||
},
|
||||
],
|
||||
"fight_attribute":[
|
||||
{
|
||||
"name":"生命",
|
||||
"value":100,
|
||||
},
|
||||
{
|
||||
"name":"精神",
|
||||
"value":100,
|
||||
},
|
||||
{
|
||||
"name":"物理攻击",
|
||||
"value":100,
|
||||
},
|
||||
{
|
||||
"name":"法术强度",
|
||||
"value":100,
|
||||
},
|
||||
]
|
||||
},
|
||||
"special":[
|
||||
{
|
||||
"name":"倾国倾城",
|
||||
"introduction":"鼠标点击显示具体效果鼠标点击显示具体效果鼠标点击显示具体效果鼠标点击显示具体效果鼠标点击显示具体效果鼠标点击显示具体效果鼠标点击显示具体效果鼠标点击显示具体效果"
|
||||
}
|
||||
],
|
||||
"ability":[
|
||||
{
|
||||
"name":"武学 LV3",
|
||||
"introduction":"鼠标点击显示具体效果鼠标点击显示具体效果鼠标点击显示具体效果鼠标点击显示具体效果鼠标点击显示具体效果鼠标点击显示具体效果鼠标点击显示具体效果鼠标点击显示具体效果"
|
||||
}
|
||||
],
|
||||
|
||||
"favor":[{
|
||||
"name":"姐姐",
|
||||
"value":100
|
||||
}
|
||||
],
|
||||
"reputation":[
|
||||
{
|
||||
"name":"某地区",
|
||||
"value":100
|
||||
}
|
||||
]
|
||||
},
|
||||
"test_character_02":{
|
||||
"character":{
|
||||
"name":"朱雀院椿(测试)",
|
||||
"star":3,
|
||||
"skin":[
|
||||
{
|
||||
"name":"皮肤1",
|
||||
"card_face":"test_character_tsubaki",
|
||||
"character":"角色图片路径"
|
||||
}
|
||||
],
|
||||
"skin_now_use":0
|
||||
},
|
||||
"basic_mes":{
|
||||
"script_category":"剧本类别",
|
||||
"place":"地点",
|
||||
"sex":0,
|
||||
"race":"种族",
|
||||
"birthday":"xxxx-xx-xx",
|
||||
|
||||
"introduction":"这是一个介绍",
|
||||
"basic_attribute":[
|
||||
{
|
||||
"name":"体质",
|
||||
"value":100,
|
||||
},
|
||||
{
|
||||
"name":"敏捷",
|
||||
"value":100,
|
||||
},
|
||||
{
|
||||
"name":"智力",
|
||||
"value":100,
|
||||
},
|
||||
{
|
||||
"name":"感知",
|
||||
"value":100,
|
||||
},
|
||||
],
|
||||
"fight_attribute":[
|
||||
{
|
||||
"name":"生命",
|
||||
"value":100,
|
||||
},
|
||||
{
|
||||
"name":"精神",
|
||||
"value":100,
|
||||
},
|
||||
{
|
||||
"name":"物理攻击",
|
||||
"value":100,
|
||||
},
|
||||
{
|
||||
"name":"法术强度",
|
||||
"value":100,
|
||||
},
|
||||
]
|
||||
},
|
||||
"special":[
|
||||
{
|
||||
"name":"倾国倾城",
|
||||
"introduction":"鼠标点击显示具体效果鼠标点击显示具体效果鼠标点击显示具体效果鼠标点击显示具体效果鼠标点击显示具体效果鼠标点击显示具体效果鼠标点击显示具体效果鼠标点击显示具体效果"
|
||||
}
|
||||
],
|
||||
"ability":[
|
||||
{
|
||||
"name":"武学 LV3",
|
||||
"introduction":"鼠标点击显示具体效果鼠标点击显示具体效果鼠标点击显示具体效果鼠标点击显示具体效果鼠标点击显示具体效果鼠标点击显示具体效果鼠标点击显示具体效果鼠标点击显示具体效果"
|
||||
}
|
||||
],
|
||||
|
||||
"favor":[{
|
||||
"name":"姐姐",
|
||||
"value":100
|
||||
|
5
json/npc.json
Normal file
5
json/npc.json
Normal file
@ -0,0 +1,5 @@
|
||||
{
|
||||
"测试npc_1":{
|
||||
|
||||
}
|
||||
}
|
@ -63,7 +63,18 @@
|
||||
"id":"scene_01",
|
||||
"distance":100
|
||||
}
|
||||
]
|
||||
],
|
||||
"touch":{
|
||||
|
||||
"测试互动点1":{
|
||||
"triger":[],
|
||||
"event":["event_01"]
|
||||
},
|
||||
"测试互动点2":{
|
||||
"triger":[],
|
||||
"character":[]
|
||||
}
|
||||
}
|
||||
|
||||
},
|
||||
}
|
||||
|
@ -26,6 +26,7 @@ Bgm="*res://autoload/BGM/tscn/bgm.tscn"
|
||||
|
||||
window/size/viewport_width=1920
|
||||
window/size/viewport_height=1080
|
||||
window/size/mode=3
|
||||
|
||||
[editor_plugins]
|
||||
|
||||
|
@ -10,6 +10,7 @@ class_name GameFlow
|
||||
@onready var character_name: Label = $hbox/TextureRect2/vbox/HBoxContainer/character_name
|
||||
@onready var map: Control = $map
|
||||
@onready var date: Label = $hbox/TextureRect2/vbox/date
|
||||
@onready var touch_add_pos: Control = $touch_add_pos
|
||||
|
||||
const GAME_FLOW_TOUCH = preload("res://scene/game_flow_touch.tscn")
|
||||
|
||||
@ -31,6 +32,8 @@ func set_scene(id:String):
|
||||
i.queue_free()
|
||||
for i in place_add.get_children():
|
||||
i.queue_free()
|
||||
for i in touch_add_pos.get_children():
|
||||
i.queue_free()
|
||||
for i in scene_data["quick_event"]:
|
||||
var new_btn=GAME_FLOW_EVENT.instantiate()
|
||||
event.add_child(new_btn)
|
||||
@ -41,6 +44,11 @@ func set_scene(id:String):
|
||||
place_add.add_child(new_place)
|
||||
new_place.set_data(i)
|
||||
new_place.pressed.connect(place_pressed)
|
||||
pass
|
||||
for i in scene_data["touch"]:
|
||||
|
||||
|
||||
|
||||
pass
|
||||
pass
|
||||
|
||||
|
@ -89,6 +89,14 @@ texture = ExtResource("1_gjw3y")
|
||||
expand_mode = 1
|
||||
stretch_mode = 6
|
||||
|
||||
[node name="touch_add_pos" type="Control" parent="."]
|
||||
layout_mode = 1
|
||||
anchors_preset = 15
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
|
||||
[node name="NinePatchRect" type="NinePatchRect" parent="."]
|
||||
layout_mode = 0
|
||||
anchor_left = 0.0166667
|
||||
@ -379,11 +387,18 @@ texture = ExtResource("14_5tsah")
|
||||
layout_mode = 1
|
||||
|
||||
[node name="place_add" type="VBoxContainer" parent="."]
|
||||
layout_mode = 0
|
||||
offset_left = 1610.0
|
||||
offset_top = 119.0
|
||||
offset_right = 1886.0
|
||||
offset_bottom = 633.0
|
||||
layout_mode = 1
|
||||
anchors_preset = -1
|
||||
anchor_left = 1.0
|
||||
anchor_top = 0.136
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 0.136
|
||||
offset_left = -281.0
|
||||
offset_top = 0.119995
|
||||
offset_right = -5.0
|
||||
offset_bottom = 383.12
|
||||
grow_horizontal = 0
|
||||
grow_vertical = 2
|
||||
theme_override_constants/separation = 37
|
||||
|
||||
[node name="game_flow_place" parent="place_add" instance=ExtResource("15_2cypk")]
|
||||
|
10
scene/game_flow_touch.gd
Normal file
10
scene/game_flow_touch.gd
Normal file
@ -0,0 +1,10 @@
|
||||
extends MarginContainer
|
||||
|
||||
signal touch_click()
|
||||
|
||||
|
||||
func judge():
|
||||
|
||||
|
||||
|
||||
pass
|
@ -1,5 +1,6 @@
|
||||
[gd_scene load_steps=8 format=3 uid="uid://bk0xuj6xb5n8n"]
|
||||
[gd_scene load_steps=9 format=3 uid="uid://bk0xuj6xb5n8n"]
|
||||
|
||||
[ext_resource type="Script" path="res://scene/game_flow_touch.gd" id="1_maikt"]
|
||||
[ext_resource type="Texture2D" uid="uid://xjk24mq7dqjp" path="res://res/ui/ui_019_game_flow/tuceng11.png" id="1_rc7al"]
|
||||
[ext_resource type="Texture2D" uid="uid://bowl27hko0yx2" path="res://res/ui/ui_019_game_flow/tuceng13.png" id="2_2pfym"]
|
||||
[ext_resource type="Texture2D" uid="uid://824g8kb1h4o4" path="res://res/ui/ui_019_game_flow/tuoyuan1.png" id="3_garvq"]
|
||||
@ -8,9 +9,12 @@
|
||||
[ext_resource type="Texture2D" uid="uid://cpito436o4akn" path="res://res/ui/ui_019_game_flow/tuceng10.png" id="5_oqc0n"]
|
||||
[ext_resource type="PackedScene" uid="uid://bdlo2wn4qnygv" path="res://scene/tool/tool_button.tscn" id="7_xebjv"]
|
||||
|
||||
[node name="HBoxContainer" type="MarginContainer"]
|
||||
offset_right = 204.0
|
||||
offset_bottom = 204.0
|
||||
[node name="margin" type="MarginContainer"]
|
||||
offset_left = -102.0
|
||||
offset_top = -102.0
|
||||
offset_right = 102.0
|
||||
offset_bottom = 102.0
|
||||
script = ExtResource("1_maikt")
|
||||
|
||||
[node name="HBoxContainer" type="HBoxContainer" parent="."]
|
||||
layout_mode = 2
|
||||
|
66
scene/map.gd
66
scene/map.gd
@ -13,37 +13,47 @@ extends Control
|
||||
@onready var pointer: Label = $ScrollContainer/HBoxContainer/map_add_pos/pointer_map/pointer
|
||||
|
||||
|
||||
var map_tween:Array=[null,null]
|
||||
func recreate_map_tween():
|
||||
for i in map_tween.size():
|
||||
if map_tween[i]==null:
|
||||
map_tween[i]=get_tree().create_tween()
|
||||
else:
|
||||
map_tween[i].stop()
|
||||
map_tween[i].kill()
|
||||
|
||||
map_tween[i]=get_tree().create_tween()
|
||||
func show_map_animation(map_from,map_next):
|
||||
recreate_map_tween()
|
||||
map_from.modulate.a=1
|
||||
map_next.modulate.a=1
|
||||
var map=[map_0,map_1,map_2]
|
||||
for i in map:
|
||||
if not i in [map_from,map_next]:
|
||||
i.hide()
|
||||
i.modulate.a=1
|
||||
else:
|
||||
i.show()
|
||||
|
||||
map_tween[0].tween_property(map_from,"modulate:a",0,0.1)
|
||||
map_tween[0].tween_callback(map_from.hide)
|
||||
map_tween[1].tween_property(map_next,"modulate:a",1,0.1)
|
||||
|
||||
#map_from.hide()
|
||||
#map_next.show()
|
||||
pass
|
||||
signal scene_change(scene_id:String)
|
||||
var scale_rag:float=1:
|
||||
set(val):
|
||||
if val>scale_index_1 and val<scale_index_2 and (scale_rag<scale_index_1 or scale_rag>scale_index_2):
|
||||
var t=get_tree().create_tween()
|
||||
t.tween_property(map_now,"modulate:a",0,0.1)
|
||||
t.tween_callback(map_now.hide)
|
||||
var t2=get_tree().create_tween()
|
||||
map_1.modulate.a=0
|
||||
map_1.show()
|
||||
show_map_animation(map_now,map_1)
|
||||
map_now=map_1
|
||||
t2.tween_property(map_1,"modulate:a",1,0.1)
|
||||
elif val<=scale_index_1 and scale_rag>scale_index_1:
|
||||
var t=get_tree().create_tween()
|
||||
t.tween_property(map_now,"modulate:a",0,0.1)
|
||||
t.tween_callback(map_now.hide)
|
||||
var t2=get_tree().create_tween()
|
||||
map_0.modulate.a=0
|
||||
map_0.show()
|
||||
show_map_animation(map_now,map_0)
|
||||
map_now=map_0
|
||||
t2.tween_property(map_0,"modulate:a",1,0.1)
|
||||
elif val>scale_index_2 and scale_rag<scale_index_2:
|
||||
var t=get_tree().create_tween()
|
||||
t.tween_property(map_now,"modulate:a",0,0.1)
|
||||
t.tween_callback(map_now.hide)
|
||||
var t2=get_tree().create_tween()
|
||||
map_2.modulate.a=0
|
||||
map_2.show()
|
||||
show_map_animation(map_now,map_2)
|
||||
map_now=map_2
|
||||
t2.tween_property(map_2,"modulate:a",1,0.1)
|
||||
resize_map(scale_rag,val,get_global_mouse_position(),init_size)
|
||||
scale_rag=val
|
||||
pass
|
||||
@ -53,6 +63,7 @@ var scale_index_1:float=1.2
|
||||
var scale_index_2:float=1.5
|
||||
var map_data:Dictionary
|
||||
func set_map(id:String):
|
||||
set_process(true)
|
||||
scale_rag=1
|
||||
map_data=Global.get_map_data(id)
|
||||
var map_index:Array=map_data["index"]
|
||||
@ -98,6 +109,7 @@ func update_pointer():
|
||||
var now_scene_id=Global.get_now_scene()
|
||||
var pos=map_now.get_scene_global_pos(now_scene_id)-Vector2(pointer.size.x/2,pointer.size.y)
|
||||
pointer.global_position=pos
|
||||
print(pos)
|
||||
func click(scene_id:String):
|
||||
print(scene_id)
|
||||
if scene_id==Global.get_now_scene():
|
||||
@ -106,6 +118,7 @@ func click(scene_id:String):
|
||||
var is_success:bool=Global.move_scene(scene_id,map_now.get_scene_distance(Global.get_now_scene(),scene_id))
|
||||
if is_success:
|
||||
self.hide()
|
||||
self.set_process(false)
|
||||
|
||||
var init_size:Vector2=Vector2(1920,1080)
|
||||
# Called when the node enters the scene tree for the first time.
|
||||
@ -130,21 +143,24 @@ func _gui_input(event: InputEvent) -> void:
|
||||
scroll_container.scroll_vertical-=relative.y
|
||||
if Input.is_action_pressed("mouse_up"):
|
||||
if keep_tween==null:
|
||||
keep_tween=create_tween()
|
||||
keep_tween=get_tree().create_tween()
|
||||
else:
|
||||
keep_tween.stop()
|
||||
keep_tween=create_tween()
|
||||
keep_tween.kill()
|
||||
keep_tween=get_tree().create_tween()
|
||||
keep_tween.tween_property(self,"scale_rag",clamp(scale_rag+0.2,scale_limit_min,scale_limit_max),0.1)
|
||||
if Input.is_action_just_pressed("mouse_down"):
|
||||
if keep_tween==null:
|
||||
keep_tween=create_tween()
|
||||
keep_tween=get_tree().create_tween()
|
||||
else:
|
||||
keep_tween.stop()
|
||||
keep_tween=create_tween()
|
||||
keep_tween.kill()
|
||||
keep_tween=get_tree().create_tween()
|
||||
keep_tween.tween_property(self,"scale_rag",clamp(scale_rag-0.2,scale_limit_min,scale_limit_max),0.1)
|
||||
|
||||
|
||||
|
||||
func _on_back_pressed() -> void:
|
||||
set_process(false)
|
||||
self.hide()
|
||||
pass # Replace with function body.
|
||||
|
@ -76,6 +76,7 @@ visible = false
|
||||
layout_mode = 2
|
||||
|
||||
[node name="pointer_map" type="Control" parent="ScrollContainer/HBoxContainer/map_add_pos"]
|
||||
z_index = 2
|
||||
layout_mode = 2
|
||||
|
||||
[node name="pointer" type="Label" parent="ScrollContainer/HBoxContainer/map_add_pos/pointer_map"]
|
||||
@ -83,11 +84,10 @@ z_index = 3
|
||||
layout_mode = 1
|
||||
anchors_preset = -1
|
||||
anchor_left = -0.027
|
||||
anchor_right = 1.031
|
||||
anchor_bottom = 1.0
|
||||
offset_left = 38.88
|
||||
offset_right = -1435.64
|
||||
offset_bottom = -956.0
|
||||
anchor_right = -0.027
|
||||
offset_left = 91.295
|
||||
offset_right = 140.295
|
||||
offset_bottom = 124.0
|
||||
theme_override_font_sizes/font_size = 90
|
||||
text = "⬇"
|
||||
horizontal_alignment = 1
|
||||
|
@ -2,14 +2,13 @@ extends MapIndex
|
||||
|
||||
|
||||
|
||||
|
||||
func _on_tool_button_pressed() -> void:
|
||||
click_scene("scene_tower")
|
||||
pass # Replace with function body.
|
||||
func get_scene_global_pos(scene_id:String):
|
||||
match scene_id:
|
||||
"scene_tower":
|
||||
return $TextureRect/ToolButton.global_position
|
||||
return $TextureRect/ToolButton.global_position+Vector2($TextureRect/ToolButton.size.x/2,0)
|
||||
_:return Vector2(0,0)
|
||||
|
||||
pass
|
||||
|
Loading…
Reference in New Issue
Block a user