diff --git a/inv_system/item_data.gd b/inv_system/item_data.gd index 609facb..bb1ddf2 100644 --- a/inv_system/item_data.gd +++ b/inv_system/item_data.gd @@ -4,3 +4,4 @@ class_name ItemData @export var item_name : String @export var icon : Texture2D @export var value : String +@export var custom_panel_style : StyleBox diff --git a/inv_system/item_panels/default.tres b/inv_system/item_panels/default.tres new file mode 100644 index 0000000..020b032 --- /dev/null +++ b/inv_system/item_panels/default.tres @@ -0,0 +1,13 @@ +[gd_resource type="StyleBoxFlat" format=3 uid="uid://hgjmkwj0dbqr"] + +[resource] +content_margin_left = 0.0 +content_margin_top = 0.0 +content_margin_right = 0.0 +content_margin_bottom = 0.0 +bg_color = Color(0.1, 0.1, 0.1, 0.6) +corner_radius_top_left = 3 +corner_radius_top_right = 3 +corner_radius_bottom_right = 3 +corner_radius_bottom_left = 3 +corner_detail = 5 diff --git a/inv_system/item_panels/epic.tres b/inv_system/item_panels/epic.tres new file mode 100644 index 0000000..be6a055 --- /dev/null +++ b/inv_system/item_panels/epic.tres @@ -0,0 +1,19 @@ +[gd_resource type="StyleBoxFlat" format=3 uid="uid://c563rid4b4fho"] + +[resource] +content_margin_left = 0.0 +content_margin_top = 0.0 +content_margin_right = 0.0 +content_margin_bottom = 0.0 +bg_color = Color(0.1, 0.1, 0.1, 0.6) +border_width_left = 3 +border_width_top = 3 +border_width_right = 3 +border_width_bottom = 3 +border_color = Color(0.5058824, 0, 0.8, 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 diff --git a/inv_system/item_slot.gd b/inv_system/item_slot.gd index b6981de..cb8350a 100644 --- a/inv_system/item_slot.gd +++ b/inv_system/item_slot.gd @@ -13,8 +13,13 @@ func update_ui(): if not item: icon.texture = null label.text = "" + remove_theme_stylebox_override("panel") return + if item.custom_panel_style: + add_theme_stylebox_override("panel",item.custom_panel_style) + else: + remove_theme_stylebox_override("panel") icon.texture = item.icon #tooltip_text = item.item_name label.text = item.value diff --git a/inv_system/item_slot.tscn b/inv_system/item_slot.tscn index 20fd246..60d9417 100644 --- a/inv_system/item_slot.tscn +++ b/inv_system/item_slot.tscn @@ -1,6 +1,7 @@ -[gd_scene load_steps=4 format=3 uid="uid://dgqs20xf7l8c"] +[gd_scene load_steps=5 format=3 uid="uid://dgqs20xf7l8c"] [ext_resource type="Script" uid="uid://cpd04flfh5nlc" path="res://inv_system/item_slot.gd" id="1_m11ft"] +[ext_resource type="StyleBox" uid="uid://hgjmkwj0dbqr" path="res://inv_system/item_panels/default.tres" id="1_mkcpq"] [ext_resource type="Texture2D" uid="uid://b7jp850fqpa0j" path="res://icon.svg" id="3_0tnt0"] [sub_resource type="LabelSettings" id="LabelSettings_ab1u2"] @@ -9,6 +10,7 @@ outline_color = Color(0, 0, 0, 1) [node name="ItemSlot" type="Panel" node_paths=PackedStringArray("icon", "label")] custom_minimum_size = Vector2(64, 64) +theme_override_styles/panel = ExtResource("1_mkcpq") script = ExtResource("1_m11ft") icon = NodePath("Icon") label = NodePath("Icon/Label") diff --git a/items/computer.tres b/items/computer.tres index df072c7..7c7ef4a 100644 --- a/items/computer.tres +++ b/items/computer.tres @@ -1,10 +1,12 @@ -[gd_resource type="Resource" script_class="ItemData" load_steps=3 format=3 uid="uid://8vw85c1qrypm"] +[gd_resource type="Resource" script_class="ItemData" load_steps=4 format=3 uid="uid://8vw85c1qrypm"] [ext_resource type="Texture2D" uid="uid://b2vn26davyrou" path="res://assets/item images/computer.png" id="1_e0dbh"] +[ext_resource type="StyleBox" uid="uid://c563rid4b4fho" path="res://inv_system/item_panels/epic.tres" id="1_x7wm3"] [ext_resource type="Script" uid="uid://dccraom7a7e8d" path="res://inv_system/item_data.gd" id="2_x7wm3"] [resource] script = ExtResource("2_x7wm3") item_name = "Computer" icon = ExtResource("1_e0dbh") +custom_panel_style = ExtResource("1_x7wm3") metadata/_custom_type_script = "uid://dccraom7a7e8d"