9.26上午

This commit is contained in:
TsubakiLoL 2024-09-26 11:49:53 +08:00
parent 5f39096cb2
commit 2b523d05fc
12 changed files with 140 additions and 46 deletions

View File

@ -35,7 +35,7 @@ var now_game_data:Dictionary={
"script_data":{
},
"now_scene":"scene_01",
"now_scene":"",
"difficulty":0,
"gold":9999,
"health":100,
@ -263,38 +263,47 @@ func load_card_data():
card_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(true)
else:
return null
#获取全部剧本数据,数组
func get_all_script_data():
return script_type_divide_data.duplicate()
#获取对应ID的事件数据
func get_event_data(id:String):
if event_data.has(id):
var dictionary:Dictionary=event_data[id]
return dictionary.duplicate(true)
else:
return null
#获取对应ID的场景数据
func get_scene_data(id:String):
if scene_data.has(id):
var dictionary:Dictionary=scene_data[id]
return dictionary.duplicate(true)
else:
return null
#获取对应ID的角色数据
func get_character_data(id:String):
if character_data.has(id):
var dictionary:Dictionary=character_data[id]
return dictionary.duplicate(true)
else:
return null
#获取全部角色数据
func get_all_character(id:String)->Dictionary:
return character_data.duplicate(true)
#获取对应ID的地图数据
func get_map_data(id:String):
if map_data.has(id):
var dictionary:Dictionary=map_data[id]
@ -302,6 +311,7 @@ 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]
@ -309,6 +319,7 @@ func get_npc_data(id:String):
else:
return null
pass
#获取对应ID的卡牌数据
func get_card_data(id:String):
if card_data.has(id):
var dictionary:Dictionary=card_data[id]

View File

@ -58,6 +58,10 @@ static func get_skin_now_use_data(character_data:Dictionary)->Dictionary:
return character_data["character"]["skin"][character_data["character"]["skin_now_use"]]
static func get_character_name(character_data:Dictionary)->String:
return character_data["character"]["name"]
pass
static func get_character_star_num(character_data:Dictionary)->int:
return int(character_data["character"]["star"])
pass
static func get_initiative_value(character_data:Dictionary)->int:
var AGI=get_character_attribute(character_data,"AGI")

View File

