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.
- Loading branch information
Showing
19 changed files
with
878 additions
and
119 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
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.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.gd" id="1_g877k"] | ||
|
||
[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" 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_g877k") | ||
|
||
[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
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
File renamed without changes.
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
File renamed without changes.
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
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 |
Oops, something went wrong.