meowbay created and other things
This commit is contained in:
parent
09625d8285
commit
93cc1a8c59
35 changed files with 318 additions and 41 deletions
|
|
@ -6,3 +6,5 @@ class_name ItemData
|
|||
@export var value : String
|
||||
@export var custom_panel_style : StyleBox
|
||||
@export var bin_chance : int = 5
|
||||
@export var buy_value : int = 10
|
||||
@export var can_buy : bool = false
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@ class_name ItemSlot
|
|||
var type : String
|
||||
var block_taking : bool = false
|
||||
const DEFAULT = preload("uid://hgjmkwj0dbqr")
|
||||
var extra_data : String = ""
|
||||
|
||||
|
||||
func _ready() -> void:
|
||||
|
|
@ -61,7 +62,7 @@ func _drop_data(at_position: Vector2, data: Variant) -> void:
|
|||
func _on_mouse_entered() -> void:
|
||||
#print("im real?")
|
||||
if item:
|
||||
Tooltip.show_tip(item.item_name)
|
||||
Tooltip.show_tip(item.item_name, extra_data)
|
||||
MouseTweaks.hovered_slot = self
|
||||
pass # Replace with function body.
|
||||
|
||||
|
|
|
|||
|
|
@ -2,6 +2,8 @@ extends Node
|
|||
|
||||
@export var inventory_panel : Inventory
|
||||
@export var button : Button
|
||||
@export var money : int = 0
|
||||
@export var money_label : Label
|
||||
|
||||
# Called when the node enters the scene tree for the first time.
|
||||
func _ready() -> void:
|
||||
|
|
@ -11,7 +13,7 @@ func _ready() -> void:
|
|||
|
||||
# Called every frame. 'delta' is the elapsed time since the previous frame.
|
||||
func _process(delta: float) -> void:
|
||||
pass
|
||||
money_label.text = "Money: $" + str(money)
|
||||
|
||||
|
||||
func _on_button_pressed() -> void:
|
||||
|
|
|
|||
|
|
@ -42,7 +42,7 @@ corner_radius_bottom_right = 3
|
|||
corner_radius_bottom_left = 3
|
||||
corner_detail = 5
|
||||
|
||||
[node name="PlayerInventory" type="Control" node_paths=PackedStringArray("inventory_panel", "button")]
|
||||
[node name="PlayerInventory" type="Control" node_paths=PackedStringArray("inventory_panel", "button", "money_label")]
|
||||
z_index = 2
|
||||
layout_mode = 3
|
||||
anchors_preset = 15
|
||||
|
|
@ -54,8 +54,10 @@ mouse_filter = 2
|
|||
script = ExtResource("1_vk2kx")
|
||||
inventory_panel = NodePath("TabContainer/Inventory")
|
||||
button = NodePath("Button")
|
||||
money_label = NodePath("PanelContainer/Label")
|
||||
|
||||
[node name="Button" type="Button" parent="."]
|
||||
visible = false
|
||||
layout_mode = 1
|
||||
anchors_preset = 2
|
||||
anchor_top = 1.0
|
||||
|
|
@ -249,4 +251,16 @@ autowrap_mode = 2
|
|||
layout_mode = 2
|
||||
columns = 5
|
||||
|
||||
[node name="PanelContainer" type="PanelContainer" parent="."]
|
||||
layout_mode = 0
|
||||
offset_left = 132.0
|
||||
offset_top = 566.0
|
||||
offset_right = 389.0
|
||||
offset_bottom = 608.0
|
||||
|
||||
[node name="Label" type="Label" parent="PanelContainer"]
|
||||
layout_mode = 2
|
||||
text = "Money: $0"
|
||||
horizontal_alignment = 1
|
||||
|
||||
[connection signal="pressed" from="Button" to="." method="_on_button_pressed"]
|
||||
|
|
|
|||
40
inv_system/sell_panel.gd
Normal file
40
inv_system/sell_panel.gd
Normal file
|
|
@ -0,0 +1,40 @@
|
|||
extends Inventory
|
||||
|
||||
@export var sell_label : Label
|
||||
@export var sell_button : Button
|
||||
|
||||
# Called when the node enters the scene tree for the first time.
|
||||
func _ready() -> void:
|
||||
super()
|
||||
calculate_sell_value()
|
||||
pass # Replace with function body.
|
||||
|
||||
|
||||
# Called every frame. 'delta' is the elapsed time since the previous frame.
|
||||
func _process(delta: float) -> void:
|
||||
super(delta)
|
||||
pass
|
||||
|
||||
func _notification(what: int) -> void:
|
||||
super(what)
|
||||
if what == Node.NOTIFICATION_DRAG_END:
|
||||
calculate_sell_value()
|
||||
pass
|
||||
|
||||
func calculate_sell_value():
|
||||
if slots[0].item:
|
||||
sell_label.text = str(floori(slots[0].item.buy_value / float(2)))
|
||||
sell_button.disabled = false
|
||||
else:
|
||||
sell_label.text = "Place an item"
|
||||
sell_button.disabled = true
|
||||
|
||||
|
||||
func _on_sell_button_pressed() -> void:
|
||||
if slots[0].item:
|
||||
var sell_value : int = floori(slots[0].item.buy_value / float(2))
|
||||
slots[0].item = null
|
||||
slots[0].update_ui()
|
||||
PlayerInventory.money += sell_value
|
||||
calculate_sell_value()
|
||||
|
||||
1
inv_system/sell_panel.gd.uid
Normal file
1
inv_system/sell_panel.gd.uid
Normal file
|
|
@ -0,0 +1 @@
|
|||
uid://5uka1h3vmcg4
|
||||
60
inv_system/sell_panel.tscn
Normal file
60
inv_system/sell_panel.tscn
Normal file
|
|
@ -0,0 +1,60 @@
|
|||
[gd_scene load_steps=3 format=3 uid="uid://cqqpf7fca5nk1"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://5uka1h3vmcg4" path="res://inv_system/sell_panel.gd" id="1_ut1o0"]
|
||||
[ext_resource type="PackedScene" uid="uid://dgqs20xf7l8c" path="res://inv_system/item_slot.tscn" id="2_p0fcq"]
|
||||
|
||||
[node name="SellPanel" type="PanelContainer" node_paths=PackedStringArray("sell_label", "sell_button", "slots", "grid", "inv_label")]
|
||||
offset_left = 51.0
|
||||
offset_top = 67.0
|
||||
offset_right = 403.0
|
||||
offset_bottom = 205.0
|
||||
script = ExtResource("1_ut1o0")
|
||||
sell_label = NodePath("MarginContainer/VBoxContainer/HBoxContainer/VBoxContainer/Label2")
|
||||
sell_button = NodePath("MarginContainer/VBoxContainer/SellButton")
|
||||
inventory_name = "Sell Items"
|
||||
slots = [NodePath("MarginContainer/VBoxContainer/HBoxContainer/GridContainer/ItemSlot")]
|
||||
type = "Sell"
|
||||
grid = NodePath("MarginContainer/VBoxContainer/HBoxContainer/GridContainer")
|
||||
inv_label = NodePath("MarginContainer/VBoxContainer/Label")
|
||||
|
||||
[node name="MarginContainer" type="MarginContainer" parent="."]
|
||||
layout_mode = 2
|
||||
theme_override_constants/margin_left = 5
|
||||
theme_override_constants/margin_top = 5
|
||||
theme_override_constants/margin_right = 5
|
||||
theme_override_constants/margin_bottom = 5
|
||||
|
||||
[node name="VBoxContainer" type="VBoxContainer" parent="MarginContainer"]
|
||||
layout_mode = 2
|
||||
|
||||
[node name="Label" type="Label" parent="MarginContainer/VBoxContainer"]
|
||||
layout_mode = 2
|
||||
text = "Inventory 1"
|
||||
|
||||
[node name="HBoxContainer" type="HBoxContainer" parent="MarginContainer/VBoxContainer"]
|
||||
layout_mode = 2
|
||||
|
||||
[node name="GridContainer" type="GridContainer" parent="MarginContainer/VBoxContainer/HBoxContainer"]
|
||||
layout_mode = 2
|
||||
|
||||
[node name="ItemSlot" parent="MarginContainer/VBoxContainer/HBoxContainer/GridContainer" instance=ExtResource("2_p0fcq")]
|
||||
layout_mode = 2
|
||||
|
||||
[node name="VBoxContainer" type="VBoxContainer" parent="MarginContainer/VBoxContainer/HBoxContainer"]
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 3
|
||||
alignment = 1
|
||||
|
||||
[node name="Label" type="Label" parent="MarginContainer/VBoxContainer/HBoxContainer/VBoxContainer"]
|
||||
layout_mode = 2
|
||||
text = "Sell value:"
|
||||
|
||||
[node name="Label2" type="Label" parent="MarginContainer/VBoxContainer/HBoxContainer/VBoxContainer"]
|
||||
layout_mode = 2
|
||||
text = "1234"
|
||||
|
||||
[node name="SellButton" type="Button" parent="MarginContainer/VBoxContainer"]
|
||||
layout_mode = 2
|
||||
text = "Sell!"
|
||||
|
||||
[connection signal="pressed" from="MarginContainer/VBoxContainer/SellButton" to="." method="_on_sell_button_pressed"]
|
||||
Loading…
Add table
Add a link
Reference in a new issue