started on crafting and clock panels
This commit is contained in:
parent
aa81f860b5
commit
f58fd81ec5
20 changed files with 506 additions and 68 deletions
45
inv_system/crafting_panel.gd
Normal file
45
inv_system/crafting_panel.gd
Normal file
|
|
@ -0,0 +1,45 @@
|
|||
extends Inventory
|
||||
|
||||
@export var action_button : Button
|
||||
#@export var no_style : StyleBox
|
||||
@export var assemble_style : StyleBox
|
||||
@export var assemble_style_hover : StyleBox
|
||||
@export var assemble_style_pressed : StyleBox
|
||||
@export var scavenge_style : StyleBox
|
||||
@export var scavenge_style_hover : StyleBox
|
||||
@export var scavenge_style_pressed : StyleBox
|
||||
|
||||
|
||||
# Called when the node enters the scene tree for the first time.
|
||||
func _ready() -> void:
|
||||
super()
|
||||
style_scavenge()
|
||||
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:
|
||||
# check against recipies!
|
||||
pass
|
||||
|
||||
func style_assemble():
|
||||
action_button.add_theme_stylebox_override("normal",assemble_style)
|
||||
action_button.add_theme_stylebox_override("hover",assemble_style_hover)
|
||||
action_button.add_theme_stylebox_override("pressed",assemble_style_pressed)
|
||||
|
||||
func style_scavenge():
|
||||
action_button.add_theme_stylebox_override("normal",scavenge_style)
|
||||
action_button.add_theme_stylebox_override("hover",scavenge_style_hover)
|
||||
action_button.add_theme_stylebox_override("pressed",scavenge_style_pressed)
|
||||
|
||||
func style_none():
|
||||
action_button.remove_theme_stylebox_override("normal")
|
||||
action_button.remove_theme_stylebox_override("hover")
|
||||
action_button.remove_theme_stylebox_override("pressed")
|
||||
1
inv_system/crafting_panel.gd.uid
Normal file
1
inv_system/crafting_panel.gd.uid
Normal file
|
|
@ -0,0 +1 @@
|
|||
uid://br4fgimf7nygr
|
||||
149
inv_system/crafting_panel.tscn
Normal file
149
inv_system/crafting_panel.tscn
Normal file
|
|
@ -0,0 +1,149 @@
|
|||
[gd_scene load_steps=7 format=3 uid="uid://f06ym5ujhdsc"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://br4fgimf7nygr" path="res://inv_system/crafting_panel.gd" id="1_441s3"]
|
||||
[ext_resource type="PackedScene" uid="uid://dgqs20xf7l8c" path="res://inv_system/item_slot.tscn" id="2_h0v0h"]
|
||||
|
||||
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_h0v0h"]
|
||||
content_margin_left = 0.0
|
||||
content_margin_top = 0.0
|
||||
content_margin_right = 0.0
|
||||
content_margin_bottom = 0.0
|
||||
bg_color = Color(0.0033790555, 0.44219574, 1.14551185e-05, 1)
|
||||
border_width_left = 5
|
||||
border_width_top = 5
|
||||
border_width_right = 5
|
||||
border_width_bottom = 5
|
||||
border_color = Color(0, 0.9671584, 0.10068952, 1)
|
||||
border_blend = true
|
||||
corner_radius_top_left = 3
|
||||
corner_radius_top_right = 3
|
||||
corner_radius_bottom_right = 3
|
||||
corner_radius_bottom_left = 3
|
||||
corner_detail = 5
|
||||
|
||||
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_441s3"]
|
||||
content_margin_left = 0.0
|
||||
content_margin_top = 0.0
|
||||
content_margin_right = 0.0
|
||||
content_margin_bottom = 0.0
|
||||
bg_color = Color(0.0033790555, 0.44219574, 1.14551185e-05, 1)
|
||||
border_width_left = 5
|
||||
border_width_top = 5
|
||||
border_width_right = 5
|
||||
border_width_bottom = 5
|
||||
border_color = Color(0.6496614, 1, 0.6276887, 1)
|
||||
border_blend = true
|
||||
corner_radius_top_left = 3
|
||||
corner_radius_top_right = 3
|
||||
corner_radius_bottom_right = 3
|
||||
corner_radius_bottom_left = 3
|
||||
corner_detail = 5
|
||||
|
||||
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_ytbts"]
|
||||
content_margin_left = 0.0
|
||||
content_margin_top = 0.0
|
||||
content_margin_right = 0.0
|
||||
content_margin_bottom = 0.0
|
||||
bg_color = Color(0.6228256, 0, 0.13260579, 1)
|
||||
border_width_left = 5
|
||||
border_width_top = 5
|
||||
border_width_right = 5
|
||||
border_width_bottom = 5
|
||||
border_color = Color(1, 0.34455475, 0.4602759, 1)
|
||||
border_blend = true
|
||||
corner_radius_top_left = 3
|
||||
corner_radius_top_right = 3
|
||||
corner_radius_bottom_right = 3
|
||||
corner_radius_bottom_left = 3
|
||||
corner_detail = 5
|
||||
|
||||
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_4h4i0"]
|
||||
content_margin_left = 0.0
|
||||
content_margin_top = 0.0
|
||||
content_margin_right = 0.0
|
||||
content_margin_bottom = 0.0
|
||||
bg_color = Color(0.6228256, 0, 0.13260579, 1)
|
||||
border_width_left = 5
|
||||
border_width_top = 5
|
||||
border_width_right = 5
|
||||
border_width_bottom = 5
|
||||
border_color = Color(1, 0.77051497, 0.78614175, 1)
|
||||
border_blend = true
|
||||
corner_radius_top_left = 3
|
||||
corner_radius_top_right = 3
|
||||
corner_radius_bottom_right = 3
|
||||
corner_radius_bottom_left = 3
|
||||
corner_detail = 5
|
||||
|
||||
[node name="CraftingPanel" type="PanelContainer" node_paths=PackedStringArray("action_button", "grid", "inv_label")]
|
||||
offset_left = 749.0
|
||||
offset_top = 89.0
|
||||
offset_right = 962.0
|
||||
offset_bottom = 382.0
|
||||
script = ExtResource("1_441s3")
|
||||
action_button = NodePath("MarginContainer/VBoxContainer/ActionButton")
|
||||
assemble_style = SubResource("StyleBoxFlat_h0v0h")
|
||||
assemble_style_hover = SubResource("StyleBoxFlat_441s3")
|
||||
assemble_style_pressed = SubResource("StyleBoxFlat_h0v0h")
|
||||
scavenge_style = SubResource("StyleBoxFlat_ytbts")
|
||||
scavenge_style_hover = SubResource("StyleBoxFlat_4h4i0")
|
||||
scavenge_style_pressed = SubResource("StyleBoxFlat_ytbts")
|
||||
inventory_name = "Workbench"
|
||||
grid = NodePath("MarginContainer/VBoxContainer/ScrollContainer/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"
|
||||
horizontal_alignment = 1
|
||||
|
||||
[node name="ScrollContainer" type="ScrollContainer" parent="MarginContainer/VBoxContainer"]
|
||||
layout_mode = 2
|
||||
size_flags_vertical = 3
|
||||
|
||||
[node name="GridContainer" type="GridContainer" parent="MarginContainer/VBoxContainer/ScrollContainer"]
|
||||
layout_mode = 2
|
||||
size_flags_vertical = 3
|
||||
columns = 3
|
||||
|
||||
[node name="ItemSlot" parent="MarginContainer/VBoxContainer/ScrollContainer/GridContainer" instance=ExtResource("2_h0v0h")]
|
||||
layout_mode = 2
|
||||
|
||||
[node name="ItemSlot2" parent="MarginContainer/VBoxContainer/ScrollContainer/GridContainer" instance=ExtResource("2_h0v0h")]
|
||||
layout_mode = 2
|
||||
|
||||
[node name="ItemSlot3" parent="MarginContainer/VBoxContainer/ScrollContainer/GridContainer" instance=ExtResource("2_h0v0h")]
|
||||
layout_mode = 2
|
||||
|
||||
[node name="ItemSlot4" parent="MarginContainer/VBoxContainer/ScrollContainer/GridContainer" instance=ExtResource("2_h0v0h")]
|
||||
layout_mode = 2
|
||||
|
||||
[node name="ItemSlot5" parent="MarginContainer/VBoxContainer/ScrollContainer/GridContainer" instance=ExtResource("2_h0v0h")]
|
||||
layout_mode = 2
|
||||
|
||||
[node name="ItemSlot6" parent="MarginContainer/VBoxContainer/ScrollContainer/GridContainer" instance=ExtResource("2_h0v0h")]
|
||||
layout_mode = 2
|
||||
|
||||
[node name="ItemSlot7" parent="MarginContainer/VBoxContainer/ScrollContainer/GridContainer" instance=ExtResource("2_h0v0h")]
|
||||
layout_mode = 2
|
||||
|
||||
[node name="ItemSlot8" parent="MarginContainer/VBoxContainer/ScrollContainer/GridContainer" instance=ExtResource("2_h0v0h")]
|
||||
layout_mode = 2
|
||||
|
||||
[node name="ItemSlot9" parent="MarginContainer/VBoxContainer/ScrollContainer/GridContainer" instance=ExtResource("2_h0v0h")]
|
||||
layout_mode = 2
|
||||
|
||||
[node name="ActionButton" type="Button" parent="MarginContainer/VBoxContainer"]
|
||||
custom_minimum_size = Vector2(0, 52.585)
|
||||
layout_mode = 2
|
||||
text = "No matching recipie"
|
||||
67
inv_system/inventory_panel.tscn
Normal file
67
inv_system/inventory_panel.tscn
Normal file
|
|
@ -0,0 +1,67 @@
|
|||
[gd_scene load_steps=3 format=3 uid="uid://bar46c75dbi2t"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://c6oycdae5wvjf" path="res://inv_system/inventory.gd" id="1_x51u7"]
|
||||
[ext_resource type="PackedScene" uid="uid://dgqs20xf7l8c" path="res://inv_system/item_slot.tscn" id="2_aasfe"]
|
||||
|
||||
[node name="InventoryPanel" type="PanelContainer" node_paths=PackedStringArray("grid", "inv_label")]
|
||||
offset_left = 51.0
|
||||
offset_top = 67.0
|
||||
offset_right = 403.0
|
||||
offset_bottom = 549.0
|
||||
script = ExtResource("1_x51u7")
|
||||
inventory_name = "Your Inventory"
|
||||
grid = NodePath("MarginContainer/VBoxContainer/ScrollContainer/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="ScrollContainer" type="ScrollContainer" parent="MarginContainer/VBoxContainer"]
|
||||
layout_mode = 2
|
||||
size_flags_vertical = 3
|
||||
|
||||
[node name="GridContainer" type="GridContainer" parent="MarginContainer/VBoxContainer/ScrollContainer"]
|
||||
layout_mode = 2
|
||||
size_flags_vertical = 3
|
||||
columns = 5
|
||||
|
||||
[node name="ItemSlot" parent="MarginContainer/VBoxContainer/ScrollContainer/GridContainer" instance=ExtResource("2_aasfe")]
|
||||
layout_mode = 2
|
||||
|
||||
[node name="ItemSlot2" parent="MarginContainer/VBoxContainer/ScrollContainer/GridContainer" instance=ExtResource("2_aasfe")]
|
||||
layout_mode = 2
|
||||
|
||||
[node name="ItemSlot3" parent="MarginContainer/VBoxContainer/ScrollContainer/GridContainer" instance=ExtResource("2_aasfe")]
|
||||
layout_mode = 2
|
||||
|
||||
[node name="ItemSlot4" parent="MarginContainer/VBoxContainer/ScrollContainer/GridContainer" instance=ExtResource("2_aasfe")]
|
||||
layout_mode = 2
|
||||
|
||||
[node name="ItemSlot5" parent="MarginContainer/VBoxContainer/ScrollContainer/GridContainer" instance=ExtResource("2_aasfe")]
|
||||
layout_mode = 2
|
||||
|
||||
[node name="ItemSlot6" parent="MarginContainer/VBoxContainer/ScrollContainer/GridContainer" instance=ExtResource("2_aasfe")]
|
||||
layout_mode = 2
|
||||
|
||||
[node name="ItemSlot7" parent="MarginContainer/VBoxContainer/ScrollContainer/GridContainer" instance=ExtResource("2_aasfe")]
|
||||
layout_mode = 2
|
||||
|
||||
[node name="ItemSlot8" parent="MarginContainer/VBoxContainer/ScrollContainer/GridContainer" instance=ExtResource("2_aasfe")]
|
||||
layout_mode = 2
|
||||
|
||||
[node name="ItemSlot9" parent="MarginContainer/VBoxContainer/ScrollContainer/GridContainer" instance=ExtResource("2_aasfe")]
|
||||
layout_mode = 2
|
||||
|
||||
[node name="ItemSlot10" parent="MarginContainer/VBoxContainer/ScrollContainer/GridContainer" instance=ExtResource("2_aasfe")]
|
||||
layout_mode = 2
|
||||
|
|
@ -15,7 +15,7 @@ func update_ui():
|
|||
return
|
||||
|
||||
icon.texture = item.icon
|
||||
tooltip_text = item.item_name
|
||||
#tooltip_text = item.item_name
|
||||
label.text = item.value
|
||||
|
||||
|
||||
|
|
@ -28,7 +28,8 @@ func _get_drag_data(at_position: Vector2) -> Variant:
|
|||
c.add_child(preview)
|
||||
preview.position -= Vector2(32,32)
|
||||
preview.self_modulate = Color.TRANSPARENT
|
||||
c.modulate = Color(c.modulate,0.5)
|
||||
c.z_index = 3
|
||||
c.modulate = Color(c.modulate,0.6)
|
||||
set_drag_preview(c)
|
||||
icon.hide()
|
||||
return self
|
||||
|
|
@ -47,7 +48,7 @@ func _drop_data(at_position: Vector2, data: Variant) -> void:
|
|||
|
||||
|
||||
func _on_mouse_entered() -> void:
|
||||
print("im real?")
|
||||
#print("im real?")
|
||||
if item:
|
||||
Tooltip.show_tip(item.item_name)
|
||||
pass # Replace with function body.
|
||||
|
|
|
|||
19
inv_system/player_inventory.gd
Normal file
19
inv_system/player_inventory.gd
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
extends Node
|
||||
|
||||
@export var inventory_panel : Inventory
|
||||
@export var button : Button
|
||||
|
||||
# Called when the node enters the scene tree for the first time.
|
||||
func _ready() -> void:
|
||||
button.text = "Show Inventory" if !inventory_panel.visible else "Hide Inventory"
|
||||
pass # Replace with function body.
|
||||
|
||||
|
||||
# Called every frame. 'delta' is the elapsed time since the previous frame.
|
||||
func _process(delta: float) -> void:
|
||||
pass
|
||||
|
||||
|
||||
func _on_button_pressed() -> void:
|
||||
inventory_panel.visible = !inventory_panel.visible
|
||||
button.text = "Show Inventory" if !inventory_panel.visible else "Hide Inventory"
|
||||
1
inv_system/player_inventory.gd.uid
Normal file
1
inv_system/player_inventory.gd.uid
Normal file
|
|
@ -0,0 +1 @@
|
|||
uid://jxkjnscuxcyi
|
||||
36
inv_system/player_inventory.tscn
Normal file
36
inv_system/player_inventory.tscn
Normal file
|
|
@ -0,0 +1,36 @@
|
|||
[gd_scene load_steps=3 format=3 uid="uid://bkhg56q71vsjv"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://jxkjnscuxcyi" path="res://inv_system/player_inventory.gd" id="1_vk2kx"]
|
||||
[ext_resource type="PackedScene" uid="uid://bar46c75dbi2t" path="res://inv_system/inventory_panel.tscn" id="2_hk4hx"]
|
||||
|
||||
[node name="PlayerInventory" type="Control" node_paths=PackedStringArray("inventory_panel", "button")]
|
||||
z_index = 2
|
||||
layout_mode = 3
|
||||
anchors_preset = 15
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
mouse_filter = 2
|
||||
script = ExtResource("1_vk2kx")
|
||||
inventory_panel = NodePath("InventoryPanel")
|
||||
button = NodePath("Button")
|
||||
|
||||
[node name="Button" type="Button" parent="."]
|
||||
layout_mode = 1
|
||||
anchors_preset = 2
|
||||
anchor_top = 1.0
|
||||
anchor_bottom = 1.0
|
||||
offset_top = -31.0
|
||||
offset_right = 129.0
|
||||
grow_vertical = 0
|
||||
text = "Show Inventory"
|
||||
|
||||
[node name="InventoryPanel" parent="." instance=ExtResource("2_hk4hx")]
|
||||
layout_mode = 0
|
||||
offset_left = 67.0
|
||||
offset_top = 79.0
|
||||
offset_right = 419.0
|
||||
offset_bottom = 561.0
|
||||
|
||||
[connection signal="pressed" from="Button" to="." method="_on_button_pressed"]
|
||||
Loading…
Add table
Add a link
Reference in a new issue