1
Fork 0
mirror of https://github.com/Steffo99/swear-jar.git synced 2024-11-21 15:24:18 +00:00

Configure shop

This commit is contained in:
Steffo 2023-10-02 19:19:13 +02:00
parent 732afe9143
commit b1b3c38ae3
Signed by: steffo
GPG key ID: 2A24051445686895
15 changed files with 170 additions and 33 deletions

BIN
converters/gold_to_gem/gold_converter.png (Stored with Git LFS) Normal file

Binary file not shown.

View file

@ -0,0 +1,34 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://dsqe2oovfkwbv"
path="res://.godot/imported/gold_converter.png-c97ed8aabb06265133e84a8c0bb3469a.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://converters/gold_to_gem/gold_converter.png"
dest_files=["res://.godot/imported/gold_converter.png-c97ed8aabb06265133e84a8c0bb3469a.ctex"]
[params]
compress/mode=0
compress/high_quality=false
compress/lossy_quality=0.7
compress/hdr_compression=1
compress/normal_map=0
compress/channel_pack=0
mipmaps/generate=false
mipmaps/limit=-1
roughness/mode=0
roughness/src_normal=""
process/fix_alpha_border=true
process/premult_alpha=false
process/normal_map_invert_y=false
process/hdr_as_srgb=false
process/hdr_clamp_exposure=false
process/size_limit=0
detect_3d/compress_to=1

BIN
converters/item_converter/item_converter.png (Stored with Git LFS) Normal file

Binary file not shown.

View file

@ -0,0 +1,34 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://bktdm8yu8tdfn"
path="res://.godot/imported/item_converter.png-0febea25a7bcc0d0f66bd7b973ca9937.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://converters/item_converter/item_converter.png"
dest_files=["res://.godot/imported/item_converter.png-0febea25a7bcc0d0f66bd7b973ca9937.ctex"]
[params]
compress/mode=0
compress/high_quality=false
compress/lossy_quality=0.7
compress/hdr_compression=1
compress/normal_map=0
compress/channel_pack=0
mipmaps/generate=false
mipmaps/limit=-1
roughness/mode=0
roughness/src_normal=""
process/fix_alpha_border=true
process/premult_alpha=false
process/normal_map_invert_y=false
process/hdr_as_srgb=false
process/hdr_clamp_exposure=false
process/size_limit=0
detect_3d/compress_to=1

View file

@ -39,8 +39,6 @@ func _on_purchase_begin(what: PurchasableItem):
update_counter_icon()
update_counter_text()
store_collector_panel.show()
ghost.process_mode = Node.PROCESS_MODE_INHERIT
ghost.show()
time_spawner_timer.stop()
func _handle_purchase_success(what: PurchasableItem):
@ -85,3 +83,9 @@ func update_counter_icon():
store_collector_texturerect.texture = upgrade_gold_texture
else:
store_collector_texturerect.texture = null
func _on_ghost_requested(scene: PackedScene, texture: Texture2D):
ghost.scene_to_instantiate = scene
ghost.preview_texture = texture
ghost.process_mode = Node.PROCESS_MODE_INHERIT
ghost.show()

View file

@ -5,7 +5,6 @@
[ext_resource type="PackedScene" uid="uid://d05b8jy3xmpcb" path="res://bottle/gravity_from_gyro.tscn" id="2_h2pfr"]
[ext_resource type="Texture2D" uid="uid://7b12rwclhrq0" path="res://interface/upgrade_silver.png" id="3_8wvr1"]
[ext_resource type="PackedScene" uid="uid://c67lfbk4gf1ga" path="res://spawner/spawner.tscn" id="3_qwsty"]
[ext_resource type="PackedScene" uid="uid://c3kitncwpi42j" path="res://entity/coin_copper/coin_copper.tscn" id="4_5oayc"]
[ext_resource type="Texture2D" uid="uid://taojrwr7xrp4" path="res://interface/upgrade_gold.png" id="4_i557v"]
[ext_resource type="Texture2D" uid="uid://pj3ip6vlatms" path="res://converters/copper_to_silver/copper_converter.png" id="6_0jj8g"]
[ext_resource type="PackedScene" uid="uid://beg758fa6o0cs" path="res://value/evaluator.tscn" id="6_my6nv"]
@ -15,6 +14,7 @@
[ext_resource type="PackedScene" uid="uid://c5w3b55aiui6c" path="res://collector/collector.tscn" id="9_evdhb"]
[ext_resource type="Theme" uid="uid://ba5utvfhnxa5i" path="res://interface/interface_theme.tres" id="10_sayqn"]
[ext_resource type="Texture2D" uid="uid://c8pvjgtr2ufjl" path="res://interface/upgrade_copper.png" id="11_lt33g"]
[ext_resource type="PackedScene" uid="uid://c3kitncwpi42j" path="res://entity/coin_copper/coin_copper.tscn" id="13_4j8om"]
[ext_resource type="PackedScene" uid="uid://qtk4tm6l367w" path="res://interface/ghost.tscn" id="16_8vhx6"]
[sub_resource type="RectangleShape2D" id="RectangleShape2D_rh35r"]
@ -79,7 +79,7 @@ debug_color = Color(0, 0.6, 0.701961, 0)
[node name="ButtonSpawner" parent="." node_paths=PackedStringArray("target") instance=ExtResource("3_qwsty")]
position = Vector2(136, 0)
scene = ExtResource("4_5oayc")
scene = ExtResource("13_4j8om")
target = NodePath("..")
buffer_cap = 10
spawn_rect = Rect2(-20, 0, 40, 0)

