This repository was archived by the owner on Feb 7, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* ui: added recipebook ui components * feat: recipe query impl * feat: recipe view with ui
- Loading branch information
Showing
16 changed files
with
956 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
16 changes: 16 additions & 0 deletions
16
frontend/Savor-22b/scenes/house/recipebook/ingredient_no.gd
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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
53
frontend/Savor-22b/scenes/house/recipebook/ingredient_no.tscn
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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
19
frontend/Savor-22b/scenes/house/recipebook/ingredient_yes.gd
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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
27
frontend/Savor-22b/scenes/house/recipebook/ingredient_yes.tscn
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 = "[춘장] | ||
보유중" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
8 changes: 8 additions & 0 deletions
8
frontend/Savor-22b/scenes/house/recipebook/recipe_style_box_flat.tres
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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() |
Oops, something went wrong.