From 29628c4cd8b1194fdb4fe4f988653a9d919ec87e Mon Sep 17 00:00:00 2001 From: Tae Hyoung Kang <78776542+kth1888@users.noreply.github.com> Date: Sat, 2 Mar 2024 22:57:39 +0900 Subject: [PATCH 1/4] ui: added sysshop details --- frontend/Savor-22b/scenes/shop/shop_item.gd | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/frontend/Savor-22b/scenes/shop/shop_item.gd b/frontend/Savor-22b/scenes/shop/shop_item.gd index 5c429266..b742591b 100644 --- a/frontend/Savor-22b/scenes/shop/shop_item.gd +++ b/frontend/Savor-22b/scenes/shop/shop_item.gd @@ -7,7 +7,7 @@ signal button_down var item: Dictionary -var desc_format_string = "%s" +var desc_format_string = "%s : %s %s" func _ready(): update_item() @@ -17,9 +17,8 @@ func update_item(): if itemname == null: return - # 아이템 설명이 추가되면 아이디 대신 이름 넣고 설명 란에 설명 추가하면 됩니다. - itemname.text = str(item.id) - desc.text = item.name + itemname.text = item.name + desc.text = desc_format_string % ["가격", item.price, "BBG"] func set_item(info: Dictionary): item = info From 1728fde1b056b5bb315553d52b2bd7924f0abbab Mon Sep 17 00:00:00 2001 From: Tae Hyoung Kang <78776542+kth1888@users.noreply.github.com> Date: Sat, 2 Mar 2024 23:48:21 +0900 Subject: [PATCH 2/4] ui: house kitchen equipment ui components impl --- frontend/Savor-22b/scenes/house/house.tscn | 75 +++++++++++++++++++ .../scenes/house/house_inventory.tscn | 51 +++++++++++++ .../Savor-22b/scenes/house/kitchentools.tscn | 41 ++++++++++ frontend/Savor-22b/scenes/house/tool.tscn | 35 +++++++++ frontend/Savor-22b/scripts/scenes/house.gd | 6 ++ 5 files changed, 208 insertions(+) create mode 100644 frontend/Savor-22b/scenes/house/house.tscn create mode 100644 frontend/Savor-22b/scenes/house/house_inventory.tscn create mode 100644 frontend/Savor-22b/scenes/house/kitchentools.tscn create mode 100644 frontend/Savor-22b/scenes/house/tool.tscn create mode 100644 frontend/Savor-22b/scripts/scenes/house.gd diff --git a/frontend/Savor-22b/scenes/house/house.tscn b/frontend/Savor-22b/scenes/house/house.tscn new file mode 100644 index 00000000..404c62e4 --- /dev/null +++ b/frontend/Savor-22b/scenes/house/house.tscn @@ -0,0 +1,75 @@ +[gd_scene load_steps=2 format=3 uid="uid://bpobpaan3tquv"] + +[ext_resource type="Script" path="res://scripts/scenes/house.gd" id="1_suicg"] + +[node name="House" type="Control"] +layout_mode = 3 +anchors_preset = 15 +anchor_right = 1.0 +anchor_bottom = 1.0 +grow_horizontal = 2 +grow_vertical = 2 +script = ExtResource("1_suicg") + +[node name="Background" type="ColorRect" parent="."] +layout_mode = 1 +anchors_preset = 15 +anchor_right = 1.0 +anchor_bottom = 1.0 +grow_horizontal = 2 +grow_vertical = 2 + +[node name="Title" type="Label" parent="Background"] +layout_mode = 0 +offset_right = 40.0 +offset_bottom = 23.0 +theme_override_colors/font_color = Color(0, 0, 0, 1) +theme_override_font_sizes/font_size = 60 +text = " 집 화면" + +[node name="M" type="MarginContainer" parent="."] +layout_mode = 1 +anchors_preset = 15 +anchor_right = 1.0 +anchor_bottom = 1.0 +grow_horizontal = 2 +grow_vertical = 2 + +[node name="V" type="VBoxContainer" parent="M"] +layout_mode = 2 + +[node name="menus" type="MarginContainer" parent="M/V"] +layout_mode = 2 +theme_override_constants/margin_left = 20 +theme_override_constants/margin_top = 20 +theme_override_constants/margin_right = 20 +theme_override_constants/margin_bottom = 20 + +[node name="V" type="VBoxContainer" parent="M/V/menus"] +layout_mode = 2 +size_flags_horizontal = 8 + +[node name="HomeButton" type="Button" parent="M/V/menus/V"] +layout_mode = 2 +size_flags_vertical = 0 +theme_override_font_sizes/font_size = 50 +text = "Home" + +[node name="InventoryButton" type="Button" parent="M/V/menus/V"] +layout_mode = 2 +size_flags_vertical = 0 +theme_override_font_sizes/font_size = 50 +text = "Inventory" + +[node name="RefreshButton" type="Button" parent="M/V/menus/V"] +layout_mode = 2 +size_flags_vertical = 0 +theme_override_font_sizes/font_size = 50 +text = "Refresh" + +[node name="subscene" type="MarginContainer" parent="M/V"] +layout_mode = 2 +size_flags_vertical = 3 +theme_override_constants/margin_left = 20 +theme_override_constants/margin_right = 20 +theme_override_constants/margin_bottom = 20 diff --git a/frontend/Savor-22b/scenes/house/house_inventory.tscn b/frontend/Savor-22b/scenes/house/house_inventory.tscn new file mode 100644 index 00000000..86c69bf0 --- /dev/null +++ b/frontend/Savor-22b/scenes/house/house_inventory.tscn @@ -0,0 +1,51 @@ +[gd_scene load_steps=3 format=3 uid="uid://dupiw5pjpvulw"] + +[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_dth2p"] +bg_color = Color(0, 0, 0, 1) + +[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_50occ"] +bg_color = Color(0, 0, 0, 1) + +[node name="HouseInventory" type="Control"] +layout_mode = 3 +anchors_preset = 15 +anchor_right = 1.0 +anchor_bottom = 1.0 +grow_horizontal = 2 +grow_vertical = 2 + +[node name="M" type="MarginContainer" parent="."] +layout_mode = 1 +anchors_preset = 15 +anchor_right = 1.0 +anchor_bottom = 1.0 +grow_horizontal = 2 +grow_vertical = 2 + +[node name="V" type="VBoxContainer" parent="M"] +layout_mode = 2 +theme_override_constants/separation = -1 + +[node name="submenu" type="MarginContainer" parent="M/V"] +layout_mode = 2 +size_flags_horizontal = 0 +size_flags_vertical = 0 + +[node name="tools" type="Button" parent="M/V/submenu"] +layout_mode = 2 +theme_override_font_sizes/font_size = 40 +theme_override_styles/normal = SubResource("StyleBoxFlat_dth2p") +text = " 조리 도구 " + +[node name="Panel" type="Panel" parent="M/V"] +layout_mode = 2 +size_flags_vertical = 3 +theme_override_styles/panel = SubResource("StyleBoxFlat_50occ") + +[node name="M" type="MarginContainer" parent="M/V/Panel"] +layout_mode = 1 +anchors_preset = 15 +anchor_right = 1.0 +anchor_bottom = 1.0 +grow_horizontal = 2 +grow_vertical = 2 diff --git a/frontend/Savor-22b/scenes/house/kitchentools.tscn b/frontend/Savor-22b/scenes/house/kitchentools.tscn new file mode 100644 index 00000000..dfc25eb1 --- /dev/null +++ b/frontend/Savor-22b/scenes/house/kitchentools.tscn @@ -0,0 +1,41 @@ +[gd_scene load_steps=2 format=3 uid="uid://cwqquis7w31g7"] + +[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_rk6tx"] +bg_color = Color(1, 0.541176, 0, 1) + +[node name="Kitchentools" type="Control"] +layout_mode = 3 +anchors_preset = 15 +anchor_right = 1.0 +anchor_bottom = 1.0 +grow_horizontal = 2 +grow_vertical = 2 + +[node name="M" type="MarginContainer" parent="."] +layout_mode = 1 +anchors_preset = 15 +anchor_right = 1.0 +anchor_bottom = 1.0 +grow_horizontal = 2 +grow_vertical = 2 + +[node name="V" type="VBoxContainer" parent="M"] +layout_mode = 2 + +[node name="Items" type="MarginContainer" parent="M/V"] +layout_mode = 2 + +[node name="G" type="GridContainer" parent="M/V/Items"] +layout_mode = 2 + +[node name="Button" type="MarginContainer" parent="M/V"] +layout_mode = 2 +theme_override_constants/margin_right = 80 + +[node name="Close" type="Button" parent="M/V/Button"] +layout_mode = 2 +size_flags_horizontal = 8 +theme_override_colors/font_color = Color(0, 0, 0, 1) +theme_override_font_sizes/font_size = 40 +theme_override_styles/normal = SubResource("StyleBoxFlat_rk6tx") +text = " 닫기 " diff --git a/frontend/Savor-22b/scenes/house/tool.tscn b/frontend/Savor-22b/scenes/house/tool.tscn new file mode 100644 index 00000000..5674977e --- /dev/null +++ b/frontend/Savor-22b/scenes/house/tool.tscn @@ -0,0 +1,35 @@ +[gd_scene load_steps=2 format=3 uid="uid://cjlj4mej5h001"] + +[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_x6mfd"] +bg_color = Color(1, 0.541176, 0, 1) + +[node name="Tool" type="Panel"] +custom_minimum_size = Vector2(300, 200) +offset_right = 40.0 +offset_bottom = 40.0 +theme_override_styles/panel = SubResource("StyleBoxFlat_x6mfd") + +[node name="M" type="MarginContainer" parent="."] +layout_mode = 0 +offset_right = 40.0 +offset_bottom = 40.0 +theme_override_constants/margin_left = 20 +theme_override_constants/margin_top = 20 +theme_override_constants/margin_right = 20 +theme_override_constants/margin_bottom = 20 + +[node name="V" type="VBoxContainer" parent="M"] +layout_mode = 2 +theme_override_constants/separation = 10 + +[node name="Name" type="Label" parent="M/V"] +layout_mode = 2 +theme_override_colors/font_color = Color(0, 0, 0, 1) +theme_override_font_sizes/font_size = 40 +text = "조리도구 이름" + +[node name="Desc" type="Label" parent="M/V"] +layout_mode = 2 +theme_override_colors/font_color = Color(0, 0, 0, 1) +theme_override_font_sizes/font_size = 30 +text = "조리도구 설명" diff --git a/frontend/Savor-22b/scripts/scenes/house.gd b/frontend/Savor-22b/scripts/scenes/house.gd new file mode 100644 index 00000000..3600e147 --- /dev/null +++ b/frontend/Savor-22b/scripts/scenes/house.gd @@ -0,0 +1,6 @@ +extends Control + + +func _ready(): + pass # Replace with function body. + From 1238866898089a9c089ccdbe7ba9ccf3c99da85e Mon Sep 17 00:00:00 2001 From: Tae Hyoung Kang <78776542+kth1888@users.noreply.github.com> Date: Tue, 5 Mar 2024 00:37:39 +0900 Subject: [PATCH 3/4] feat: show kitchentools in inventory --- frontend/Savor-22b/scenes/farm.tscn | 1 + frontend/Savor-22b/scenes/house/house.tscn | 2 ++ .../Savor-22b/scenes/house/house_inventory.gd | 11 +++++++++ .../scenes/house/house_inventory.tscn | 7 ++++-- .../Savor-22b/scenes/house/kitchentools.gd | 16 +++++++++++++ .../Savor-22b/scenes/house/kitchentools.tscn | 16 ++++++++++++- frontend/Savor-22b/scenes/house/tool.gd | 21 ++++++++++++++++ frontend/Savor-22b/scenes/house/tool.tscn | 24 ++++++++++++++----- frontend/Savor-22b/scripts/scenes/farm.gd | 4 ++++ frontend/Savor-22b/scripts/scenes/house.gd | 10 ++++++++ 10 files changed, 103 insertions(+), 9 deletions(-) create mode 100644 frontend/Savor-22b/scenes/house/house_inventory.gd create mode 100644 frontend/Savor-22b/scenes/house/kitchentools.gd create mode 100644 frontend/Savor-22b/scenes/house/tool.gd diff --git a/frontend/Savor-22b/scenes/farm.tscn b/frontend/Savor-22b/scenes/farm.tscn index 23199ca2..e1142e31 100644 --- a/frontend/Savor-22b/scenes/farm.tscn +++ b/frontend/Savor-22b/scenes/farm.tscn @@ -111,4 +111,5 @@ anchors_preset = 0 offset_right = 40.0 offset_bottom = 40.0 +[connection signal="button_down" from="MC/HC/VBoxContainer/MarginContainer/VBoxContainer/HomeButton" to="." method="_on_home_button_button_down"] [connection signal="button_down" from="MC/HC/VBoxContainer/MarginContainer/VBoxContainer/RefreshButton" to="." method="_on_refresh_button_button_down"] diff --git a/frontend/Savor-22b/scenes/house/house.tscn b/frontend/Savor-22b/scenes/house/house.tscn index 404c62e4..e852ef1c 100644 --- a/frontend/Savor-22b/scenes/house/house.tscn +++ b/frontend/Savor-22b/scenes/house/house.tscn @@ -73,3 +73,5 @@ size_flags_vertical = 3 theme_override_constants/margin_left = 20 theme_override_constants/margin_right = 20 theme_override_constants/margin_bottom = 20 + +[connection signal="button_down" from="M/V/menus/V/InventoryButton" to="." method="_on_inventory_button_button_down"] diff --git a/frontend/Savor-22b/scenes/house/house_inventory.gd b/frontend/Savor-22b/scenes/house/house_inventory.gd new file mode 100644 index 00000000..dbbdbae1 --- /dev/null +++ b/frontend/Savor-22b/scenes/house/house_inventory.gd @@ -0,0 +1,11 @@ +extends Control + +const KITCHEN_TOOLS = preload("res://scenes/house/kitchentools.tscn") + +@onready var panel = $M/V/Panel/C + +func _ready(): + var kitchens = KITCHEN_TOOLS.instantiate() + + panel.add_child(kitchens) + diff --git a/frontend/Savor-22b/scenes/house/house_inventory.tscn b/frontend/Savor-22b/scenes/house/house_inventory.tscn index 86c69bf0..29e04a82 100644 --- a/frontend/Savor-22b/scenes/house/house_inventory.tscn +++ b/frontend/Savor-22b/scenes/house/house_inventory.tscn @@ -1,4 +1,6 @@ -[gd_scene load_steps=3 format=3 uid="uid://dupiw5pjpvulw"] +[gd_scene load_steps=4 format=3 uid="uid://dupiw5pjpvulw"] + +[ext_resource type="Script" path="res://scenes/house/house_inventory.gd" id="1_7w8e6"] [sub_resource type="StyleBoxFlat" id="StyleBoxFlat_dth2p"] bg_color = Color(0, 0, 0, 1) @@ -13,6 +15,7 @@ anchor_right = 1.0 anchor_bottom = 1.0 grow_horizontal = 2 grow_vertical = 2 +script = ExtResource("1_7w8e6") [node name="M" type="MarginContainer" parent="."] layout_mode = 1 @@ -42,7 +45,7 @@ layout_mode = 2 size_flags_vertical = 3 theme_override_styles/panel = SubResource("StyleBoxFlat_50occ") -[node name="M" type="MarginContainer" parent="M/V/Panel"] +[node name="C" type="CenterContainer" parent="M/V/Panel"] layout_mode = 1 anchors_preset = 15 anchor_right = 1.0 diff --git a/frontend/Savor-22b/scenes/house/kitchentools.gd b/frontend/Savor-22b/scenes/house/kitchentools.gd new file mode 100644 index 00000000..93ec43ef --- /dev/null +++ b/frontend/Savor-22b/scenes/house/kitchentools.gd @@ -0,0 +1,16 @@ +extends Control + +const TOOL = preload("res://scenes/house/tool.tscn") + +@onready var grid = $M/V/Items/G + +var tools + +func _ready(): + tools = SceneContext.user_state.inventoryState["kitchenEquipmentStateList"] + + for tool in tools: + var toolpanel = TOOL.instantiate() + toolpanel.set_info(tool) + grid.add_child(toolpanel) + diff --git a/frontend/Savor-22b/scenes/house/kitchentools.tscn b/frontend/Savor-22b/scenes/house/kitchentools.tscn index dfc25eb1..1232da5f 100644 --- a/frontend/Savor-22b/scenes/house/kitchentools.tscn +++ b/frontend/Savor-22b/scenes/house/kitchentools.tscn @@ -1,4 +1,6 @@ -[gd_scene load_steps=2 format=3 uid="uid://cwqquis7w31g7"] +[gd_scene load_steps=3 format=3 uid="uid://cwqquis7w31g7"] + +[ext_resource type="Script" path="res://scenes/house/kitchentools.gd" id="1_bkji1"] [sub_resource type="StyleBoxFlat" id="StyleBoxFlat_rk6tx"] bg_color = Color(1, 0.541176, 0, 1) @@ -8,8 +10,10 @@ layout_mode = 3 anchors_preset = 15 anchor_right = 1.0 anchor_bottom = 1.0 +offset_bottom = -357.0 grow_horizontal = 2 grow_vertical = 2 +script = ExtResource("1_bkji1") [node name="M" type="MarginContainer" parent="."] layout_mode = 1 @@ -21,12 +25,22 @@ grow_vertical = 2 [node name="V" type="VBoxContainer" parent="M"] layout_mode = 2 +size_flags_horizontal = 0 +size_flags_vertical = 8 [node name="Items" type="MarginContainer" parent="M/V"] layout_mode = 2 +theme_override_constants/margin_left = 50 +theme_override_constants/margin_top = 50 +theme_override_constants/margin_right = 50 +theme_override_constants/margin_bottom = 50 [node name="G" type="GridContainer" parent="M/V/Items"] +custom_minimum_size = Vector2(1780, 500) layout_mode = 2 +theme_override_constants/h_separation = 50 +theme_override_constants/v_separation = 50 +columns = 5 [node name="Button" type="MarginContainer" parent="M/V"] layout_mode = 2 diff --git a/frontend/Savor-22b/scenes/house/tool.gd b/frontend/Savor-22b/scenes/house/tool.gd new file mode 100644 index 00000000..1148e102 --- /dev/null +++ b/frontend/Savor-22b/scenes/house/tool.gd @@ -0,0 +1,21 @@ +extends Panel + +@onready var toolname = $M/V/Name +@onready var tooldesc = $M/V/Desc + +var info + +func _ready(): + _update_info() + + +func _update_info(): + if toolname == null: + return + + toolname.text = info.equipmentName + tooldesc.text = info.stateId + +func set_info(info: Dictionary): + self.info = info + diff --git a/frontend/Savor-22b/scenes/house/tool.tscn b/frontend/Savor-22b/scenes/house/tool.tscn index 5674977e..6bbfe77e 100644 --- a/frontend/Savor-22b/scenes/house/tool.tscn +++ b/frontend/Savor-22b/scenes/house/tool.tscn @@ -1,18 +1,27 @@ -[gd_scene load_steps=2 format=3 uid="uid://cjlj4mej5h001"] +[gd_scene load_steps=3 format=3 uid="uid://cjlj4mej5h001"] + +[ext_resource type="Script" path="res://scenes/house/tool.gd" id="1_fsq81"] [sub_resource type="StyleBoxFlat" id="StyleBoxFlat_x6mfd"] bg_color = Color(1, 0.541176, 0, 1) [node name="Tool" type="Panel"] custom_minimum_size = Vector2(300, 200) -offset_right = 40.0 -offset_bottom = 40.0 +offset_right = 300.0 +offset_bottom = 200.0 +size_flags_horizontal = 0 theme_override_styles/panel = SubResource("StyleBoxFlat_x6mfd") +script = ExtResource("1_fsq81") [node name="M" type="MarginContainer" parent="."] -layout_mode = 0 -offset_right = 40.0 -offset_bottom = 40.0 +layout_mode = 1 +anchors_preset = 15 +anchor_right = 1.0 +anchor_bottom = 1.0 +offset_top = -18.5 +offset_bottom = 18.5 +grow_horizontal = 2 +grow_vertical = 2 theme_override_constants/margin_left = 20 theme_override_constants/margin_top = 20 theme_override_constants/margin_right = 20 @@ -29,7 +38,10 @@ theme_override_font_sizes/font_size = 40 text = "조리도구 이름" [node name="Desc" type="Label" parent="M/V"] +custom_minimum_size = Vector2(260, 132) layout_mode = 2 theme_override_colors/font_color = Color(0, 0, 0, 1) theme_override_font_sizes/font_size = 30 text = "조리도구 설명" +autowrap_mode = 1 +max_lines_visible = 3 diff --git a/frontend/Savor-22b/scripts/scenes/farm.gd b/frontend/Savor-22b/scripts/scenes/farm.gd index 81ebe0a8..11fcce20 100644 --- a/frontend/Savor-22b/scripts/scenes/farm.gd +++ b/frontend/Savor-22b/scripts/scenes/farm.gd @@ -265,3 +265,7 @@ func fetch_new(): func _on_refresh_button_button_down(): fetch_new() + + +func _on_home_button_button_down(): + get_tree().change_scene_to_file("res://scenes/house/house.tscn") diff --git a/frontend/Savor-22b/scripts/scenes/house.gd b/frontend/Savor-22b/scripts/scenes/house.gd index 3600e147..e3f0dac4 100644 --- a/frontend/Savor-22b/scripts/scenes/house.gd +++ b/frontend/Savor-22b/scripts/scenes/house.gd @@ -1,6 +1,16 @@ extends Control +const HOUSE_INVENTORY = preload("res://scenes/house/house_inventory.tscn") + +@onready var subscene = $M/V/subscene func _ready(): pass # Replace with function body. + + + +func _on_inventory_button_button_down(): + var inventory = HOUSE_INVENTORY.instantiate() + + subscene.add_child(inventory) From 85e8795dfe2d82ed92310cbf0092a6c8bd1884f8 Mon Sep 17 00:00:00 2001 From: Tae Hyoung Kang <78776542+kth1888@users.noreply.github.com> Date: Tue, 5 Mar 2024 01:12:44 +0900 Subject: [PATCH 4/4] feat: show kitchentool shoplist --- frontend/Savor-22b/scenes/house/house.tscn | 4 +- .../Savor-22b/scenes/house/house_inventory.gd | 20 +++++++ .../scenes/house/house_inventory.tscn | 15 ++++- .../Savor-22b/scenes/house/kitchenshop.gd | 17 ++++++ .../Savor-22b/scenes/house/kitchenshop.tscn | 55 +++++++++++++++++++ frontend/Savor-22b/scenes/house/tool.gd | 16 +++++- frontend/Savor-22b/scripts/scenes/intro.gd | 9 +++ 7 files changed, 131 insertions(+), 5 deletions(-) create mode 100644 frontend/Savor-22b/scenes/house/kitchenshop.gd create mode 100644 frontend/Savor-22b/scenes/house/kitchenshop.tscn diff --git a/frontend/Savor-22b/scenes/house/house.tscn b/frontend/Savor-22b/scenes/house/house.tscn index e852ef1c..54a88677 100644 --- a/frontend/Savor-22b/scenes/house/house.tscn +++ b/frontend/Savor-22b/scenes/house/house.tscn @@ -49,11 +49,11 @@ theme_override_constants/margin_bottom = 20 layout_mode = 2 size_flags_horizontal = 8 -[node name="HomeButton" type="Button" parent="M/V/menus/V"] +[node name="RecipeButton" type="Button" parent="M/V/menus/V"] layout_mode = 2 size_flags_vertical = 0 theme_override_font_sizes/font_size = 50 -text = "Home" +text = "Recipe" [node name="InventoryButton" type="Button" parent="M/V/menus/V"] layout_mode = 2 diff --git a/frontend/Savor-22b/scenes/house/house_inventory.gd b/frontend/Savor-22b/scenes/house/house_inventory.gd index dbbdbae1..ac2c4cda 100644 --- a/frontend/Savor-22b/scenes/house/house_inventory.gd +++ b/frontend/Savor-22b/scenes/house/house_inventory.gd @@ -1,6 +1,7 @@ extends Control const KITCHEN_TOOLS = preload("res://scenes/house/kitchentools.tscn") +const KITCHEN_SHOP = preload("res://scenes/house/kitchenshop.tscn") @onready var panel = $M/V/Panel/C @@ -9,3 +10,22 @@ func _ready(): panel.add_child(kitchens) + + + +func _on_tools_button_down(): + clear_popup() + var kitchens = KITCHEN_TOOLS.instantiate() + + panel.add_child(kitchens) + +func _on_shop_button_down(): + clear_popup() + var kitchens = KITCHEN_SHOP.instantiate() + + panel.add_child(kitchens) + +func clear_popup(): + if is_instance_valid(panel): + for pop in panel.get_children(): + pop.queue_free() diff --git a/frontend/Savor-22b/scenes/house/house_inventory.tscn b/frontend/Savor-22b/scenes/house/house_inventory.tscn index 29e04a82..9f4593b0 100644 --- a/frontend/Savor-22b/scenes/house/house_inventory.tscn +++ b/frontend/Savor-22b/scenes/house/house_inventory.tscn @@ -34,12 +34,22 @@ layout_mode = 2 size_flags_horizontal = 0 size_flags_vertical = 0 -[node name="tools" type="Button" parent="M/V/submenu"] +[node name="H" type="HBoxContainer" parent="M/V/submenu"] +layout_mode = 2 +theme_override_constants/separation = 20 + +[node name="tools" type="Button" parent="M/V/submenu/H"] layout_mode = 2 theme_override_font_sizes/font_size = 40 theme_override_styles/normal = SubResource("StyleBoxFlat_dth2p") text = " 조리 도구 " +[node name="shop" type="Button" parent="M/V/submenu/H"] +layout_mode = 2 +theme_override_font_sizes/font_size = 40 +theme_override_styles/normal = SubResource("StyleBoxFlat_dth2p") +text = " 도구 상점 " + [node name="Panel" type="Panel" parent="M/V"] layout_mode = 2 size_flags_vertical = 3 @@ -52,3 +62,6 @@ anchor_right = 1.0 anchor_bottom = 1.0 grow_horizontal = 2 grow_vertical = 2 + +[connection signal="button_down" from="M/V/submenu/H/tools" to="." method="_on_tools_button_down"] +[connection signal="button_down" from="M/V/submenu/H/shop" to="." method="_on_shop_button_down"] diff --git a/frontend/Savor-22b/scenes/house/kitchenshop.gd b/frontend/Savor-22b/scenes/house/kitchenshop.gd new file mode 100644 index 00000000..9c9dc150 --- /dev/null +++ b/frontend/Savor-22b/scenes/house/kitchenshop.gd @@ -0,0 +1,17 @@ +extends Control + +const TOOL = preload("res://scenes/house/tool.tscn") + +@onready var grid = $M/V/Items/G + +var list + +func _ready(): + list = SceneContext.shop["kitchenEquipments"] + + for tool in list: + var toolpanel = TOOL.instantiate() + toolpanel.set_slottype() + toolpanel.set_info(tool) + grid.add_child(toolpanel) + diff --git a/frontend/Savor-22b/scenes/house/kitchenshop.tscn b/frontend/Savor-22b/scenes/house/kitchenshop.tscn new file mode 100644 index 00000000..d21420d8 --- /dev/null +++ b/frontend/Savor-22b/scenes/house/kitchenshop.tscn @@ -0,0 +1,55 @@ +[gd_scene load_steps=3 format=3 uid="uid://bsj3rpdgusned"] + +[ext_resource type="Script" path="res://scenes/house/kitchenshop.gd" id="1_aqlr8"] + +[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_rk6tx"] +bg_color = Color(1, 0.541176, 0, 1) + +[node name="Kitchenshop" type="Control"] +layout_mode = 3 +anchors_preset = 15 +anchor_right = 1.0 +anchor_bottom = 1.0 +offset_bottom = -357.0 +grow_horizontal = 2 +grow_vertical = 2 +script = ExtResource("1_aqlr8") + +[node name="M" type="MarginContainer" parent="."] +layout_mode = 1 +anchors_preset = 15 +anchor_right = 1.0 +anchor_bottom = 1.0 +grow_horizontal = 2 +grow_vertical = 2 + +[node name="V" type="VBoxContainer" parent="M"] +layout_mode = 2 +size_flags_horizontal = 0 +size_flags_vertical = 8 + +[node name="Items" type="MarginContainer" parent="M/V"] +layout_mode = 2 +theme_override_constants/margin_left = 50 +theme_override_constants/margin_top = 50 +theme_override_constants/margin_right = 50 +theme_override_constants/margin_bottom = 50 + +[node name="G" type="GridContainer" parent="M/V/Items"] +custom_minimum_size = Vector2(1780, 500) +layout_mode = 2 +theme_override_constants/h_separation = 50 +theme_override_constants/v_separation = 50 +columns = 5 + +[node name="Button" type="MarginContainer" parent="M/V"] +layout_mode = 2 +theme_override_constants/margin_right = 80 + +[node name="Close" type="Button" parent="M/V/Button"] +layout_mode = 2 +size_flags_horizontal = 8 +theme_override_colors/font_color = Color(0, 0, 0, 1) +theme_override_font_sizes/font_size = 40 +theme_override_styles/normal = SubResource("StyleBoxFlat_rk6tx") +text = " 닫기 " diff --git a/frontend/Savor-22b/scenes/house/tool.gd b/frontend/Savor-22b/scenes/house/tool.gd index 1148e102..4c53e098 100644 --- a/frontend/Savor-22b/scenes/house/tool.gd +++ b/frontend/Savor-22b/scenes/house/tool.gd @@ -4,6 +4,10 @@ extends Panel @onready var tooldesc = $M/V/Desc var info +var isshop: bool = false + +var desc_format_string = "%s : %s +%s : %s %s" func _ready(): _update_info() @@ -13,9 +17,17 @@ func _update_info(): if toolname == null: return - toolname.text = info.equipmentName - tooldesc.text = info.stateId + if (isshop): + toolname.text = info.name + tooldesc.text = desc_format_string % [info.categoryType, info.categoryLabel, "Price", info.price, "BBG"] + else: + toolname.text = info.equipmentName + tooldesc.text = info.stateId func set_info(info: Dictionary): self.info = info +func set_slottype(): + self.isshop = true + _update_info() + diff --git a/frontend/Savor-22b/scripts/scenes/intro.gd b/frontend/Savor-22b/scripts/scenes/intro.gd index 12b28257..244fff15 100644 --- a/frontend/Savor-22b/scripts/scenes/intro.gd +++ b/frontend/Savor-22b/scripts/scenes/intro.gd @@ -154,6 +154,15 @@ func _query_shop(): "id", "name", "price", + ]), + GQLQuery.new("kitchenEquipments").set_props([ + "id", + "categoryID", + "categoryLabel", + "categoryType", + "name", + "blockTimeReductionPercent", + "price" ]) ]) print(query.serialize())