From 84a48947118660ff6416665df3bce74367f1d32b Mon Sep 17 00:00:00 2001 From: Tae Hyoung Kang <78776542+kth1888@users.noreply.github.com> Date: Fri, 15 Mar 2024 09:37:32 +0900 Subject: [PATCH] =?UTF-8?q?SVR-167:=20=EB=A0=88=EC=8B=9C=ED=94=BC=EB=B6=81?= =?UTF-8?q?=20=ED=99=94=EB=A9=B4=20=EC=A1=B0=ED=9A=8C=20=EA=B8=B0=EB=8A=A5?= =?UTF-8?q?=20(#142)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * ui: added recipebook ui components * feat: recipe query impl * feat: recipe view with ui --- frontend/Savor-22b/export_presets.cfg | 2 +- frontend/Savor-22b/gql/svr_gql_client.gd | 5 +- frontend/Savor-22b/scenes/house/house.tscn | 1 + .../scenes/house/recipebook/ingredient_no.gd | 16 + .../house/recipebook/ingredient_no.tscn | 53 ++ .../scenes/house/recipebook/ingredient_yes.gd | 19 + .../house/recipebook/ingredient_yes.tscn | 27 ++ .../scenes/house/recipebook/recipe.gd | 63 +++ .../scenes/house/recipebook/recipe.tscn | 108 +++++ .../recipebook/recipe_style_box_flat.tres | 8 + .../scenes/house/recipebook/recipebook.gd | 19 + .../scenes/house/recipebook/recipebook.tscn | 128 +++++ .../house/recipebook/recipebook_preset.tscn | 455 ++++++++++++++++++ .../Savor-22b/scripts/global/scene_context.gd | 4 + frontend/Savor-22b/scripts/scenes/house.gd | 34 +- frontend/Savor-22b/scripts/scenes/intro.gd | 28 +- 16 files changed, 956 insertions(+), 14 deletions(-) create mode 100644 frontend/Savor-22b/scenes/house/recipebook/ingredient_no.gd create mode 100644 frontend/Savor-22b/scenes/house/recipebook/ingredient_no.tscn create mode 100644 frontend/Savor-22b/scenes/house/recipebook/ingredient_yes.gd create mode 100644 frontend/Savor-22b/scenes/house/recipebook/ingredient_yes.tscn create mode 100644 frontend/Savor-22b/scenes/house/recipebook/recipe.gd create mode 100644 frontend/Savor-22b/scenes/house/recipebook/recipe.tscn create mode 100644 frontend/Savor-22b/scenes/house/recipebook/recipe_style_box_flat.tres create mode 100644 frontend/Savor-22b/scenes/house/recipebook/recipebook.gd create mode 100644 frontend/Savor-22b/scenes/house/recipebook/recipebook.tscn create mode 100644 frontend/Savor-22b/scenes/house/recipebook/recipebook_preset.tscn diff --git a/frontend/Savor-22b/export_presets.cfg b/frontend/Savor-22b/export_presets.cfg index 01fdc657..e9f8e26d 100644 --- a/frontend/Savor-22b/export_presets.cfg +++ b/frontend/Savor-22b/export_presets.cfg @@ -23,7 +23,7 @@ custom_template/release="" debug/export_console_wrapper=1 application/icon="" application/icon_interpolation=4 -application/bundle_identifier="com.nbb.games" +application/bundle_identifier="games.not-blond-beard" application/signature="" application/app_category="Games" application/short_version="" diff --git a/frontend/Savor-22b/gql/svr_gql_client.gd b/frontend/Savor-22b/gql/svr_gql_client.gd index 7057afe9..d5efeab1 100644 --- a/frontend/Savor-22b/gql/svr_gql_client.gd +++ b/frontend/Savor-22b/gql/svr_gql_client.gd @@ -2,9 +2,10 @@ extends GQLClient func _ready(): print("client ready") - #set_endpoint(false, "192.168.2.9", 38080, "/graphql") + set_endpoint(false, "1.230.253.103", 38080, "/graphql") + + #set_endpoint(false, "localhost", 38080, "/graphql") - set_endpoint(false, "localhost", 38080, "/graphql") func raw_mutation(query:String): return GQLQueryExecuter.new(endpoint, use_ssl, Mutation.new(query)) diff --git a/frontend/Savor-22b/scenes/house/house.tscn b/frontend/Savor-22b/scenes/house/house.tscn index 6d166b04..4555d904 100644 --- a/frontend/Savor-22b/scenes/house/house.tscn +++ b/frontend/Savor-22b/scenes/house/house.tscn @@ -100,5 +100,6 @@ offset_bottom = 40.0 [connection signal="button_down" from="M/V/menus/V/FarmButton" to="." method="_on_farm_button_button_down"] [connection signal="button_down" from="M/V/menus/V/VillageButton" to="." method="_on_village_button_button_down"] +[connection signal="button_down" from="M/V/menus/V/RecipeButton" to="." method="_on_recipe_button_button_down"] [connection signal="button_down" from="M/V/menus/V/InventoryButton" to="." method="_on_inventory_button_button_down"] [connection signal="button_down" from="M/V/menus/V/RefreshButton" to="." method="_on_refresh_button_button_down"] diff --git a/frontend/Savor-22b/scenes/house/recipebook/ingredient_no.gd b/frontend/Savor-22b/scenes/house/recipebook/ingredient_no.gd new file mode 100644 index 00000000..2cce6170 --- /dev/null +++ b/frontend/Savor-22b/scenes/house/recipebook/ingredient_no.gd @@ -0,0 +1,16 @@ +extends Control + +@onready var ingnametxt = $NoIng/Desc/Name +var ingname + +func _ready(): + update_info() + + + + +func set_ingname(name: String): + ingname = name + +func update_info(): + ingnametxt.text = ingname diff --git a/frontend/Savor-22b/scenes/house/recipebook/ingredient_no.tscn b/frontend/Savor-22b/scenes/house/recipebook/ingredient_no.tscn new file mode 100644 index 00000000..fada25d3 --- /dev/null +++ b/frontend/Savor-22b/scenes/house/recipebook/ingredient_no.tscn @@ -0,0 +1,53 @@ +[gd_scene load_steps=4 format=3 uid="uid://cte67bdw48cd6"] + +[ext_resource type="Script" path="res://scenes/house/recipebook/ingredient_no.gd" id="1_8dhac"] + +[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_jup0i"] +bg_color = Color(0.94902, 0.596078, 0.0784314, 1) +corner_radius_top_left = 20 +corner_radius_top_right = 20 +corner_radius_bottom_right = 20 +corner_radius_bottom_left = 20 + +[sub_resource type="FontVariation" id="FontVariation_g1ith"] +variation_embolden = -0.4 + +[node name="ingredient_no" type="Control"] +custom_minimum_size = Vector2(180, 110) +layout_mode = 3 +anchors_preset = 0 +offset_right = 180.0 +offset_bottom = 110.0 +script = ExtResource("1_8dhac") + +[node name="NoIng" type="Button" parent="."] +custom_minimum_size = Vector2(180, 110) +layout_mode = 0 +theme_override_colors/font_color = Color(0, 0, 0, 1) +theme_override_font_sizes/font_size = 25 +theme_override_styles/normal = SubResource("StyleBoxFlat_jup0i") + +[node name="Desc" type="VBoxContainer" parent="NoIng"] +layout_mode = 1 +anchors_preset = 15 +anchor_right = 1.0 +anchor_bottom = 1.0 +grow_horizontal = 2 +grow_vertical = 2 +theme_override_constants/separation = -2 +alignment = 1 + +[node name="Name" type="Label" parent="NoIng/Desc"] +layout_mode = 2 +size_flags_horizontal = 4 +theme_override_colors/font_color = Color(0, 0, 0, 1) +theme_override_font_sizes/font_size = 25 +text = "[라드]" + +[node name="No" type="Label" parent="NoIng/Desc"] +layout_mode = 2 +size_flags_horizontal = 4 +theme_override_colors/font_color = Color(1, 0, 0, 1) +theme_override_fonts/font = SubResource("FontVariation_g1ith") +theme_override_font_sizes/font_size = 25 +text = "없음" diff --git a/frontend/Savor-22b/scenes/house/recipebook/ingredient_yes.gd b/frontend/Savor-22b/scenes/house/recipebook/ingredient_yes.gd new file mode 100644 index 00000000..fdecab93 --- /dev/null +++ b/frontend/Savor-22b/scenes/house/recipebook/ingredient_yes.gd @@ -0,0 +1,19 @@ +extends Control + +@onready var button = $Ing +var ingname +var format_string = "[%s] +보유 중" + + +func _ready(): + update_info() + + + + +func set_ingname(name: String): + ingname = name + +func update_info(): + button.text = format_string % [ingname] diff --git a/frontend/Savor-22b/scenes/house/recipebook/ingredient_yes.tscn b/frontend/Savor-22b/scenes/house/recipebook/ingredient_yes.tscn new file mode 100644 index 00000000..ddd244be --- /dev/null +++ b/frontend/Savor-22b/scenes/house/recipebook/ingredient_yes.tscn @@ -0,0 +1,27 @@ +[gd_scene load_steps=3 format=3 uid="uid://me2nvitswvki"] + +[ext_resource type="Script" path="res://scenes/house/recipebook/ingredient_yes.gd" id="1_ictny"] + +[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_jup0i"] +bg_color = Color(0.94902, 0.596078, 0.0784314, 1) +corner_radius_top_left = 20 +corner_radius_top_right = 20 +corner_radius_bottom_right = 20 +corner_radius_bottom_left = 20 + +[node name="ingredient_yes" type="Control"] +custom_minimum_size = Vector2(180, 110) +layout_mode = 3 +anchors_preset = 0 +offset_right = 180.0 +offset_bottom = 110.0 +script = ExtResource("1_ictny") + +[node name="Ing" type="Button" parent="."] +custom_minimum_size = Vector2(180, 110) +layout_mode = 0 +theme_override_colors/font_color = Color(0, 0, 0, 1) +theme_override_font_sizes/font_size = 25 +theme_override_styles/normal = SubResource("StyleBoxFlat_jup0i") +text = "[춘장] +보유중" diff --git a/frontend/Savor-22b/scenes/house/recipebook/recipe.gd b/frontend/Savor-22b/scenes/house/recipebook/recipe.gd new file mode 100644 index 00000000..b9538eab --- /dev/null +++ b/frontend/Savor-22b/scenes/house/recipebook/recipe.gd @@ -0,0 +1,63 @@ +extends Control + +const ING_YES = preload("res://scenes/house/recipebook/ingredient_yes.tscn") +const ING_NO = preload("res://scenes/house/recipebook/ingredient_no.tscn") + +@onready var ingredients = $panel/M/V/Description/Ingredients/list + +var info +var inventorylist + +var name_format = "[%s] 레시피" + +func _ready(): + update_info() + + + +func set_info(recipe: Dictionary): + info = recipe + +func update_info(): + inventorylist = SceneContext.user_state["inventoryState"] + + # Setting names in UI + var name = info.name + name = name.left(name.length() -4) + $panel/M/V/Title/Name.text = name_format % [name] + + # Getting exist + for ing in info["ingredientIDList"]: + var created = false + for inving in inventorylist.refrigeratorStateList: + if ing["name"] == inving["name"]: + var ing_y = ING_YES.instantiate() + ing_y.set_ingname(ing["name"]) + ingredients.add_child(ing_y) + created = true + break + + if(!created): + var ing_n = ING_NO.instantiate() + ing_n.set_ingname(ing["name"]) + ingredients.add_child(ing_n) + + for ing in info["foodIDList"]: + var created = false + # refrigeratorstatelist에 만들어진 음식이 없는 경우 수정 필요 + for inving in inventorylist.refrigeratorStateList: + if ing["name"] == inving["name"]: + var ing_y = ING_YES.instantiate() + ing_y.set_ingname(ing["name"]) + ingredients.add_child(ing_y) + created = true + break + + if(!created): + var ing_n = ING_NO.instantiate() + ing_n.set_ingname(ing["name"]) + ingredients.add_child(ing_n) + + +func insufficient(): + $panel/M/V/Title/insufficient.visible = true diff --git a/frontend/Savor-22b/scenes/house/recipebook/recipe.tscn b/frontend/Savor-22b/scenes/house/recipebook/recipe.tscn new file mode 100644 index 00000000..18001002 --- /dev/null +++ b/frontend/Savor-22b/scenes/house/recipebook/recipe.tscn @@ -0,0 +1,108 @@ +[gd_scene load_steps=4 format=3 uid="uid://bam215608gpdl"] + +[ext_resource type="StyleBox" uid="uid://b2nqsuwp80vsg" path="res://scenes/house/recipebook/recipe_style_box_flat.tres" id="1_8ipq3"] +[ext_resource type="Script" path="res://scenes/house/recipebook/recipe.gd" id="2_jlc81"] + +[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_jup0i"] +bg_color = Color(0.94902, 0.596078, 0.0784314, 1) +corner_radius_top_left = 20 +corner_radius_top_right = 20 +corner_radius_bottom_right = 20 +corner_radius_bottom_left = 20 + +[node name="Recipe" type="Control"] +custom_minimum_size = Vector2(700, 550) +layout_direction = 1 +layout_mode = 3 +anchors_preset = 0 +offset_right = 700.0 +offset_bottom = 550.0 +script = ExtResource("2_jlc81") + +[node name="panel" type="Panel" parent="."] +custom_minimum_size = Vector2(700, 550) +layout_mode = 0 +theme_override_styles/panel = ExtResource("1_8ipq3") + +[node name="M" type="MarginContainer" parent="panel"] +layout_mode = 1 +anchors_preset = 15 +anchor_right = 1.0 +anchor_bottom = 1.0 +grow_horizontal = 2 +grow_vertical = 2 +theme_override_constants/margin_left = 50 +theme_override_constants/margin_top = 10 +theme_override_constants/margin_right = 50 +theme_override_constants/margin_bottom = 10 + +[node name="V" type="VBoxContainer" parent="panel/M"] +layout_mode = 2 + +[node name="Title" type="HBoxContainer" parent="panel/M/V"] +layout_mode = 2 +size_flags_horizontal = 0 + +[node name="Name" type="Label" parent="panel/M/V/Title"] +layout_mode = 2 +theme_override_font_sizes/font_size = 40 +text = "[트러플 짜장면] 레시피" + +[node name="insufficient" type="Label" parent="panel/M/V/Title"] +visible = false +layout_mode = 2 +theme_override_font_sizes/font_size = 40 +text = "(재료부족)" + +[node name="Blockreq" type="Label" parent="panel/M/V"] +layout_mode = 2 +theme_override_colors/font_color = Color(1, 0.541176, 0, 1) +theme_override_font_sizes/font_size = 30 +text = "소요 블록 N 블록" + +[node name="Space" type="MarginContainer" parent="panel/M/V"] +layout_mode = 2 +theme_override_constants/margin_top = 10 + +[node name="Description" type="VBoxContainer" parent="panel/M/V"] +layout_mode = 2 +theme_override_constants/separation = 15 + +[node name="T1" type="Label" parent="panel/M/V/Description"] +layout_mode = 2 +theme_override_font_sizes/font_size = 35 +text = "[조리도구]" + +[node name="Tools" type="HBoxContainer" parent="panel/M/V/Description"] +layout_mode = 2 +theme_override_constants/separation = 20 + +[node name="Availabletools" type="Button" parent="panel/M/V/Description/Tools"] +custom_minimum_size = Vector2(180, 110) +layout_mode = 2 +theme_override_colors/font_color = Color(0, 0, 0, 1) +theme_override_font_sizes/font_size = 25 +theme_override_styles/normal = SubResource("StyleBoxFlat_jup0i") +text = "[-- -] +사용 가능" + +[node name="Availabletools2" type="Button" parent="panel/M/V/Description/Tools"] +custom_minimum_size = Vector2(180, 110) +layout_mode = 2 +theme_override_colors/font_color = Color(0, 0, 0, 1) +theme_override_font_sizes/font_size = 25 +theme_override_styles/normal = SubResource("StyleBoxFlat_jup0i") +text = "[-- -] +사용 가능" + +[node name="T2" type="Label" parent="panel/M/V/Description"] +layout_mode = 2 +theme_override_font_sizes/font_size = 35 +text = "[식재료]" + +[node name="Ingredients" type="ScrollContainer" parent="panel/M/V/Description"] +layout_mode = 2 +vertical_scroll_mode = 0 + +[node name="list" type="HBoxContainer" parent="panel/M/V/Description/Ingredients"] +layout_mode = 2 diff --git a/frontend/Savor-22b/scenes/house/recipebook/recipe_style_box_flat.tres b/frontend/Savor-22b/scenes/house/recipebook/recipe_style_box_flat.tres new file mode 100644 index 00000000..c74529fb --- /dev/null +++ b/frontend/Savor-22b/scenes/house/recipebook/recipe_style_box_flat.tres @@ -0,0 +1,8 @@ +[gd_resource type="StyleBoxFlat" format=3 uid="uid://b2nqsuwp80vsg"] + +[resource] +bg_color = Color(0, 0, 0, 1) +corner_radius_top_left = 50 +corner_radius_top_right = 50 +corner_radius_bottom_right = 50 +corner_radius_bottom_left = 50 diff --git a/frontend/Savor-22b/scenes/house/recipebook/recipebook.gd b/frontend/Savor-22b/scenes/house/recipebook/recipebook.gd new file mode 100644 index 00000000..be7d7b00 --- /dev/null +++ b/frontend/Savor-22b/scenes/house/recipebook/recipebook.gd @@ -0,0 +1,19 @@ +extends Control + +const RECIPE = preload("res://scenes/house/recipebook/recipe.tscn") + +@onready var grid = $background/M/V/S/G + +var recipelist = SceneContext.recipe["recipe"] + +func _ready(): + for singlerecipe in recipelist: + var recipe = RECIPE.instantiate() + recipe.set_info(singlerecipe) + grid.add_child(recipe) + + + + +func _on_close_button_down(): + queue_free() diff --git a/frontend/Savor-22b/scenes/house/recipebook/recipebook.tscn b/frontend/Savor-22b/scenes/house/recipebook/recipebook.tscn new file mode 100644 index 00000000..4de44c89 --- /dev/null +++ b/frontend/Savor-22b/scenes/house/recipebook/recipebook.tscn @@ -0,0 +1,128 @@ +[gd_scene load_steps=7 format=3 uid="uid://cpx04yry0xj16"] + +[ext_resource type="Script" path="res://scenes/house/recipebook/recipebook.gd" id="1_8dllv"] + +[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_tvose"] +bg_color = Color(0.94902, 0.694118, 0.0784314, 1) +border_width_left = 5 +border_width_top = 5 +border_width_right = 5 +border_width_bottom = 5 +border_color = Color(0, 0, 0, 1) +corner_radius_top_left = 50 +corner_radius_top_right = 50 +corner_radius_bottom_right = 50 +corner_radius_bottom_left = 50 +shadow_size = 5 + +[sub_resource type="FontVariation" id="FontVariation_eybux"] +variation_embolden = -0.3 + +[sub_resource type="SystemFont" id="SystemFont_ardk6"] + +[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_ym4cf"] +bg_color = Color(0, 0, 0, 1) +corner_radius_top_left = 30 +corner_radius_top_right = 30 +corner_radius_bottom_right = 30 +corner_radius_bottom_left = 30 + +[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_rle7u"] +bg_color = Color(0, 0, 0, 1) +corner_radius_top_left = 15 +corner_radius_top_right = 15 +corner_radius_bottom_right = 15 +corner_radius_bottom_left = 15 + +[node name="Recipebook" type="Control"] +custom_minimum_size = Vector2(1600, 900) +layout_mode = 3 +anchors_preset = 0 +offset_right = 1600.0 +offset_bottom = 900.0 +script = ExtResource("1_8dllv") + +[node name="background" type="Panel" parent="."] +custom_minimum_size = Vector2(1600, 900) +layout_mode = 1 +anchors_preset = 15 +anchor_right = 1.0 +anchor_bottom = 1.0 +grow_horizontal = 2 +grow_vertical = 2 +theme_override_styles/panel = SubResource("StyleBoxFlat_tvose") + +[node name="M" type="MarginContainer" parent="background"] +layout_mode = 1 +anchors_preset = 15 +anchor_right = 1.0 +anchor_bottom = 1.0 +grow_horizontal = 2 +grow_vertical = 2 +theme_override_constants/margin_left = 60 +theme_override_constants/margin_top = 20 +theme_override_constants/margin_right = 60 +theme_override_constants/margin_bottom = 30 + +[node name="V" type="VBoxContainer" parent="background/M"] +layout_mode = 2 + +[node name="Title" type="Label" parent="background/M/V"] +layout_mode = 2 +size_flags_horizontal = 4 +theme_override_colors/font_color = Color(0, 0, 0, 1) +theme_override_font_sizes/font_size = 70 +text = "조리 가능한 레시피" + +[node name="Description" type="HBoxContainer" parent="background/M/V"] +layout_mode = 2 +size_flags_vertical = 4 +alignment = 1 + +[node name="Desc" type="Label" parent="background/M/V/Description"] +layout_mode = 2 +size_flags_horizontal = 4 +theme_override_colors/font_color = Color(0, 0, 0, 1) +theme_override_fonts/font = SubResource("FontVariation_eybux") +theme_override_font_sizes/font_size = 45 +text = "현재 설치된 조리도구" + +[node name="ription" type="Label" parent="background/M/V/Description"] +layout_mode = 2 +size_flags_horizontal = 4 +theme_override_colors/font_color = Color(0, 0, 0, 1) +theme_override_fonts/font = SubResource("SystemFont_ardk6") +theme_override_font_sizes/font_size = 45 +text = "[ 중화 웍, 후라이팬, ... ]" + +[node name="S" type="ScrollContainer" parent="background/M/V"] +custom_minimum_size = Vector2(2.08165e-12, 580) +layout_mode = 2 + +[node name="G" type="GridContainer" parent="background/M/V/S"] +layout_mode = 2 +theme_override_constants/h_separation = 50 +columns = 2 + +[node name="BottomMenu" type="HBoxContainer" parent="background/M/V"] +layout_mode = 2 +theme_override_constants/separation = 850 + +[node name="Close" type="Button" parent="background/M/V/BottomMenu"] +custom_minimum_size = Vector2(150, 60) +layout_mode = 2 +theme_override_colors/font_color = Color(1, 1, 1, 1) +theme_override_font_sizes/font_size = 35 +theme_override_styles/normal = SubResource("StyleBoxFlat_ym4cf") +text = "닫기" + +[node name="Cook" type="Button" parent="background/M/V/BottomMenu"] +custom_minimum_size = Vector2(450, 60) +layout_mode = 2 +size_flags_horizontal = 8 +theme_override_colors/font_color = Color(1, 1, 1, 1) +theme_override_font_sizes/font_size = 35 +theme_override_styles/normal = SubResource("StyleBoxFlat_rle7u") +text = "선택한 레시피로 조리하기" + +[connection signal="button_down" from="background/M/V/BottomMenu/Close" to="." method="_on_close_button_down"] diff --git a/frontend/Savor-22b/scenes/house/recipebook/recipebook_preset.tscn b/frontend/Savor-22b/scenes/house/recipebook/recipebook_preset.tscn new file mode 100644 index 00000000..e9cb933f --- /dev/null +++ b/frontend/Savor-22b/scenes/house/recipebook/recipebook_preset.tscn @@ -0,0 +1,455 @@ +[gd_scene load_steps=12 format=3 uid="uid://blowb3mc1asp1"] + +[ext_resource type="StyleBox" uid="uid://b2nqsuwp80vsg" path="res://scenes/house/recipebook/recipe_style_box_flat.tres" id="1_txpcy"] + +[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_tvose"] +bg_color = Color(0.94902, 0.694118, 0.0784314, 1) +border_width_left = 5 +border_width_top = 5 +border_width_right = 5 +border_width_bottom = 5 +border_color = Color(0, 0, 0, 1) +corner_radius_top_left = 50 +corner_radius_top_right = 50 +corner_radius_bottom_right = 50 +corner_radius_bottom_left = 50 +shadow_size = 5 + +[sub_resource type="FontVariation" id="FontVariation_eybux"] +variation_embolden = -0.3 + +[sub_resource type="SystemFont" id="SystemFont_ardk6"] + +[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_jup0i"] +bg_color = Color(0.94902, 0.596078, 0.0784314, 1) +corner_radius_top_left = 20 +corner_radius_top_right = 20 +corner_radius_bottom_right = 20 +corner_radius_bottom_left = 20 + +[sub_resource type="FontVariation" id="FontVariation_g1ith"] +variation_embolden = -0.4 + +[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_ym4cf"] +bg_color = Color(0, 0, 0, 1) +corner_radius_top_left = 30 +corner_radius_top_right = 30 +corner_radius_bottom_right = 30 +corner_radius_bottom_left = 30 + +[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_rle7u"] +bg_color = Color(0, 0, 0, 1) +corner_radius_top_left = 15 +corner_radius_top_right = 15 +corner_radius_bottom_right = 15 +corner_radius_bottom_left = 15 + +[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_ot8sp"] +bg_color = Color(0.94902, 0.694118, 0.0784314, 1) +border_width_left = 3 +border_width_top = 3 +border_width_right = 3 +border_width_bottom = 3 +border_color = Color(0, 0, 0, 1) +corner_radius_top_left = 50 +corner_radius_top_right = 50 +corner_radius_bottom_right = 50 +corner_radius_bottom_left = 50 +shadow_size = 5 + +[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_ngbpx"] +bg_color = Color(0, 0, 0, 1) +corner_radius_top_left = 15 +corner_radius_top_right = 15 +corner_radius_bottom_right = 15 +corner_radius_bottom_left = 15 + +[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_61pm2"] +bg_color = Color(0, 0, 0, 1) +corner_radius_top_left = 30 +corner_radius_top_right = 30 +corner_radius_bottom_right = 30 +corner_radius_bottom_left = 30 + +[node name="Recipebook" type="Control"] +custom_minimum_size = Vector2(1600, 900) +layout_mode = 3 +anchors_preset = 0 +offset_right = 1600.0 +offset_bottom = 900.0 + +[node name="background" type="Panel" parent="."] +custom_minimum_size = Vector2(1600, 900) +layout_mode = 1 +anchors_preset = 15 +anchor_right = 1.0 +anchor_bottom = 1.0 +grow_horizontal = 2 +grow_vertical = 2 +theme_override_styles/panel = SubResource("StyleBoxFlat_tvose") + +[node name="M" type="MarginContainer" parent="background"] +layout_mode = 1 +anchors_preset = 15 +anchor_right = 1.0 +anchor_bottom = 1.0 +grow_horizontal = 2 +grow_vertical = 2 +theme_override_constants/margin_left = 60 +theme_override_constants/margin_top = 20 +theme_override_constants/margin_right = 60 +theme_override_constants/margin_bottom = 30 + +[node name="V" type="VBoxContainer" parent="background/M"] +layout_mode = 2 + +[node name="Title" type="Label" parent="background/M/V"] +layout_mode = 2 +size_flags_horizontal = 4 +theme_override_colors/font_color = Color(0, 0, 0, 1) +theme_override_font_sizes/font_size = 70 +text = "조리 가능한 레시피" + +[node name="Description" type="HBoxContainer" parent="background/M/V"] +layout_mode = 2 +size_flags_vertical = 4 +alignment = 1 + +[node name="Desc" type="Label" parent="background/M/V/Description"] +layout_mode = 2 +size_flags_horizontal = 4 +theme_override_colors/font_color = Color(0, 0, 0, 1) +theme_override_fonts/font = SubResource("FontVariation_eybux") +theme_override_font_sizes/font_size = 45 +text = "현재 설치된 조리도구" + +[node name="ription" type="Label" parent="background/M/V/Description"] +layout_mode = 2 +size_flags_horizontal = 4 +theme_override_colors/font_color = Color(0, 0, 0, 1) +theme_override_fonts/font = SubResource("SystemFont_ardk6") +theme_override_font_sizes/font_size = 45 +text = "[ 중화 웍, 후라이팬, ... ]" + +[node name="S" type="ScrollContainer" parent="background/M/V"] +custom_minimum_size = Vector2(2.08165e-12, 580) +layout_mode = 2 + +[node name="G" type="GridContainer" parent="background/M/V/S"] +layout_mode = 2 +theme_override_constants/h_separation = 50 +columns = 2 + +[node name="Recipe" type="Panel" parent="background/M/V/S/G"] +custom_minimum_size = Vector2(700, 550) +layout_mode = 2 +theme_override_styles/panel = ExtResource("1_txpcy") + +[node name="M" type="MarginContainer" parent="background/M/V/S/G/Recipe"] +layout_mode = 1 +anchors_preset = 15 +anchor_right = 1.0 +anchor_bottom = 1.0 +grow_horizontal = 2 +grow_vertical = 2 +theme_override_constants/margin_left = 50 +theme_override_constants/margin_top = 10 +theme_override_constants/margin_right = 50 +theme_override_constants/margin_bottom = 10 + +[node name="V" type="VBoxContainer" parent="background/M/V/S/G/Recipe/M"] +layout_mode = 2 + +[node name="Title" type="HBoxContainer" parent="background/M/V/S/G/Recipe/M/V"] +layout_mode = 2 +size_flags_horizontal = 0 + +[node name="Name" type="Label" parent="background/M/V/S/G/Recipe/M/V/Title"] +layout_mode = 2 +theme_override_font_sizes/font_size = 40 +text = "[트러플 짜장면] 레시피" + +[node name="insufficient" type="Label" parent="background/M/V/S/G/Recipe/M/V/Title"] +layout_mode = 2 +theme_override_font_sizes/font_size = 40 +text = "(재료부족)" + +[node name="Blockreq" type="Label" parent="background/M/V/S/G/Recipe/M/V"] +layout_mode = 2 +theme_override_colors/font_color = Color(1, 0.541176, 0, 1) +theme_override_font_sizes/font_size = 30 +text = "소요 블록 N 블록" + +[node name="Space" type="MarginContainer" parent="background/M/V/S/G/Recipe/M/V"] +layout_mode = 2 +theme_override_constants/margin_top = 10 + +[node name="Description" type="VBoxContainer" parent="background/M/V/S/G/Recipe/M/V"] +layout_mode = 2 +theme_override_constants/separation = 15 + +[node name="T1" type="Label" parent="background/M/V/S/G/Recipe/M/V/Description"] +layout_mode = 2 +theme_override_font_sizes/font_size = 35 +text = "[조리도구]" + +[node name="Tools" type="HBoxContainer" parent="background/M/V/S/G/Recipe/M/V/Description"] +layout_mode = 2 +theme_override_constants/separation = 20 + +[node name="Availabletools" type="Button" parent="background/M/V/S/G/Recipe/M/V/Description/Tools"] +custom_minimum_size = Vector2(180, 110) +layout_mode = 2 +theme_override_colors/font_color = Color(0, 0, 0, 1) +theme_override_font_sizes/font_size = 25 +theme_override_styles/normal = SubResource("StyleBoxFlat_jup0i") +text = "[-- -] +사용 가능" + +[node name="Availabletools2" type="Button" parent="background/M/V/S/G/Recipe/M/V/Description/Tools"] +custom_minimum_size = Vector2(180, 110) +layout_mode = 2 +theme_override_colors/font_color = Color(0, 0, 0, 1) +theme_override_font_sizes/font_size = 25 +theme_override_styles/normal = SubResource("StyleBoxFlat_jup0i") +text = "[-- -] +사용 가능" + +[node name="T2" type="Label" parent="background/M/V/S/G/Recipe/M/V/Description"] +layout_mode = 2 +theme_override_font_sizes/font_size = 35 +text = "[식재료]" + +[node name="Ingredients" type="HBoxContainer" parent="background/M/V/S/G/Recipe/M/V/Description"] +layout_mode = 2 +theme_override_constants/separation = 20 + +[node name="Ing" type="Button" parent="background/M/V/S/G/Recipe/M/V/Description/Ingredients"] +custom_minimum_size = Vector2(180, 110) +layout_mode = 2 +theme_override_colors/font_color = Color(0, 0, 0, 1) +theme_override_font_sizes/font_size = 25 +theme_override_styles/normal = SubResource("StyleBoxFlat_jup0i") +text = "[춘장] +보유중" + +[node name="NoIng" type="Button" parent="background/M/V/S/G/Recipe/M/V/Description/Ingredients"] +custom_minimum_size = Vector2(180, 110) +layout_mode = 2 +theme_override_colors/font_color = Color(0, 0, 0, 1) +theme_override_font_sizes/font_size = 25 +theme_override_styles/normal = SubResource("StyleBoxFlat_jup0i") + +[node name="Desc" type="VBoxContainer" parent="background/M/V/S/G/Recipe/M/V/Description/Ingredients/NoIng"] +layout_mode = 1 +anchors_preset = 15 +anchor_right = 1.0 +anchor_bottom = 1.0 +grow_horizontal = 2 +grow_vertical = 2 +theme_override_constants/separation = -2 +alignment = 1 + +[node name="Name" type="Label" parent="background/M/V/S/G/Recipe/M/V/Description/Ingredients/NoIng/Desc"] +layout_mode = 2 +size_flags_horizontal = 4 +theme_override_colors/font_color = Color(0, 0, 0, 1) +theme_override_font_sizes/font_size = 25 +text = "[라드]" + +[node name="No" type="Label" parent="background/M/V/S/G/Recipe/M/V/Description/Ingredients/NoIng/Desc"] +layout_mode = 2 +size_flags_horizontal = 4 +theme_override_colors/font_color = Color(1, 0, 0, 1) +theme_override_fonts/font = SubResource("FontVariation_g1ith") +theme_override_font_sizes/font_size = 25 +text = "없음" + +[node name="Recipe2" type="Panel" parent="background/M/V/S/G"] +custom_minimum_size = Vector2(700, 550) +layout_mode = 2 +theme_override_styles/panel = ExtResource("1_txpcy") + +[node name="M" type="MarginContainer" parent="background/M/V/S/G/Recipe2"] +layout_mode = 1 +anchors_preset = 15 +anchor_right = 1.0 +anchor_bottom = 1.0 +grow_horizontal = 2 +grow_vertical = 2 +theme_override_constants/margin_left = 50 +theme_override_constants/margin_top = 10 +theme_override_constants/margin_right = 50 +theme_override_constants/margin_bottom = 10 + +[node name="V" type="VBoxContainer" parent="background/M/V/S/G/Recipe2/M"] +layout_mode = 2 + +[node name="Title" type="HBoxContainer" parent="background/M/V/S/G/Recipe2/M/V"] +layout_mode = 2 +size_flags_horizontal = 0 + +[node name="Name" type="Label" parent="background/M/V/S/G/Recipe2/M/V/Title"] +layout_mode = 2 +theme_override_font_sizes/font_size = 40 +text = "[트러플 짜장면] 레시피" + +[node name="insufficient" type="Label" parent="background/M/V/S/G/Recipe2/M/V/Title"] +layout_mode = 2 +theme_override_font_sizes/font_size = 40 +text = "(재료부족)" + +[node name="Blockreq" type="Label" parent="background/M/V/S/G/Recipe2/M/V"] +layout_mode = 2 +theme_override_colors/font_color = Color(1, 0.541176, 0, 1) +theme_override_font_sizes/font_size = 30 +text = "소요 블록 N 블록" + +[node name="Space" type="MarginContainer" parent="background/M/V/S/G/Recipe2/M/V"] +layout_mode = 2 +theme_override_constants/margin_top = 10 + +[node name="Description" type="VBoxContainer" parent="background/M/V/S/G/Recipe2/M/V"] +layout_mode = 2 +theme_override_constants/separation = 15 + +[node name="T1" type="Label" parent="background/M/V/S/G/Recipe2/M/V/Description"] +layout_mode = 2 +theme_override_font_sizes/font_size = 35 +text = "[조리도구]" + +[node name="Tools" type="HBoxContainer" parent="background/M/V/S/G/Recipe2/M/V/Description"] +layout_mode = 2 +theme_override_constants/separation = 20 + +[node name="Availabletools" type="Button" parent="background/M/V/S/G/Recipe2/M/V/Description/Tools"] +custom_minimum_size = Vector2(180, 110) +layout_mode = 2 +theme_override_colors/font_color = Color(0, 0, 0, 1) +theme_override_font_sizes/font_size = 25 +theme_override_styles/normal = SubResource("StyleBoxFlat_jup0i") +text = "[-- -] +사용 가능" + +[node name="Availabletools2" type="Button" parent="background/M/V/S/G/Recipe2/M/V/Description/Tools"] +custom_minimum_size = Vector2(180, 110) +layout_mode = 2 +theme_override_colors/font_color = Color(0, 0, 0, 1) +theme_override_font_sizes/font_size = 25 +theme_override_styles/normal = SubResource("StyleBoxFlat_jup0i") +text = "[-- -] +사용 가능" + +[node name="T2" type="Label" parent="background/M/V/S/G/Recipe2/M/V/Description"] +layout_mode = 2 +theme_override_font_sizes/font_size = 35 +text = "[식재료]" + +[node name="Ingredients" type="HBoxContainer" parent="background/M/V/S/G/Recipe2/M/V/Description"] +layout_mode = 2 +theme_override_constants/separation = 20 + +[node name="Ing" type="Button" parent="background/M/V/S/G/Recipe2/M/V/Description/Ingredients"] +custom_minimum_size = Vector2(180, 110) +layout_mode = 2 +theme_override_colors/font_color = Color(0, 0, 0, 1) +theme_override_font_sizes/font_size = 25 +theme_override_styles/normal = SubResource("StyleBoxFlat_jup0i") +text = "[춘장] +보유중" + +[node name="Ing2" type="Button" parent="background/M/V/S/G/Recipe2/M/V/Description/Ingredients"] +custom_minimum_size = Vector2(180, 110) +layout_mode = 2 +theme_override_colors/font_color = Color(0, 0, 0, 1) +theme_override_font_sizes/font_size = 25 +theme_override_styles/normal = SubResource("StyleBoxFlat_jup0i") +text = "[춘장] +보유중" + +[node name="BottomMenu" type="HBoxContainer" parent="background/M/V"] +layout_mode = 2 +theme_override_constants/separation = 850 + +[node name="Close" type="Button" parent="background/M/V/BottomMenu"] +custom_minimum_size = Vector2(150, 60) +layout_mode = 2 +theme_override_colors/font_color = Color(1, 1, 1, 1) +theme_override_font_sizes/font_size = 35 +theme_override_styles/normal = SubResource("StyleBoxFlat_ym4cf") +text = "닫기" + +[node name="Cook" type="Button" parent="background/M/V/BottomMenu"] +custom_minimum_size = Vector2(450, 60) +layout_mode = 2 +size_flags_horizontal = 8 +theme_override_colors/font_color = Color(1, 1, 1, 1) +theme_override_font_sizes/font_size = 35 +theme_override_styles/normal = SubResource("StyleBoxFlat_rle7u") +text = "선택한 레시피로 조리하기" + +[node name="Popups" type="Control" parent="."] +anchors_preset = 0 +offset_right = 40.0 +offset_bottom = 40.0 + +[node name="SelectIngredients" type="Panel" parent="Popups"] +custom_minimum_size = Vector2(400, 300) +layout_mode = 1 +offset_left = 1253.0 +offset_top = 567.0 +offset_right = 1653.0 +offset_bottom = 867.0 +theme_override_styles/panel = SubResource("StyleBoxFlat_ot8sp") + +[node name="M" type="MarginContainer" parent="Popups/SelectIngredients"] +layout_mode = 1 +anchors_preset = 15 +anchor_right = 1.0 +anchor_bottom = 1.0 +grow_horizontal = 2 +grow_vertical = 2 +theme_override_constants/margin_left = 30 +theme_override_constants/margin_top = 15 +theme_override_constants/margin_right = 30 +theme_override_constants/margin_bottom = 15 + +[node name="V" type="VBoxContainer" parent="Popups/SelectIngredients/M"] +layout_mode = 2 +theme_override_constants/separation = 10 + +[node name="Title" type="Label" parent="Popups/SelectIngredients/M/V"] +layout_mode = 2 +theme_override_colors/font_color = Color(0, 0, 0, 1) +theme_override_font_sizes/font_size = 30 +text = "현재 소유중인 [-- -]" + +[node name="Ingredients" type="VBoxContainer" parent="Popups/SelectIngredients/M/V"] +layout_mode = 2 + +[node name="RankB" type="Button" parent="Popups/SelectIngredients/M/V/Ingredients"] +layout_mode = 2 +theme_override_font_sizes/font_size = 35 +theme_override_styles/normal = SubResource("StyleBoxFlat_ngbpx") +text = "B 등급 [1개]" + +[node name="RankA" type="Button" parent="Popups/SelectIngredients/M/V/Ingredients"] +layout_mode = 2 +theme_override_font_sizes/font_size = 35 +theme_override_styles/normal = SubResource("StyleBoxFlat_ngbpx") +text = "A 등급 [3개]" + +[node name="RankS" type="Button" parent="Popups/SelectIngredients/M/V/Ingredients"] +layout_mode = 2 +theme_override_font_sizes/font_size = 35 +theme_override_styles/normal = SubResource("StyleBoxFlat_ngbpx") +text = "S 등급 [6개]" + +[node name="Button" type="Button" parent="Popups/SelectIngredients/M/V"] +custom_minimum_size = Vector2(270, 50) +layout_mode = 2 +size_flags_horizontal = 8 +theme_override_colors/font_color = Color(1, 1, 1, 1) +theme_override_font_sizes/font_size = 25 +theme_override_styles/normal = SubResource("StyleBoxFlat_61pm2") +text = "선택한 등급으로 설정" diff --git a/frontend/Savor-22b/scripts/global/scene_context.gd b/frontend/Savor-22b/scripts/global/scene_context.gd index 73df3e86..4af23af1 100644 --- a/frontend/Savor-22b/scripts/global/scene_context.gd +++ b/frontend/Savor-22b/scripts/global/scene_context.gd @@ -43,6 +43,7 @@ var user_state: Dictionary var user_asset: String var shop: Dictionary +var recipe: Dictionary var selected_house_index := 0 var selected_house_location: Dictionary @@ -77,3 +78,6 @@ func get_selected_village(): func set_shop(query_data: Dictionary): shop = query_data.data.shop + +func set_recipe(query_data: Dictionary): + recipe = query_data.data diff --git a/frontend/Savor-22b/scripts/scenes/house.gd b/frontend/Savor-22b/scripts/scenes/house.gd index 9e707b0e..6843e77a 100644 --- a/frontend/Savor-22b/scripts/scenes/house.gd +++ b/frontend/Savor-22b/scripts/scenes/house.gd @@ -3,6 +3,9 @@ extends Control const HOUSE_INVENTORY = preload("res://scenes/house/house_inventory.tscn") const ASK_POPUP = preload("res://scenes/shop/ask_popup.tscn") const DONE_POPUP = preload("res://scenes/shop/done_popup.tscn") + +const RECIPE = preload("res://scenes/house/recipebook/recipebook.tscn") + const Gql_query = preload("res://gql/query.gd") @onready var subscene = $M/V/subscene @@ -25,7 +28,6 @@ func _on_inventory_button_button_down(): inventory.closeall.connect(clear_popup) subscene.add_child(inventory) - func buypopup(): var askpopup = ASK_POPUP.instantiate() askpopup.set_itemname(SceneContext.selected_item_name) @@ -40,7 +42,7 @@ func buyaction(): var donepopup = DONE_POPUP.instantiate() donepopup.set_position(Vector2(900,600)) popup.add_child(donepopup) - + func buytool(): var itemnum = SceneContext.selected_item_index var gql_query = Gql_query.new() @@ -65,25 +67,37 @@ func buytool(): ) add_child(query_executor) query_executor.run({}) - + func clear_popup(): if is_instance_valid(popup): for pop in popup.get_children(): pop.queue_free() +func _on_recipe_button_button_down(): + clear_popup() + var Recipebookarea = MarginContainer.new() + Recipebookarea.add_theme_constant_override("margin_top", 20) + Recipebookarea.add_theme_constant_override("margin_bottom", 20) + Recipebookarea.add_theme_constant_override("margin_left", 140) + Recipebookarea.add_theme_constant_override("margin_right", 140) + subscene.add_child(Recipebookarea) + + var recipebook = RECIPE.instantiate() + + Recipebookarea.add_child(recipebook) -func _on_refresh_button_button_down(): - Intro._query_user_state() - - if is_instance_valid(subscene): - for scene in subscene.get_children(): - scene.queue_free() func _on_farm_button_button_down(): get_tree().change_scene_to_file("res://scenes/farm.tscn") - func _on_village_button_button_down(): get_tree().change_scene_to_file("res://scenes/village_view.tscn") + +func _on_refresh_button_button_down(): + Intro._query_user_state() + + if is_instance_valid(subscene): + for scene in subscene.get_children(): + scene.queue_free() diff --git a/frontend/Savor-22b/scripts/scenes/intro.gd b/frontend/Savor-22b/scripts/scenes/intro.gd index 1adacbfc..ef73f96a 100644 --- a/frontend/Savor-22b/scripts/scenes/intro.gd +++ b/frontend/Savor-22b/scripts/scenes/intro.gd @@ -1,12 +1,13 @@ extends Control - func _ready(): print("intro scene ready") _query_villages() _query_user_state() _query_assets() _query_shop() + _query_recipe() + func _on_quit_button_button_down(): @@ -176,3 +177,28 @@ func _query_shop(): ) add_child(query_executor) query_executor.run({}) + +func _query_recipe(): + var query = GQLQuery.new("recipe").set_props([ + "id", + "name", + GQLQuery.new("ingredientIDList").set_props([ + "id", + "name", + ]), + GQLQuery.new("foodIDList").set_props([ + "id", + "name" + ]) + ]) + print(query.serialize()) + var query_executor = SvrGqlClient.query( + 'query',{}, query) + + query_executor.graphql_response.connect( + func(data): + SceneContext.set_recipe(data) + ) + add_child(query_executor) + query_executor.run({}) +