Skip to content

Commit

Permalink
feat: show kitchentool shoplist
Browse files Browse the repository at this point in the history
  • Loading branch information
kth1888 committed Mar 4, 2024
1 parent 1238866 commit 85e8795
Show file tree
Hide file tree
Showing 7 changed files with 131 additions and 5 deletions.
4 changes: 2 additions & 2 deletions frontend/Savor-22b/scenes/house/house.tscn
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
20 changes: 20 additions & 0 deletions frontend/Savor-22b/scenes/house/house_inventory.gd
Original file line number Diff line number Diff line change
@@ -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

Expand All @@ -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()
15 changes: 14 additions & 1 deletion frontend/Savor-22b/scenes/house/house_inventory.tscn
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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"]
17 changes: 17 additions & 0 deletions frontend/Savor-22b/scenes/house/kitchenshop.gd
Original file line number Diff line number Diff line change
@@ -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)

55 changes: 55 additions & 0 deletions frontend/Savor-22b/scenes/house/kitchenshop.tscn
Original file line number Diff line number Diff line change
@@ -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 = " 닫기 "
16 changes: 14 additions & 2 deletions frontend/Savor-22b/scenes/house/tool.gd
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand All @@ -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()

9 changes: 9 additions & 0 deletions frontend/Savor-22b/scripts/scenes/intro.gd
Original file line number Diff line number Diff line change
Expand Up @@ -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())
Expand Down

0 comments on commit 85e8795

Please sign in to comment.