Skip to content
This repository was archived by the owner on Feb 7, 2025. It is now read-only.

Commit

Permalink
SVR-167: 레시피북 화면 조회 기능 (#142)
Browse files Browse the repository at this point in the history
* ui: added recipebook ui components

* feat: recipe query impl

* feat: recipe view with ui
  • Loading branch information
kth1888 authored Mar 15, 2024
1 parent 504fe04 commit 84a4894
Show file tree
Hide file tree
Showing 16 changed files with 956 additions and 14 deletions.
2 changes: 1 addition & 1 deletion frontend/Savor-22b/export_presets.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -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=""
Expand Down
5 changes: 3 additions & 2 deletions frontend/Savor-22b/gql/svr_gql_client.gd
Original file line number Diff line number Diff line change
Expand Up @@ -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))
1 change: 1 addition & 0 deletions frontend/Savor-22b/scenes/house/house.tscn
Original file line number Diff line number Diff line change
Expand Up @@ -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"]
16 changes: 16 additions & 0 deletions frontend/Savor-22b/scenes/house/recipebook/ingredient_no.gd
Original file line number Diff line number Diff line change
@@ -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
53 changes: 53 additions & 0 deletions frontend/Savor-22b/scenes/house/recipebook/ingredient_no.tscn
Original file line number Diff line number Diff line change
@@ -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 = "없음"
19 changes: 19 additions & 0 deletions frontend/Savor-22b/scenes/house/recipebook/ingredient_yes.gd
Original file line number Diff line number Diff line change
@@ -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]
27 changes: 27 additions & 0 deletions frontend/Savor-22b/scenes/house/recipebook/ingredient_yes.tscn
Original file line number Diff line number Diff line change
@@ -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 = "[춘장]
보유중"
63 changes: 63 additions & 0 deletions frontend/Savor-22b/scenes/house/recipebook/recipe.gd
Original file line number Diff line number Diff line change
@@ -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
108 changes: 108 additions & 0 deletions frontend/Savor-22b/scenes/house/recipebook/recipe.tscn
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
@@ -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
19 changes: 19 additions & 0 deletions frontend/Savor-22b/scenes/house/recipebook/recipebook.gd
Original file line number Diff line number Diff line change
@@ -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()
Loading

0 comments on commit 84a4894

Please sign in to comment.