View file

@ -42,7 +42,7 @@ offset_bottom = 54.0
grow_horizontal = 0
size_flags_horizontal = 8
text = "Shop"
alignment = 0
alignment = 2
[connection signal="pressed" from="SpawnButton" to="." method="_on_spawn_button_pressed"]
[connection signal="pressed" from="ShopButton" to="." method="_on_shop_button_pressed"]

View file

@ -3,7 +3,7 @@
[ext_resource type="FontFile" uid="uid://cs8tiwyb76gig" path="res://interface/font/press-start/prstart.ttf" id="1_mtdor"]
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_knce4"]
bg_color = Color(0.0901961, 0.227451, 0.290196, 0.929412)
bg_color = Color(0.0901961, 0.227451, 0.290196, 0.686275)
border_width_left = 2
border_width_top = 2
border_width_right = 2

View file

@ -33,6 +33,9 @@ class_name PurchasableItem
item_cost_text = value
$Contents/Action/CostLabel.text = value
## If this is a converter, the scene to instantiate.
@export var item_scene: PackedScene
## Collectible type of the item required to buy the item.
@export var item_cost_type: StringName

View file

@ -5,7 +5,7 @@
[ext_resource type="Theme" uid="uid://ba5utvfhnxa5i" path="res://interface/interface_theme.tres" id="1_r2qbu"]
[node name="PurchasableItem" type="Panel"]
custom_minimum_size = Vector2(0, 240)
custom_minimum_size = Vector2(0, 150)
anchors_preset = 10
anchor_right = 1.0
grow_horizontal = 2
@ -52,6 +52,8 @@ layout_mode = 2
size_flags_horizontal = 3
theme_override_font_sizes/font_size = 16
text = "ITEMNAME"
vertical_alignment = 1
autowrap_mode = 2
uppercase = true
[node name="NamePaddingRight" type="Control" parent="Contents/Header"]
@ -78,7 +80,7 @@ mouse_filter = 1
layout_mode = 2
size_flags_horizontal = 3
mouse_filter = 1
theme_override_font_sizes/font_size = 16
theme_override_font_sizes/font_size = 8
text = "What does this item do? Nobody knows."
autowrap_mode = 2
@ -115,7 +117,7 @@ mouse_filter = 1
layout_mode = 2
size_flags_horizontal = 10
mouse_filter = 1
theme_override_font_sizes/font_size = 16
theme_override_font_sizes/font_size = 8
text = "3 fiorygi"
horizontal_alignment = 2
vertical_alignment = 1

View file

@ -1,7 +1,7 @@
[gd_scene format=3 uid="uid://wodgj6rp2ewm"]
[node name="PurchasableItemPadding" type="Control"]
custom_minimum_size = Vector2(0, 8)
custom_minimum_size = Vector2(0, 2)
layout_mode = 3
anchors_preset = 0
mouse_filter = 1

View file

@ -9,5 +9,5 @@ offset_bottom = 54.0
size_flags_horizontal = 0
theme_override_font_sizes/font_size = 16
text = "$0.00"
alignment = 2
alignment = 0
script = ExtResource("1_ol56t")

View file