@ -14,7 +14,7 @@
"skin_now_use":0
},
"basic_mes":{
"script_category":"剧本类别",
"type":0,
"place":"地点",
"sex":0,
"race":"种族",

View File

@ -10,8 +10,13 @@
"year":1860,
"month":1,
"day":1,
"week":1
}
},
"finish_date":{
"year":1860,
"month":2,
"day":1,
},
"init_scene":"scene_01",
},
"script_002":{

16
scene/character_bag.gd Normal file
View File

@ -0,0 +1,16 @@
extends Control
const CHARACTER_BAG_CARD = preload("res://scene/character_bag_card.tscn")
func _ready() -> void:
pass
func _on_back_btn_pressed() -> void:
get_parent().change_open(false)
pass # Replace with function body.
func refresh():
pass

View File

@ -1,6 +1,7 @@
[gd_scene load_steps=19 format=3 uid="uid://cgl1vcdusqroq"]
[gd_scene load_steps=21 format=3 uid="uid://cgl1vcdusqroq"]
[ext_resource type="Texture2D" uid="uid://bxbwbvgbfntiv" path="res://res/ui/ui_004_character_bag/tuceng1.png" id="1_688g7"]
[ext_resource type="Script" path="res://scene/character_bag.gd" id="1_e5f2o"]
[ext_resource type="Texture2D" uid="uid://bt5qrcsynsp6j" path="res://res/ui/ui_004_character_bag/tuceng231.png" id="2_bq8dd"]
[ext_resource type="Texture2D" uid="uid://bi4qd4hkdm4wb" path="res://res/ui/ui_004_character_bag/tuceng35.png" id="3_m44x5"]
[ext_resource type="PackedScene" uid="uid://dacsn16xvd4dj" path="res://scene/character_bag_card.tscn" id="4_i7p8r"]
@ -11,6 +12,7 @@
[ext_resource type="Texture2D" uid="uid://ddwgjg72ivkwn" path="res://res/ui/ui_004_character_bag/tuceng39.png" id="8_pn6mv"]
[ext_resource type="Texture2D" uid="uid://p68ycyicgxxe" path="res://res/ui/ui_004_character_bag/tuceng40.png" id="9_tg2kw"]
[ext_resource type="Texture2D" uid="uid://bq23yis2bwf3d" path="res://res/ui/ui_004_character_bag/tuceng41.png" id="10_ijoj6"]
[ext_resource type="PackedScene" uid="uid://chh7gr3qbkr8u" path="res://scene/basic_message.tscn" id="13_lbwxs"]
[sub_resource type="StyleBoxEmpty" id="StyleBoxEmpty_3l4tb"]
@ -36,6 +38,7 @@ anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
script = ExtResource("1_e5f2o")
[node name="back" type="TextureRect" parent="."]
layout_mode = 1
@ -48,18 +51,19 @@ texture = ExtResource("1_688g7")
expand_mode = 1
stretch_mode = 6
[node name="Button" type="Button" parent="."]
[node name="back_texture" type="TextureRect" parent="."]
layout_mode = 1
anchors_preset = -1
anchor_left = 0.00677083
anchor_top = 0.0138889
anchor_right = 0.0677083
anchor_bottom = 0.0833333
offset_right = -8.0
offset_bottom = -8.0
focus_mode = 0
icon = ExtResource("2_bq8dd")
flat = true
anchor_right = 0.00677083
anchor_bottom = 0.014
offset_right = 117.0
offset_bottom = 74.88
texture = ExtResource("2_bq8dd")
[node name="back_btn" parent="back_texture" instance=ExtResource("7_6v0oc")]
layout_mode = 1
[node name="NinePatchRect" type="NinePatchRect" parent="."]
layout_mode = 0
@ -89,42 +93,43 @@ layout_mode = 2
horizontal_scroll_mode = 0
vertical_scroll_mode = 3
[node name="flow" type="HFlowContainer" parent="NinePatchRect/MarginContainer/ScrollContainer"]
[node name="card_add_pos" type="HFlowContainer" parent="NinePatchRect/MarginContainer/ScrollContainer"]
unique_name_in_owner = true
layout_mode = 2
size_flags_horizontal = 3
size_flags_vertical = 0
[node name="TextureRect" parent="NinePatchRect/MarginContainer/ScrollContainer/flow" instance=ExtResource("4_i7p8r")]
[node name="TextureRect" parent="NinePatchRect/MarginContainer/ScrollContainer/card_add_pos" instance=ExtResource("4_i7p8r")]
layout_mode = 2
[node name="TextureRect2" parent="NinePatchRect/MarginContainer/ScrollContainer/flow" instance=ExtResource("4_i7p8r")]
[node name="TextureRect2" parent="NinePatchRect/MarginContainer/ScrollContainer/card_add_pos" instance=ExtResource("4_i7p8r")]
layout_mode = 2
[node name="TextureRect3" parent="NinePatchRect/MarginContainer/ScrollContainer/flow" instance=ExtResource("4_i7p8r")]
[node name="TextureRect3" parent="NinePatchRect/MarginContainer/ScrollContainer/card_add_pos" instance=ExtResource("4_i7p8r")]
layout_mode = 2
[node name="TextureRect4" parent="NinePatchRect/MarginContainer/ScrollContainer/flow" instance=ExtResource("4_i7p8r")]
[node name="TextureRect4" parent="NinePatchRect/MarginContainer/ScrollContainer/card_add_pos" instance=ExtResource("4_i7p8r")]
layout_mode = 2
[node name="TextureRect5" parent="NinePatchRect/MarginContainer/ScrollContainer/flow" instance=ExtResource("4_i7p8r")]
[node name="TextureRect5" parent="NinePatchRect/MarginContainer/ScrollContainer/card_add_pos" instance=ExtResource("4_i7p8r")]
layout_mode = 2
[node name="TextureRect6" parent="NinePatchRect/MarginContainer/ScrollContainer/flow" instance=ExtResource("4_i7p8r")]
[node name="TextureRect6" parent="NinePatchRect/MarginContainer/ScrollContainer/card_add_pos" instance=ExtResource("4_i7p8r")]
layout_mode = 2
[node name="TextureRect7" parent="NinePatchRect/MarginContainer/ScrollContainer/flow" instance=ExtResource("4_i7p8r")]
[node name="TextureRect7" parent="NinePatchRect/MarginContainer/ScrollContainer/card_add_pos" instance=ExtResource("4_i7p8r")]
layout_mode = 2
[node name="TextureRect8" parent="NinePatchRect/MarginContainer/ScrollContainer/flow" instance=ExtResource("4_i7p8r")]
[node name="TextureRect8" parent="NinePatchRect/MarginContainer/ScrollContainer/card_add_pos" instance=ExtResource("4_i7p8r")]
layout_mode = 2
[node name="TextureRect9" parent="NinePatchRect/MarginContainer/ScrollContainer/flow" instance=ExtResource("4_i7p8r")]
[node name="TextureRect9" parent="NinePatchRect/MarginContainer/ScrollContainer/card_add_pos" instance=ExtResource("4_i7p8r")]
layout_mode = 2
[node name="TextureRect10" parent="NinePatchRect/MarginContainer/ScrollContainer/flow" instance=ExtResource("4_i7p8r")]
[node name="TextureRect10" parent="NinePatchRect/MarginContainer/ScrollContainer/card_add_pos" instance=ExtResource("4_i7p8r")]
layout_mode = 2
[node name="TextureRect11" parent="NinePatchRect/MarginContainer/ScrollContainer/flow" instance=ExtResource("4_i7p8r")]
[node name="TextureRect11" parent="NinePatchRect/MarginContainer/ScrollContainer/card_add_pos" instance=ExtResource("4_i7p8r")]
layout_mode = 2
[node name="NinePatchRect2" type="NinePatchRect" parent="."]
@ -174,7 +179,7 @@ size_flags_stretch_ratio = 3.0
theme_override_font_sizes/font_size = 34
text = "全部"
[node name="ToolButton" parent="NinePatchRect2/MarginContainer/VBoxContainer/PanelContainer" instance=ExtResource("7_6v0oc")]
[node name="all" parent="NinePatchRect2/MarginContainer/VBoxContainer/PanelContainer" instance=ExtResource("7_6v0oc")]
layout_mode = 2
[node name="PanelContainer2" type="PanelContainer" parent="NinePatchRect2/MarginContainer/VBoxContainer"]
@ -200,7 +205,7 @@ size_flags_stretch_ratio = 3.0
theme_override_font_sizes/font_size = 34
text = "历史"
[node name="ToolButton" parent="NinePatchRect2/MarginContainer/VBoxContainer/PanelContainer2" instance=ExtResource("7_6v0oc")]
[node name="history" parent="NinePatchRect2/MarginContainer/VBoxContainer/PanelContainer2" instance=ExtResource("7_6v0oc")]
layout_mode = 2
[node name="PanelContainer3" type="PanelContainer" parent="NinePatchRect2/MarginContainer/VBoxContainer"]
@ -226,7 +231,7 @@ size_flags_stretch_ratio = 3.0
theme_override_font_sizes/font_size = 34
text = "奇幻"
[node name="ToolButton" parent="NinePatchRect2/MarginContainer/VBoxContainer/PanelContainer3" instance=ExtResource("7_6v0oc")]
[node name="fantasy" parent="NinePatchRect2/MarginContainer/VBoxContainer/PanelContainer3" instance=ExtResource("7_6v0oc")]
layout_mode = 2
[node name="PanelContainer4" type="PanelContainer" parent="NinePatchRect2/MarginContainer/VBoxContainer"]
@ -252,7 +257,7 @@ size_flags_stretch_ratio = 3.0
theme_override_font_sizes/font_size = 34
text = "现实"
[node name="ToolButton" parent="NinePatchRect2/MarginContainer/VBoxContainer/PanelContainer4" instance=ExtResource("7_6v0oc")]
[node name="reality" parent="NinePatchRect2/MarginContainer/VBoxContainer/PanelContainer4" instance=ExtResource("7_6v0oc")]
layout_mode = 2
[node name="PanelContainer5" type="PanelContainer" parent="NinePatchRect2/MarginContainer/VBoxContainer"]
@ -280,3 +285,10 @@ text = "末世"
[node name="ToolButton" parent="NinePatchRect2/MarginContainer/VBoxContainer/PanelContainer5" instance=ExtResource("7_6v0oc")]
layout_mode = 2
[node name="basic_mes" parent="." instance=ExtResource("13_lbwxs")]
unique_name_in_owner = true
visible = false
layout_mode = 1
[connection signal="pressed" from="back_texture/back_btn" to="." method="_on_back_btn_pressed"]

View File

@ -1,14 +1,10 @@
extends TextureRect
class_name CharacterBagCard
#被按下时发出
signal self_click(card:CharacterBagCard)
signal self_click(data:Dictionary)
@onready var star_group:Array[TextureRect]=[$mask/HBoxContainer/HBoxContainer/TextureRect, $mask/HBoxContainer/HBoxContainer/TextureRect2, $mask/HBoxContainer/HBoxContainer/TextureRect3, $mask/HBoxContainer/HBoxContainer/TextureRect4, $mask/HBoxContainer/HBoxContainer/TextureRect5]
#初始化数据应先更改此字典然后进行add child 触发ready
var data={
"star_num":3,
"face":"res://res/ui/ui_003_select/test.png",
"name":"角色名字"
}
var data:Dictionary
#设置星数
func set_star_num(num:int):
for i in star_group.size():
@ -27,11 +23,11 @@ func set_character_name(n:String):
%n.text=n
pass
func _ready() -> void:
set_star_num(data.star_num)
set_face(data.face)
set_character_name(data.name)
set_star_num(CharacterTool.get_character_star_num(data))
set_face(CharacterTool.get_skin_now_use_data(data)["card_face"])
set_character_name(CharacterTool.get_character_name(data))
func _on_button_pressed() -> void:
self_click.emit(self)
self_click.emit(data)
pass # Replace with function body.

View File

@ -116,3 +116,20 @@ func get_sort_all_unit():
sort_arr.sort_custom(sort)
return sort_arr
pass
func reset():
set_process(false)
for i in character_arr:
i.queue_free()
character_arr.clear()
for i in enermy_arr:
i.queue_free()
enermy_arr.clear()
if user!=null:
user.queue_free()
user=null

View File

@ -1,4 +1,4 @@
[gd_scene load_steps=25 format=3 uid="uid://bht5sd88340s5"]
[gd_scene load_steps=26 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"]
@ -18,6 +18,7 @@
[ext_resource type="PackedScene" uid="uid://b3hw4w5shpyu0" path="res://scene/event.tscn" id="17_xt42m"]
[ext_resource type="Shader" path="res://res/shader/change_scene.gdshader" id="18_ubmfk"]
[ext_resource type="PackedScene" uid="uid://ccsaeb8hm5lsu" path="res://scene/map.tscn" id="19_fok85"]
[ext_resource type="PackedScene" uid="uid://chh7gr3qbkr8u" path="res://scene/basic_message.tscn" id="19_xvka5"]
[sub_resource type="Gradient" id="Gradient_4wq1v"]
@ -437,4 +438,8 @@ libraries = {
visible = false
layout_mode = 1
[node name="basic_mes" parent="." instance=ExtResource("19_xvka5")]
visible = false
layout_mode = 1
[connection signal="pressed" from="HBoxContainer/TextureRect3/map" to="." method="_on_map_pressed"]

View File

@ -24,3 +24,8 @@ func _on_control_back() -> void:
func _on_zhaomu_pressed() -> void:
$DrawerContainer2.change_open(true)
pass # Replace with function body.
func _on_character_btn_pressed() -> void:
%bag_card_drawer.change_open(true)
pass # Replace with function body.

View File

@ -1,4 +1,4 @@
[gd_scene load_steps=37 format=3 uid="uid://bbsr3gcxo3lcl"]
[gd_scene load_steps=38 format=3 uid="uid://bbsr3gcxo3lcl"]
[ext_resource type="Script" path="res://scene/main.gd" id="1_aevx8"]
[ext_resource type="Texture2D" uid="uid://bchvegwghynrm" path="res://res/ui/ui_002_main/tuceng1.png" id="1_q2tgu"]
@ -35,6 +35,7 @@
[ext_resource type="Script" path="res://class/tool/DrawerContainer.gd" id="33_2nl8b"]
[ext_resource type="PackedScene" uid="uid://33lcg23hy4mi" path="res://scene/select.tscn" id="34_wkvs0"]
[ext_resource type="PackedScene" uid="uid://batc5tlfgbqm5" path="res://scene/banner.tscn" id="35_qckx8"]
[ext_resource type="PackedScene" uid="uid://cgl1vcdusqroq" path="res://scene/character_bag.tscn" id="36_2e8de"]
[sub_resource type="StyleBoxEmpty" id="StyleBoxEmpty_1b8r4"]
@ -425,7 +426,7 @@ expand_mode = 1
stretch_mode = 5
metadata/_edit_use_anchors_ = true
[node name="ToolButton" parent="MarginContainer/HBoxContainer/VBoxContainer2/VBoxContainer/HBoxContainer2/TextureRect" instance=ExtResource("17_37v8w")]
[node name="character_btn" parent="MarginContainer/HBoxContainer/VBoxContainer2/VBoxContainer/HBoxContainer2/TextureRect" instance=ExtResource("17_37v8w")]
layout_mode = 1
[node name="TextureRect2" type="TextureRect" parent="MarginContainer/HBoxContainer/VBoxContainer2/VBoxContainer/HBoxContainer2"]
@ -645,6 +646,25 @@ rag = 1.0
[node name="banner" parent="DrawerContainer2" instance=ExtResource("35_qckx8")]
layout_mode = 2
[node name="bag_card_drawer" type="Container" parent="."]
unique_name_in_owner = true
layout_mode = 1
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
mouse_filter = 2
script = ExtResource("33_2nl8b")
button_model = 1
disable_button = true
is_open = false
rag = 1.0
[node name="Control" parent="bag_card_drawer" instance=ExtResource("36_2e8de")]
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/TextureRect/character_btn" to="." method="_on_character_btn_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"]

View File

@ -142,9 +142,12 @@ func init_button_connection():
func _on_enter_button_pressed() -> void:
enter_script.emit(now_selected_script_id)
Global.now_game_data["script_data"]=Global.get_script_data(now_selected_script_id)
$DrawerContainer2.change_open(true)
pass # Replace with function body.
var script_data=Global.get_script_data(now_selected_script_id)
if script_data!=null:
Global.now_game_data["script_data"]=script_data
Global.set_now_scene(script_data["init_scene"])
$DrawerContainer2.change_open(true)
pass # Replace with function body.
func _on_continue_button_pressed() -> void: