diff --git a/autoload/global/script/global.gd b/autoload/global/script/global.gd index 09ca16d..4efd058 100644 --- a/autoload/global/script/global.gd +++ b/autoload/global/script/global.gd @@ -19,7 +19,11 @@ var system_config_data:Dictionary={ var now_game_data:Dictionary={ - "time":99999 + "time":99999, + "character":{ + + }, + "unlock_character":["test_character_01"] } func _ready() -> void: load_texture_data() @@ -98,7 +102,7 @@ func get_scene_data(id:String): return null func get_character_data(id:String): if character_data.has(id): - var dictionary:Dictionary=scene_data[id] + var dictionary:Dictionary=character_data[id] return dictionary.duplicate() else: return null diff --git a/scene/character_select.gd b/scene/character_select.gd index 237a609..7fdebbd 100644 --- a/scene/character_select.gd +++ b/scene/character_select.gd @@ -1,13 +1,30 @@ 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 + +var now_select_node +var now_select_data: + set(val): + start.disable(val==null) + now_select_data=val var data:Dictionary={ } func _on_back_pressed() -> void: back.emit() pass # Replace with function body. - +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"]: + 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={ @@ -15,7 +32,19 @@ func generate_debug_data(debug_size:int): "texture":"texture_test", } - - - - pass +func pressed(data,node,is_select): + + if is_select: + now_select_data=data + now_select_node=node + else: + now_select_data=null + now_select_node=null + + + pass + + +func _on_start_pressed() -> void: + start_game.emit(now_select_data) + pass # Replace with function body. diff --git a/scene/character_select.tscn b/scene/character_select.tscn index 266b775..a6fd871 100644 --- a/scene/character_select.tscn +++ b/scene/character_select.tscn @@ -115,51 +115,51 @@ size_flags_horizontal = 3 horizontal_scroll_mode = 2 vertical_scroll_mode = 0 -[node name="VFlowContainer" type="VFlowContainer" parent="VBoxContainer/HBoxContainer/margin/HBoxContainer/ScrollContainer"] +[node name="character_add_pos" type="VFlowContainer" parent="VBoxContainer/HBoxContainer/margin/HBoxContainer/ScrollContainer"] layout_mode = 2 size_flags_horizontal = 0 size_flags_vertical = 3 -[node name="character_select_card" parent="VBoxContainer/HBoxContainer/margin/HBoxContainer/ScrollContainer/VFlowContainer" instance=ExtResource("8_6whmw")] +[node name="character_select_card" parent="VBoxContainer/HBoxContainer/margin/HBoxContainer/ScrollContainer/character_add_pos" instance=ExtResource("8_6whmw")] layout_mode = 2 -[node name="character_select_card2" parent="VBoxContainer/HBoxContainer/margin/HBoxContainer/ScrollContainer/VFlowContainer" instance=ExtResource("8_6whmw")] +[node name="character_select_card2" parent="VBoxContainer/HBoxContainer/margin/HBoxContainer/ScrollContainer/character_add_pos" instance=ExtResource("8_6whmw")] layout_mode = 2 -[node name="character_select_card3" parent="VBoxContainer/HBoxContainer/margin/HBoxContainer/ScrollContainer/VFlowContainer" instance=ExtResource("8_6whmw")] +[node name="character_select_card3" parent="VBoxContainer/HBoxContainer/margin/HBoxContainer/ScrollContainer/character_add_pos" instance=ExtResource("8_6whmw")] layout_mode = 2 -[node name="character_select_card4" parent="VBoxContainer/HBoxContainer/margin/HBoxContainer/ScrollContainer/VFlowContainer" instance=ExtResource("8_6whmw")] +[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/VFlowContainer" instance=ExtResource("8_6whmw")] +[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/VFlowContainer" instance=ExtResource("8_6whmw")] +[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/VFlowContainer" instance=ExtResource("8_6whmw")] +[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/VFlowContainer" instance=ExtResource("8_6whmw")] +[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/VFlowContainer" instance=ExtResource("8_6whmw")] +[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/VFlowContainer" instance=ExtResource("8_6whmw")] +[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/VFlowContainer" instance=ExtResource("8_6whmw")] +[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/VFlowContainer" instance=ExtResource("8_6whmw")] +[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/VFlowContainer" instance=ExtResource("8_6whmw")] +[node name="character_select_card13" parent="VBoxContainer/HBoxContainer/margin/HBoxContainer/ScrollContainer/character_add_pos" instance=ExtResource("8_6whmw")] layout_mode = 2 -[node name="character_select_card14" parent="VBoxContainer/HBoxContainer/margin/HBoxContainer/ScrollContainer/VFlowContainer" instance=ExtResource("8_6whmw")] +[node name="character_select_card14" parent="VBoxContainer/HBoxContainer/margin/HBoxContainer/ScrollContainer/character_add_pos" instance=ExtResource("8_6whmw")] layout_mode = 2 [node name="TextureRect2" type="TextureRect" parent="VBoxContainer/HBoxContainer/margin/HBoxContainer"] @@ -190,7 +190,9 @@ text = "开始游戏" horizontal_alignment = 1 vertical_alignment = 1 -[node name="ToolButton" parent="VBoxContainer/HBoxContainer2/TextureRect" instance=ExtResource("9_mkt3x")] +[node name="start" parent="VBoxContainer/HBoxContainer2/TextureRect" instance=ExtResource("9_mkt3x")] layout_mode = 1 +disabled = true [connection signal="pressed" from="VBoxContainer/HBoxContainer/VBoxContainer/MarginContainer/TextureRect/back" to="." method="_on_back_pressed"] +[connection signal="pressed" from="VBoxContainer/HBoxContainer2/TextureRect/start" to="." method="_on_start_pressed"] diff --git a/scene/character_select_card.gd b/scene/character_select_card.gd index 6d85f15..b8ba7bd 100644 --- a/scene/character_select_card.gd +++ b/scene/character_select_card.gd @@ -9,11 +9,28 @@ var is_selected:bool=false: %select_texture.hide() pass is_selected=val +@onready var texture_face: TextureRect = %texture_face + var data:Dictionary={ } -signal pressed(data) +signal pressed(data,node,is_select) func _on_tool_button_pressed() -> void: - pressed.emit(data) + is_selected=!is_selected + pressed.emit(data,self,is_selected) pass # Replace with function body. + +func _ready() -> void: + + #set_data(Global.get_character_data("test_character_01")) + + pass + +func set_data(_data:Dictionary): + data=_data + var skin_data=data["character"]["skin"][data["character"]["skin_now_use"]] + texture_face.texture=Global.get_texture(skin_data["card_face"]) + + + pass diff --git a/scene/difficulty_selection.gd b/scene/difficulty_selection.gd index 05f0f1e..381eeea 100644 --- a/scene/difficulty_selection.gd +++ b/scene/difficulty_selection.gd @@ -1,5 +1,6 @@ extends Control signal back +signal select(ind:int) const JUXING_15 = preload("res://res/ui/ui_018_difficulty_selection/juxing15.png") @onready var t_button:Array[TextureButton]=[$CenterContainer/HBoxContainer/TextureRect, $CenterContainer/HBoxContainer/TextureRect2, $CenterContainer/HBoxContainer/TextureRect3] # Called when the node enters the scene tree for the first time. @@ -22,3 +23,18 @@ func _process(delta: float) -> void: func _on_back_pressed() -> void: back.emit() pass # Replace with function body. + + +func _on_texture_rect_pressed() -> void: + select.emit(0) + pass # Replace with function body. + + +func _on_texture_rect_2_pressed() -> void: + select.emit(1) + pass # Replace with function body. + + +func _on_texture_rect_3_pressed() -> void: + select.emit(2) + pass # Replace with function body. diff --git a/scene/difficulty_selection.tscn b/scene/difficulty_selection.tscn index febb981..d1a236f 100644 --- a/scene/difficulty_selection.tscn +++ b/scene/difficulty_selection.tscn @@ -186,4 +186,7 @@ metadata/_edit_use_anchors_ = true [node name="back" parent="TextureRect" instance=ExtResource("2_geis3")] layout_mode = 1 +[connection signal="pressed" from="CenterContainer/HBoxContainer/TextureRect" to="." method="_on_texture_rect_pressed"] +[connection signal="pressed" from="CenterContainer/HBoxContainer/TextureRect2" to="." method="_on_texture_rect_2_pressed"] +[connection signal="pressed" from="CenterContainer/HBoxContainer/TextureRect3" to="." method="_on_texture_rect_3_pressed"] [connection signal="pressed" from="TextureRect/back" to="." method="_on_back_pressed"] diff --git a/scene/select.gd b/scene/select.gd index d495a2b..803a78f 100644 --- a/scene/select.gd +++ b/scene/select.gd @@ -142,7 +142,7 @@ func init_button_connection(): func _on_enter_button_pressed() -> void: enter_script.emit(now_selected_script_id) - $DrawerContainer.change_open(true) + $DrawerContainer2.change_open(true) pass # Replace with function body. @@ -164,3 +164,12 @@ func _on_character_select_back() -> void: func _on_difficulty_selection_back() -> void: $DrawerContainer2.change_open(false) pass # Replace with function body. + + +func _on_difficulty_selection_select(ind: int) -> void: + $DrawerContainer.change_open(true) + pass # Replace with function body. + + +func _on_character_select_start_game(character_data: Dictionary) -> void: + pass # Replace with function body. diff --git a/scene/select.tscn b/scene/select.tscn index e55c7fe..8cd913a 100644 --- a/scene/select.tscn +++ b/scene/select.tscn @@ -541,22 +541,6 @@ libraries = { "": SubResource("AnimationLibrary_8lk2v") } -[node name="DrawerContainer" type="Container" parent="."] -z_index = 1 -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("18_qtiy2") -is_open = false -rag = 1.0 - -[node name="character_select" parent="DrawerContainer" instance=ExtResource("17_cueqv")] -layout_mode = 2 - [node name="DrawerContainer2" type="Container" parent="."] z_index = 1 layout_mode = 1 @@ -575,8 +559,26 @@ rag = 1.0 [node name="difficulty_selection" parent="DrawerContainer2" instance=ExtResource("20_168x8")] layout_mode = 2 +[node name="DrawerContainer" type="Container" parent="."] +z_index = 1 +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("18_qtiy2") +is_open = false +rag = 1.0 + +[node name="character_select" parent="DrawerContainer" instance=ExtResource("17_cueqv")] +layout_mode = 2 + [connection signal="pressed" from="HBoxContainer/continue_texture/continue_button" to="." method="_on_continue_button_pressed"] [connection signal="pressed" from="back_button/ToolButton" to="." method="_on_back_button_pressed"] [connection signal="pressed" from="enter_texture/enter_button" to="." method="_on_enter_button_pressed"] -[connection signal="back" from="DrawerContainer/character_select" to="." method="_on_character_select_back"] [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"] diff --git a/scene/tool/tool_button.gd b/scene/tool/tool_button.gd index 0a86998..32fef87 100644 --- a/scene/tool/tool_button.gd +++ b/scene/tool/tool_button.gd @@ -13,3 +13,10 @@ static func static_on_button_down(canvas:CanvasItem) -> void: static func static_on_button_up(canvas:CanvasItem) -> void: canvas.modulate=Color(1,1,1,1) pass # Replace with function body.ion body. +func disable(is_disable:bool): + disabled=is_disable + if is_disable: + get_parent().modulate=Color(0.5,0.5,0.5,1) + else: + get_parent().modulate=Color(1,1,1,1) +