@ -26,6 +26,8 @@ signal purchase_success(what: PurchasableItem)
## Array of all PurchasableItems that this ShopUI should control.
@onready var purchasable_items: Array[Node] = find_children("*", "PurchasableItem")
signal ghost_requested(scene: PackedScene, texture: Texture2D)
func _ready():
for item in purchasable_items:
@ -37,6 +39,8 @@ func _on_any_purchase_begin(what: Node):
if not what is PurchasableItem:
push_error("Purchase began outside a PurchasableItem")
return
if what.item_scene:
ghost_requested.emit(what.item_scene, what.item_icon)
purchase_begin.emit(what)
for item in purchasable_items:
if item == what:
@ -57,6 +61,8 @@ func _on_any_purchase_success(what: Node):
if not what is PurchasableItem:
push_error("Purchase succeeded outside a PurchasableItem")
return
if what.item_scene:
ghost_materialize.emit()
purchase_success.emit(what)
for item in purchasable_items:
if item == what:
@ -122,3 +128,26 @@ func _on_buy_silver_star_purchase_success():
func _on_buy_gold_star_purchase_success():
print("[ShopUI] Upgrading to Manual Gold...")
upgraded_manual_spawn.emit(gold_coin_scene)
signal ghost_materialize
func _on_buy_silverifier_purchase_success():
print("[ShopUI] Completing Silver-ifier...")
$Rows/PaddedScrollable/Scrollable/ScrollableItems/ConvertCategory/BuyGoldenser.has_unlocked = true
func _on_buy_goldenser_purchase_success():
print("[ShopUI] Completing Gold-enser...")
$Rows/PaddedScrollable/Scrollable/ScrollableItems/ConvertCategory/BuyGemificator.has_unlocked = true
$Rows/PaddedScrollable/Scrollable/ScrollableItems/ConvertCategory/BuyCompressor.has_unlocked = true
func _on_buy_gemificator_purchase_begin():
print("[ShopUI] Completing Gem-ificator...")
$Rows/PaddedScrollable/Scrollable/ScrollableItems/ConvertCategory/BuyArtifactomatic.has_unlocked = true
func _on_buy_compressor_purchase_success():
print("[ShopUI] Completing Coal-pressor...")
$Rows/PaddedScrollable/Scrollable/ScrollableItems/ConvertCategory/BuyArtifactomatic.has_unlocked = true
func _on_buy_artifactomatic_purchase_success():
print("[ShopUI] Completing Arti-factory...")

View file

