From fa517b71c318e9b5aa3c3c8860bdf27963adb027 Mon Sep 17 00:00:00 2001 From: TsubakiLoL <2789646812@qq.com> Date: Fri, 20 Sep 2024 17:31:23 +0800 Subject: [PATCH] =?UTF-8?q?9.20=E4=B8=8B=E5=8D=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- autoload/global/script/global.gd | 12 +++-- json/character.json | 85 +++++++++++++++++++++++++++++++- scene/character_select.gd | 17 +++---- scene/character_select.tscn | 24 --------- scene/character_select_card.gd | 13 +++-- scene/character_select_card.tscn | 26 +++++----- scene/difficulty_selection.gd | 3 ++ scene/select.gd | 1 + scene/select.tscn | 1 - 9 files changed, 128 insertions(+), 54 deletions(-) diff --git a/autoload/global/script/global.gd b/autoload/global/script/global.gd index 4efd058..87d45bc 100644 --- a/autoload/global/script/global.gd +++ b/autoload/global/script/global.gd @@ -16,14 +16,18 @@ var character_data:Dictionary var system_config_data:Dictionary={ } - +var system_game_data:Dictionary={ + "unlock_character":["test_character_01","test_character_02"] +} var now_game_data:Dictionary={ - "time":99999, - "character":{ + "character_data":{ }, - "unlock_character":["test_character_01"] + "script_data":{ + + }, + "difficulty":0 } func _ready() -> void: load_texture_data() diff --git a/json/character.json b/json/character.json index 99349f4..4914119 100644 --- a/json/character.json +++ b/json/character.json @@ -2,7 +2,90 @@ "test_character_01":{ "character":{ "name":"朱雀院椿(测试)", - "star":5, + "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", diff --git a/scene/character_select.gd b/scene/character_select.gd index 7fdebbd..a69b8ed 100644 --- a/scene/character_select.gd +++ b/scene/character_select.gd @@ -1,6 +1,5 @@ extends Control signal back -signal start_game(character_data:Dictionary) const CHARACTER_SELECT_CARD = preload("res://scene/character_select_card.tscn") @onready var character_add_pos: VFlowContainer = $VBoxContainer/HBoxContainer/margin/HBoxContainer/ScrollContainer/character_add_pos @onready var start: ToolButton = $VBoxContainer/HBoxContainer2/TextureRect/start @@ -8,8 +7,11 @@ const CHARACTER_SELECT_CARD = preload("res://scene/character_select_card.tscn") var now_select_node var now_select_data: set(val): + if now_select_node!=null: + now_select_node.is_selected=false start.disable(val==null) now_select_data=val + var data:Dictionary={ } @@ -20,18 +22,12 @@ func _ready() -> void: start.disable(true) for i in character_add_pos.get_children(): i.queue_free() - for i in Global.now_game_data["unlock_character"]: + for i in Global.system_game_data["unlock_character"]: var new_character=CHARACTER_SELECT_CARD.instantiate() character_add_pos.add_child(new_character) new_character.set_data(Global.get_character_data(i)) new_character.pressed.connect(pressed) -func generate_debug_data(debug_size:int): - for i in debug_size: - var new_card_data={ - "id":"card"+str(i), - "texture":"texture_test", - - } + func pressed(data,node,is_select): if is_select: @@ -46,5 +42,6 @@ func pressed(data,node,is_select): func _on_start_pressed() -> void: - start_game.emit(now_select_data) + Global.now_game_data.character_data=now_select_data + SceneManager.change_scene_to("res://scene/game_flow.tscn") pass # Replace with function body. diff --git a/scene/character_select.tscn b/scene/character_select.tscn index a6fd871..bf9a00c 100644 --- a/scene/character_select.tscn +++ b/scene/character_select.tscn @@ -132,30 +132,6 @@ layout_mode = 2 [node name="character_select_card4" parent="VBoxContainer/HBoxContainer/margin/HBoxContainer/ScrollContainer/character_add_pos" instance=ExtResource("8_6whmw")] layout_mode = 2 -[node name="character_select_card5" parent="VBoxContainer/HBoxContainer/margin/HBoxContainer/ScrollContainer/character_add_pos" instance=ExtResource("8_6whmw")] -layout_mode = 2 - -[node name="character_select_card6" parent="VBoxContainer/HBoxContainer/margin/HBoxContainer/ScrollContainer/character_add_pos" instance=ExtResource("8_6whmw")] -layout_mode = 2 - -[node name="character_select_card7" parent="VBoxContainer/HBoxContainer/margin/HBoxContainer/ScrollContainer/character_add_pos" instance=ExtResource("8_6whmw")] -layout_mode = 2 - -[node name="character_select_card8" parent="VBoxContainer/HBoxContainer/margin/HBoxContainer/ScrollContainer/character_add_pos" instance=ExtResource("8_6whmw")] -layout_mode = 2 - -[node name="character_select_card9" parent="VBoxContainer/HBoxContainer/margin/HBoxContainer/ScrollContainer/character_add_pos" instance=ExtResource("8_6whmw")] -layout_mode = 2 - -[node name="character_select_card10" parent="VBoxContainer/HBoxContainer/margin/HBoxContainer/ScrollContainer/character_add_pos" instance=ExtResource("8_6whmw")] -layout_mode = 2 - -[node name="character_select_card11" parent="VBoxContainer/HBoxContainer/margin/HBoxContainer/ScrollContainer/character_add_pos" instance=ExtResource("8_6whmw")] -layout_mode = 2 - -[node name="character_select_card12" parent="VBoxContainer/HBoxContainer/margin/HBoxContainer/ScrollContainer/character_add_pos" instance=ExtResource("8_6whmw")] -layout_mode = 2 - [node name="character_select_card13" parent="VBoxContainer/HBoxContainer/margin/HBoxContainer/ScrollContainer/character_add_pos" instance=ExtResource("8_6whmw")] layout_mode = 2 diff --git a/scene/character_select_card.gd b/scene/character_select_card.gd index b8ba7bd..cf47a5d 100644 --- a/scene/character_select_card.gd +++ b/scene/character_select_card.gd @@ -10,8 +10,15 @@ var is_selected:bool=false: pass is_selected=val @onready var texture_face: TextureRect = %texture_face +@onready var star_group=[$mask/HBoxContainer/HBoxContainer/TextureRect, $mask/HBoxContainer/HBoxContainer/TextureRect2, $mask/HBoxContainer/HBoxContainer/TextureRect3, $mask/HBoxContainer/HBoxContainer/TextureRect4, $mask/HBoxContainer/HBoxContainer/TextureRect5] +@onready var n: Label = %n - +func set_star_num(num:int): + for i in star_group.size(): + if i void: func _on_texture_rect_pressed() -> void: + Global.now_game_data["difficulty"]=0 select.emit(0) pass # Replace with function body. func _on_texture_rect_2_pressed() -> void: + Global.now_game_data["difficulty"]=1 select.emit(1) pass # Replace with function body. func _on_texture_rect_3_pressed() -> void: + Global.now_game_data["difficulty"]=2 select.emit(2) pass # Replace with function body. diff --git a/scene/select.gd b/scene/select.gd index 803a78f..ab6b47f 100644 --- a/scene/select.gd +++ b/scene/select.gd @@ -142,6 +142,7 @@ 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. diff --git a/scene/select.tscn b/scene/select.tscn index 8cd913a..0d7fd19 100644 --- a/scene/select.tscn +++ b/scene/select.tscn @@ -581,4 +581,3 @@ layout_mode = 2 [connection signal="back" from="DrawerContainer2/difficulty_selection" to="." method="_on_difficulty_selection_back"] [connection signal="select" from="DrawerContainer2/difficulty_selection" to="." method="_on_difficulty_selection_select"] [connection signal="back" from="DrawerContainer/character_select" to="." method="_on_character_select_back"] -[connection signal="start_game" from="DrawerContainer/character_select" to="." method="_on_character_select_start_game"]