@ -1,4 +1,4 @@
[gd_scene load_steps=14 format=3 uid="uid://cklkdygv61bny"]
[gd_scene load_steps=20 format=3 uid="uid://cklkdygv61bny"]
[ext_resource type="Theme" uid="uid://ba5utvfhnxa5i" path="res://interface/interface_theme.tres" id="1_qdf0y"]
[ext_resource type="PackedScene" uid="uid://dul1fpyh733t7" path="res://interface/purchasable_item.tscn" id="2_2dtc0"]
@ -13,6 +13,12 @@
[ext_resource type="Texture2D" uid="uid://c8pvjgtr2ufjl" path="res://interface/upgrade_copper.png" id="8_270dw"]
[ext_resource type="Texture2D" uid="uid://7b12rwclhrq0" path="res://interface/upgrade_silver.png" id="8_caq4i"]
[ext_resource type="Texture2D" uid="uid://taojrwr7xrp4" path="res://interface/upgrade_gold.png" id="9_amnej"]
[ext_resource type="PackedScene" uid="uid://ratkps4plkhl" path="res://converters/copper_to_silver/copper_converter.tscn" id="10_dui5v"]
[ext_resource type="PackedScene" uid="uid://but1bdslxp5jl" path="res://converters/silver_to_gold/silver_converter.tscn" id="12_ml4jm"]
[ext_resource type="Texture2D" uid="uid://dsqe2oovfkwbv" path="res://converters/gold_to_gem/gold_converter.png" id="13_gsd84"]
[ext_resource type="PackedScene" uid="uid://cb1t7ylnkmt3t" path="res://converters/gold_to_gem/gold_converter.tscn" id="13_m0kio"]
[ext_resource type="Texture2D" uid="uid://bktdm8yu8tdfn" path="res://converters/item_converter/item_converter.png" id="14_1p6uj"]
[ext_resource type="PackedScene" uid="uid://ddrhfhebwtq5" path="res://converters/item_converter/item_converter.tscn" id="14_tgckt"]
[node name="ShopUI" type="Panel"]
anchors_preset = 15
@ -34,30 +40,36 @@ anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
[node name="UpperButtons" type="HBoxContainer" parent="Rows"]
[node name="UpperButtons" type="Control" parent="Rows"]
custom_minimum_size = Vector2(0, 54)
layout_mode = 2
[node name="ScoreButton" parent="Rows/UpperButtons" instance=ExtResource("3_7vro3")]
layout_mode = 2
[node name="UpperButtonsSpacerLeft" type="Control" parent="Rows/UpperButtons"]
layout_mode = 2
size_flags_horizontal = 3
custom_minimum_size = Vector2(88, 0)
layout_mode = 0
[node name="DeleteButton" type="Button" parent="Rows/UpperButtons"]
custom_minimum_size = Vector2(72, 0)
layout_mode = 2
custom_minimum_size = Vector2(88, 0)
layout_mode = 1
anchors_preset = 5
anchor_left = 0.5
anchor_right = 0.5
offset_left = -36.0
offset_right = 36.0
offset_bottom = 54.0
grow_horizontal = 2
size_flags_horizontal = 4
text = "Del"
[node name="UpperButtonsSpacerRight" type="Control" parent="Rows/UpperButtons"]
layout_mode = 2
size_flags_horizontal = 3
[node name="BackButton" type="Button" parent="Rows/UpperButtons"]
custom_minimum_size = Vector2(72, 0)
layout_mode = 2
custom_minimum_size = Vector2(88, 0)
layout_mode = 1
anchors_preset = 1
anchor_left = 1.0
anchor_right = 1.0
offset_left = -72.0
offset_bottom = 54.0
grow_horizontal = 0
size_flags_horizontal = 8
text = "Back"
alignment = 2
@ -68,7 +80,7 @@ layout_mode = 2
size_flags_vertical = 3
[node name="PaddedScrollableLeft" type="Control" parent="Rows/PaddedScrollable"]
custom_minimum_size = Vector2(8, 0)
custom_minimum_size = Vector2(2, 0)
layout_mode = 2
size_flags_horizontal = 0
@ -106,9 +118,10 @@ layout_mode = 2
[node name="BuySilverifier" parent="Rows/PaddedScrollable/Scrollable/ScrollableItems/ConvertCategory" instance=ExtResource("2_2dtc0")]
layout_mode = 2
item_icon = ExtResource("5_lu2tr")
item_name = "Silverifier"
item_name = "Silver-ifier"
item_description = "Exchanges ten copper coins for a shiny silver coin!"
item_cost_text = "35 copper"
item_scene = ExtResource("10_dui5v")
item_cost_type = &"Copper"
item_cost_goal = 35
@ -118,9 +131,10 @@ layout_mode = 2
[node name="BuyGoldenser" parent="Rows/PaddedScrollable/Scrollable/ScrollableItems/ConvertCategory" instance=ExtResource("2_2dtc0")]
layout_mode = 2
item_icon = ExtResource("6_70u64")
item_name = "Goldenser"
item_name = "Gold-enser"
item_description = "Trades in ten silver coins for a sparkly gold coin!"
item_cost_text = "??"
item_scene = ExtResource("12_ml4jm")
has_unlocked = false
[node name="PurchasableItemPadding2" parent="Rows/PaddedScrollable/Scrollable/ScrollableItems/ConvertCategory" instance=ExtResource("3_4feaj")]
@ -128,9 +142,11 @@ layout_mode = 2
[node name="BuyGemificator" parent="Rows/PaddedScrollable/Scrollable/ScrollableItems/ConvertCategory" instance=ExtResource("2_2dtc0")]
layout_mode = 2
item_name = "Gemificator"
item_icon = ExtResource("13_gsd84")
item_name = "Gem-ificator"
item_description = "Converts ten gold coins into a randomly colored gem!"
item_cost_text = "??"
item_scene = ExtResource("13_m0kio")
has_unlocked = false
[node name="PurchasableItemPadding4" parent="Rows/PaddedScrollable/Scrollable/ScrollableItems/ConvertCategory" instance=ExtResource("3_4feaj")]
@ -138,7 +154,7 @@ layout_mode = 2
[node name="BuyCompressor" parent="Rows/PaddedScrollable/Scrollable/ScrollableItems/ConvertCategory" instance=ExtResource("2_2dtc0")]
layout_mode = 2
item_name = "Compressor"
item_name = "Coal-pressor"
item_description = "Consumes ten gold coins to create either a precious white diamond or an useless lump of coal!"
item_cost_text = "??"
has_unlocked = false
@ -148,9 +164,11 @@ layout_mode = 2
[node name="BuyArtifactomatic" parent="Rows/PaddedScrollable/Scrollable/ScrollableItems/ConvertCategory" instance=ExtResource("2_2dtc0")]
layout_mode = 2
item_name = "Artifactic"
item_icon = ExtResource("14_1p6uj")
item_name = "Arti-factory"
item_description = "Assembles an artifact from twenty-five gold coins and a gem or a diamond!"
item_cost_text = "??"
item_scene = ExtResource("14_tgckt")
has_unlocked = false
[node name="PurchasableItemPadding7" parent="Rows/PaddedScrollable/Scrollable/ScrollableItems/ConvertCategory" instance=ExtResource("3_4feaj")]
@ -292,13 +310,18 @@ one_shot = true
layout_mode = 2
[node name="PaddedScrollableRight" type="Control" parent="Rows/PaddedScrollable"]
custom_minimum_size = Vector2(8, 0)
custom_minimum_size = Vector2(2, 0)
layout_mode = 2
size_flags_horizontal = 8
[connection signal="pressed" from="Rows/UpperButtons/ScoreButton" to="." method="_on_score_button_pressed"]
[connection signal="pressed" from="Rows/UpperButtons/DeleteButton" to="." method="_on_delete_button_pressed"]
[connection signal="pressed" from="Rows/UpperButtons/BackButton" to="." method="_on_back_button_pressed"]
[connection signal="purchase_success" from="Rows/PaddedScrollable/Scrollable/ScrollableItems/ConvertCategory/BuySilverifier" to="." method="_on_buy_silverifier_purchase_success"]
[connection signal="purchase_success" from="Rows/PaddedScrollable/Scrollable/ScrollableItems/ConvertCategory/BuyGoldenser" to="." method="_on_buy_goldenser_purchase_success"]
[connection signal="purchase_begin" from="Rows/PaddedScrollable/Scrollable/ScrollableItems/ConvertCategory/BuyGemificator" to="." method="_on_buy_gemificator_purchase_begin"]
[connection signal="purchase_success" from="Rows/PaddedScrollable/Scrollable/ScrollableItems/ConvertCategory/BuyCompressor" to="." method="_on_buy_compressor_purchase_success"]
[connection signal="purchase_success" from="Rows/PaddedScrollable/Scrollable/ScrollableItems/ConvertCategory/BuyArtifactomatic" to="." method="_on_buy_artifactomatic_purchase_success"]
[connection signal="purchase_success" from="Rows/PaddedScrollable/Scrollable/ScrollableItems/ManualCategory/BuyAutoCopper" to="." method="_on_buy_auto_copper_purchase_success"]
[connection signal="purchase_success" from="Rows/PaddedScrollable/Scrollable/ScrollableItems/ManualCategory/BuyHeliCopper" to="." method="_on_buy_heli_copper_purchase_success"]
[connection signal="purchase_success" from="Rows/PaddedScrollable/Scrollable/ScrollableItems/ManualCategory/BuyAutoSilver" to="." method="_on_buy_auto_silver_purchase_success"]

View file

@ -77,11 +77,13 @@ apply_margin_bottom = true
layout_mode = 2
[connection signal="score_changed" from="CustomUI/GameViewport/Viewport/Game" to="CustomUI/GameSafeUI/GameUI" method="_on_game_score_changed"]
[connection signal="score_changed" from="CustomUI/GameViewport/Viewport/Game" to="CustomUI/ShopSafeUI/ShopUI" method="_on_game_score_changed"]
[connection signal="score_button_pressed" from="CustomUI/GameSafeUI/GameUI" to="." method="_on_game_ui_score_button_pressed"]
[connection signal="shop_button_pressed" from="CustomUI/GameSafeUI/GameUI" to="." method="_on_game_ui_shop_button_pressed"]
[connection signal="spawn_button_pressed" from="CustomUI/GameSafeUI/GameUI" to="CustomUI/GameViewport/Viewport/Game" method="trigger_spawn"]
[connection signal="back_button_pressed" from="CustomUI/ShopSafeUI/ShopUI" to="." method="_on_shop_ui_back_button_pressed"]
[connection signal="delete_button_pressed" from="CustomUI/ShopSafeUI/ShopUI" to="." method="_on_shop_ui_delete_button_pressed"]
[connection signal="ghost_requested" from="CustomUI/ShopSafeUI/ShopUI" to="CustomUI/GameViewport/Viewport/Game" method="_on_shop_ui_ghost_requested"]
[connection signal="purchase_begin" from="CustomUI/ShopSafeUI/ShopUI" to="." method="_on_shop_ui_purchase_begin"]
[connection signal="purchase_begin" from="CustomUI/ShopSafeUI/ShopUI" to="CustomUI/GameViewport/Viewport/Game" method="_on_purchase_begin"]
[connection signal="purchase_cancel" from="CustomUI/ShopSafeUI/ShopUI" to="CustomUI/GameViewport/Viewport/Game" method="_on_purchase_cancel"]