First commit 🎉
This commit is contained in:
commit
43ea213f9b
728 changed files with 37080 additions and 0 deletions
BIN
game/gui/components/sierra_inventory_popup/images/btn_down.png
Normal file
BIN
game/gui/components/sierra_inventory_popup/images/btn_down.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 321 B |
|
@ -0,0 +1,34 @@
|
|||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://cjtp51p18m84i"
|
||||
path="res://.godot/imported/btn_down.png-03a52372fa781da0da27c734bcc6f1b2.ctex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://game/gui/components/sierra_inventory_popup/images/btn_down.png"
|
||||
dest_files=["res://.godot/imported/btn_down.png-03a52372fa781da0da27c734bcc6f1b2.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
game/gui/components/sierra_inventory_popup/images/btn_up.png
Normal file
BIN
game/gui/components/sierra_inventory_popup/images/btn_up.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 306 B |
|
@ -0,0 +1,34 @@
|
|||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://ck8x21qp38ksc"
|
||||
path="res://.godot/imported/btn_up.png-801771ae2c68c44cc8e6f3d6e4506ff2.ctex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://game/gui/components/sierra_inventory_popup/images/btn_up.png"
|
||||
dest_files=["res://.godot/imported/btn_up.png-801771ae2c68c44cc8e6f3d6e4506ff2.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
|
|
@ -0,0 +1,4 @@
|
|||
[gd_resource type="ButtonGroup" format=3 uid="uid://4h08p4mg3i5b"]
|
||||
|
||||
[resource]
|
||||
resource_name = "SierraInventoryButtonGroup"
|
|
@ -0,0 +1,98 @@
|
|||
[gd_scene load_steps=14 format=3 uid="uid://cq8eutixwvs34"]
|
||||
|
||||
[ext_resource type="Theme" uid="uid://djl1xk7jgyvpp" path="res://game/gui/resources/gui_theme.tres" id="1_qam5n"]
|
||||
[ext_resource type="Script" uid="uid://bjpy5q7v6dmrb" path="res://game/gui/components/inventory_grid/inventory_grid_custom.gd" id="2_pxiu3"]
|
||||
[ext_resource type="PackedScene" uid="uid://mtr05qoafpam" path="res://game/gui/components/sierra_inventory_popup/sierra_inventory_slot/sierra_inventory_slot.tscn" id="3_xla2w"]
|
||||
[ext_resource type="Texture2D" uid="uid://ck8x21qp38ksc" path="res://game/gui/components/sierra_inventory_popup/images/btn_up.png" id="4_odg6m"]
|
||||
[ext_resource type="Texture2D" uid="uid://cqbvve00a0t28" path="res://game/gui/components/sierra_inventory_popup/images/btn_down.png" id="5_il4i0"]
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_f4cmp"]
|
||||
atlas = ExtResource("4_odg6m")
|
||||
region = Rect2(0, 0, 16, 16)
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_0587n"]
|
||||
atlas = ExtResource("4_odg6m")
|
||||
region = Rect2(32, 0, 16, 16)
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_331sn"]
|
||||
atlas = ExtResource("4_odg6m")
|
||||
region = Rect2(16, 0, 16, 16)
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_d48vi"]
|
||||
atlas = ExtResource("4_odg6m")
|
||||
region = Rect2(48, 0, 16, 16)
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_phqhs"]
|
||||
atlas = ExtResource("5_il4i0")
|
||||
region = Rect2(0, 0, 16, 16)
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_i0t7f"]
|
||||
atlas = ExtResource("5_il4i0")
|
||||
region = Rect2(32, 0, 16, 16)
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_pyaw7"]
|
||||
atlas = ExtResource("5_il4i0")
|
||||
region = Rect2(16, 0, 16, 16)
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_wnjlk"]
|
||||
atlas = ExtResource("5_il4i0")
|
||||
region = Rect2(48, 0, 16, 16)
|
||||
|
||||
[node name="SierraInventoryGrid" type="HBoxContainer"]
|
||||
offset_right = 158.0
|
||||
offset_bottom = 64.0
|
||||
size_flags_horizontal = 3
|
||||
size_flags_vertical = 3
|
||||
mouse_filter = 0
|
||||
theme = ExtResource("1_qam5n")
|
||||
script = ExtResource("2_pxiu3")
|
||||
slot_scene = ExtResource("3_xla2w")
|
||||
columns = 5
|
||||
visible_rows = 3
|
||||
number_of_slots = 20
|
||||
h_separation = 2
|
||||
v_separation = 2
|
||||
|
||||
[node name="ScrollContainer" type="ScrollContainer" parent="."]
|
||||
custom_minimum_size = Vector2(128, 76)
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 3
|
||||
scroll_vertical_custom_step = 27.0
|
||||
horizontal_scroll_mode = 3
|
||||
vertical_scroll_mode = 3
|
||||
|
||||
[node name="Box" type="GridContainer" parent="ScrollContainer"]
|
||||
unique_name_in_owner = true
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 3
|
||||
size_flags_vertical = 3
|
||||
theme_override_constants/h_separation = 2
|
||||
theme_override_constants/v_separation = 2
|
||||
columns = 5
|
||||
|
||||
[node name="ScrollButtons" type="VBoxContainer" parent="."]
|
||||
custom_minimum_size = Vector2(16, 0)
|
||||
layout_mode = 2
|
||||
theme_override_constants/separation = 0
|
||||
|
||||
[node name="Up" type="TextureButton" parent="ScrollButtons"]
|
||||
unique_name_in_owner = true
|
||||
texture_filter = 1
|
||||
layout_mode = 2
|
||||
size_flags_vertical = 3
|
||||
texture_normal = SubResource("AtlasTexture_f4cmp")
|
||||
texture_pressed = SubResource("AtlasTexture_0587n")
|
||||
texture_hover = SubResource("AtlasTexture_331sn")
|
||||
texture_disabled = SubResource("AtlasTexture_d48vi")
|
||||
stretch_mode = 3
|
||||
|
||||
[node name="Down" type="TextureButton" parent="ScrollButtons"]
|
||||
unique_name_in_owner = true
|
||||
texture_filter = 1
|
||||
layout_mode = 2
|
||||
size_flags_vertical = 3
|
||||
texture_normal = SubResource("AtlasTexture_phqhs")
|
||||
texture_pressed = SubResource("AtlasTexture_i0t7f")
|
||||
texture_hover = SubResource("AtlasTexture_pyaw7")
|
||||
texture_disabled = SubResource("AtlasTexture_wnjlk")
|
||||
stretch_mode = 3
|
|
@ -0,0 +1,67 @@
|
|||
@tool
|
||||
extends PopochiuPopup
|
||||
|
||||
var _command_when_opened: int = -1
|
||||
|
||||
@onready var interact: TextureButton = %Interact
|
||||
@onready var look: TextureButton = %Look
|
||||
@onready var talk: TextureButton = %Talk
|
||||
|
||||
|
||||
#region Godot ######################################################################################
|
||||
func _ready() -> void:
|
||||
super()
|
||||
|
||||
interact.pressed.connect(_on_interact_pressed)
|
||||
look.pressed.connect(_on_look_pressed)
|
||||
talk.pressed.connect(_on_talk_pressed)
|
||||
|
||||
|
||||
#endregion
|
||||
|
||||
#region Virtual ####################################################################################
|
||||
func _open() -> void:
|
||||
_command_when_opened = PopochiuUtils.e.current_command
|
||||
PopochiuUtils.e.current_command = -1
|
||||
|
||||
for button: TextureButton in %CommandsContainer.get_children():
|
||||
button.set_pressed_no_signal(false)
|
||||
|
||||
|
||||
func _close() -> void:
|
||||
if PopochiuUtils.i.active:
|
||||
PopochiuUtils.cursor.set_secondary_cursor_texture(PopochiuUtils.i.active.texture)
|
||||
PopochiuUtils.cursor.hide_main_cursor()
|
||||
else:
|
||||
if PopochiuUtils.e.current_command == -1:
|
||||
PopochiuUtils.e.current_command = _command_when_opened
|
||||
|
||||
PopochiuUtils.cursor.show_cursor(PopochiuUtils.e.get_current_command_name().to_snake_case())
|
||||
|
||||
|
||||
#endregion
|
||||
|
||||
#region Private ####################################################################################
|
||||
func _on_interact_pressed() -> void:
|
||||
_select_command(SierraCommands.Commands.INTERACT)
|
||||
|
||||
|
||||
func _on_look_pressed() -> void:
|
||||
_select_command(SierraCommands.Commands.LOOK)
|
||||
|
||||
|
||||
func _on_talk_pressed() -> void:
|
||||
_select_command(SierraCommands.Commands.TALK)
|
||||
|
||||
|
||||
func _select_command(command: int) -> void:
|
||||
if is_instance_valid(PopochiuUtils.i.active):
|
||||
PopochiuUtils.i.active = null
|
||||
|
||||
PopochiuUtils.e.current_command = command
|
||||
|
||||
# Force changing the cursor passing `true` as second parameter
|
||||
PopochiuUtils.cursor.show_cursor(PopochiuUtils.e.get_current_command_name().to_snake_case(), true)
|
||||
|
||||
|
||||
#endregion
|
|
@ -0,0 +1 @@
|
|||
uid://1huwoqm2cibs
|
|
@ -0,0 +1,195 @@
|
|||
[gd_scene load_steps=31 format=3 uid="uid://diasbghkbgi1s"]
|
||||
|
||||
[ext_resource type="Theme" uid="uid://djl1xk7jgyvpp" path="res://game/gui/resources/gui_theme.tres" id="1_i47br"]
|
||||
[ext_resource type="Script" uid="uid://bjvh1mgd6xryk" path="res://game/gui/components/sierra_inventory_popup/sierra_inventory_popup_custom.gd" id="2_4uqll"]
|
||||
[ext_resource type="Texture2D" uid="uid://d127ve13o2kpl" path="res://game/gui/resources/images/close.png" id="3_fhnyn"]
|
||||
[ext_resource type="Texture2D" uid="uid://b3q226w2e3giu" path="res://game/gui/resources/images/close_highlight.png" id="4_qlfhn"]
|
||||
[ext_resource type="PackedScene" uid="uid://cq8eutixwvs34" path="res://game/gui/components/sierra_inventory_popup/sierra_inventory_grid.tscn" id="5_tqc5f"]
|
||||
[ext_resource type="ButtonGroup" uid="uid://4h08p4mg3i5b" path="res://game/gui/components/sierra_inventory_popup/sierra_inventory_button_group.tres" id="6_rdxx6"]
|
||||
[ext_resource type="Texture2D" uid="uid://mv2x206ftad" path="res://game/gui/images/btn_interact.png" id="7_fo8wi"]
|
||||
[ext_resource type="Texture2D" uid="uid://c6j2obrx3bjug" path="res://game/gui/images/btn_look.png" id="8_3d2vb"]
|
||||
[ext_resource type="Texture2D" uid="uid://w8fcambs2g6l" path="res://game/gui/images/btn_talk.png" id="9_ywkab"]
|
||||
|
||||
[sub_resource type="StyleBoxEmpty" id="StyleBoxEmpty_0yihc"]
|
||||
|
||||
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_d512i"]
|
||||
content_margin_left = 0.0
|
||||
content_margin_top = 0.0
|
||||
content_margin_right = 0.0
|
||||
content_margin_bottom = 0.0
|
||||
bg_color = Color(0, 0, 0, 0.705882)
|
||||
expand_margin_left = 4.0
|
||||
expand_margin_top = 4.0
|
||||
expand_margin_right = 4.0
|
||||
expand_margin_bottom = 4.0
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_t6f3x"]
|
||||
atlas = ExtResource("7_fo8wi")
|
||||
region = Rect2(0, 0, 24, 24)
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_2tl6r"]
|
||||
atlas = ExtResource("7_fo8wi")
|
||||
region = Rect2(0, 24, 24, 24)
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_u6es1"]
|
||||
atlas = ExtResource("7_fo8wi")
|
||||
region = Rect2(0, 24, 24, 24)
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_3r3in"]
|
||||
atlas = ExtResource("8_3d2vb")
|
||||
region = Rect2(0, 0, 24, 24)
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_2idn6"]
|
||||
atlas = ExtResource("8_3d2vb")
|
||||
region = Rect2(0, 24, 24, 24)
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_mndsc"]
|
||||
atlas = ExtResource("8_3d2vb")
|
||||
region = Rect2(0, 24, 24, 24)
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_hb12v"]
|
||||
atlas = ExtResource("9_ywkab")
|
||||
region = Rect2(0, 0, 24, 24)
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_b4bqk"]
|
||||
atlas = ExtResource("9_ywkab")
|
||||
region = Rect2(0, 24, 24, 24)
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_w2dlm"]
|
||||
atlas = ExtResource("9_ywkab")
|
||||
region = Rect2(0, 24, 24, 24)
|
||||
|
||||
[sub_resource type="StyleBoxEmpty" id="StyleBoxEmpty_rqb31"]
|
||||
|
||||
[sub_resource type="StyleBoxEmpty" id="StyleBoxEmpty_3xhdb"]
|
||||
|
||||
[sub_resource type="StyleBoxEmpty" id="StyleBoxEmpty_vkbfs"]
|
||||
|
||||
[sub_resource type="StyleBoxEmpty" id="StyleBoxEmpty_lha4x"]
|
||||
|
||||
[sub_resource type="StyleBoxEmpty" id="StyleBoxEmpty_ba8hg"]
|
||||
|
||||
[sub_resource type="StyleBoxEmpty" id="StyleBoxEmpty_ksnpe"]
|
||||
|
||||
[sub_resource type="StyleBoxEmpty" id="StyleBoxEmpty_7a16g"]
|
||||
|
||||
[sub_resource type="StyleBoxEmpty" id="StyleBoxEmpty_g5f4c"]
|
||||
|
||||
[sub_resource type="StyleBoxEmpty" id="StyleBoxEmpty_7d0vl"]
|
||||
|
||||
[sub_resource type="StyleBoxEmpty" id="StyleBoxEmpty_dpu0r"]
|
||||
|
||||
[node name="SierraInventoryPopup" type="Control" groups=["popochiu_gui_popup"]]
|
||||
layout_mode = 3
|
||||
anchors_preset = 15
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
theme = ExtResource("1_i47br")
|
||||
script = ExtResource("2_4uqll")
|
||||
script_name = &"SierraInventoryPopup"
|
||||
title = "Inventory"
|
||||
|
||||
[node name="Overlay" type="PanelContainer" parent="."]
|
||||
layout_mode = 1
|
||||
anchors_preset = 15
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
theme_override_styles/panel = SubResource("StyleBoxEmpty_0yihc")
|
||||
|
||||
[node name="PanelContainer" type="PanelContainer" parent="Overlay"]
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 4
|
||||
size_flags_vertical = 4
|
||||
theme_override_styles/panel = SubResource("StyleBoxFlat_d512i")
|
||||
|
||||
[node name="VBoxContainer" type="VBoxContainer" parent="Overlay/PanelContainer"]
|
||||
layout_mode = 2
|
||||
|
||||
[node name="HeaderContainer" type="HBoxContainer" parent="Overlay/PanelContainer/VBoxContainer"]
|
||||
layout_mode = 2
|
||||
|
||||
[node name="Title" type="Label" parent="Overlay/PanelContainer/VBoxContainer/HeaderContainer"]
|
||||
unique_name_in_owner = true
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 3
|
||||
text = "Inventory"
|
||||
horizontal_alignment = 1
|
||||
vertical_alignment = 1
|
||||
|
||||
[node name="Close" type="TextureButton" parent="Overlay/PanelContainer/VBoxContainer/HeaderContainer"]
|
||||
unique_name_in_owner = true
|
||||
texture_filter = 1
|
||||
layout_mode = 2
|
||||
size_flags_vertical = 4
|
||||
texture_normal = ExtResource("3_fhnyn")
|
||||
texture_pressed = ExtResource("4_qlfhn")
|
||||
texture_hover = ExtResource("4_qlfhn")
|
||||
|
||||
[node name="SierraInventoryGrid" parent="Overlay/PanelContainer/VBoxContainer" instance=ExtResource("5_tqc5f")]
|
||||
layout_mode = 2
|
||||
|
||||
[node name="FooterContainer" type="HBoxContainer" parent="Overlay/PanelContainer/VBoxContainer"]
|
||||
layout_mode = 2
|
||||
size_flags_vertical = 10
|
||||
|
||||
[node name="CommandsContainer" type="HBoxContainer" parent="Overlay/PanelContainer/VBoxContainer/FooterContainer"]
|
||||
unique_name_in_owner = true
|
||||
layout_mode = 2
|
||||
|
||||
[node name="Interact" type="TextureButton" parent="Overlay/PanelContainer/VBoxContainer/FooterContainer/CommandsContainer"]
|
||||
unique_name_in_owner = true
|
||||
texture_filter = 1
|
||||
layout_mode = 2
|
||||
toggle_mode = true
|
||||
button_group = ExtResource("6_rdxx6")
|
||||
texture_normal = SubResource("AtlasTexture_t6f3x")
|
||||
texture_pressed = SubResource("AtlasTexture_2tl6r")
|
||||
texture_hover = SubResource("AtlasTexture_u6es1")
|
||||
|
||||
[node name="Look" type="TextureButton" parent="Overlay/PanelContainer/VBoxContainer/FooterContainer/CommandsContainer"]
|
||||
unique_name_in_owner = true
|
||||
texture_filter = 1
|
||||
layout_mode = 2
|
||||
toggle_mode = true
|
||||
button_group = ExtResource("6_rdxx6")
|
||||
texture_normal = SubResource("AtlasTexture_3r3in")
|
||||
texture_pressed = SubResource("AtlasTexture_2idn6")
|
||||
texture_hover = SubResource("AtlasTexture_mndsc")
|
||||
|
||||
[node name="Talk" type="TextureButton" parent="Overlay/PanelContainer/VBoxContainer/FooterContainer/CommandsContainer"]
|
||||
unique_name_in_owner = true
|
||||
texture_filter = 1
|
||||
layout_mode = 2
|
||||
toggle_mode = true
|
||||
button_group = ExtResource("6_rdxx6")
|
||||
texture_normal = SubResource("AtlasTexture_hb12v")
|
||||
texture_pressed = SubResource("AtlasTexture_b4bqk")
|
||||
texture_hover = SubResource("AtlasTexture_w2dlm")
|
||||
|
||||
[node name="Ok" type="Button" parent="Overlay/PanelContainer/VBoxContainer/FooterContainer"]
|
||||
unique_name_in_owner = true
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 3
|
||||
size_flags_vertical = 4
|
||||
theme_override_styles/focus = SubResource("StyleBoxEmpty_rqb31")
|
||||
theme_override_styles/disabled = SubResource("StyleBoxEmpty_3xhdb")
|
||||
theme_override_styles/hover = SubResource("StyleBoxEmpty_vkbfs")
|
||||
theme_override_styles/pressed = SubResource("StyleBoxEmpty_lha4x")
|
||||
theme_override_styles/normal = SubResource("StyleBoxEmpty_ba8hg")
|
||||
text = "OK"
|
||||
|
||||
[node name="Cancel" type="Button" parent="Overlay/PanelContainer/VBoxContainer/FooterContainer"]
|
||||
unique_name_in_owner = true
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 3
|
||||
size_flags_vertical = 4
|
||||
theme_override_styles/focus = SubResource("StyleBoxEmpty_ksnpe")
|
||||
theme_override_styles/disabled = SubResource("StyleBoxEmpty_7a16g")
|
||||
theme_override_styles/hover = SubResource("StyleBoxEmpty_g5f4c")
|
||||
theme_override_styles/pressed = SubResource("StyleBoxEmpty_7d0vl")
|
||||
theme_override_styles/normal = SubResource("StyleBoxEmpty_dpu0r")
|
||||
text = "Back"
|
|
@ -0,0 +1,2 @@
|
|||
@tool
|
||||
extends "sierra_inventory_popup.gd"
|
|
@ -0,0 +1 @@
|
|||
uid://bjvh1mgd6xryk
|
|
@ -0,0 +1,76 @@
|
|||
extends PanelContainer
|
||||
|
||||
@export var hover_color := Color("ffffff")
|
||||
@export var selected_color := Color("edf171")
|
||||
|
||||
var _is_selected := false
|
||||
|
||||
@onready var _style_box_flat: StyleBoxFlat = get_theme_stylebox("panel").duplicate()
|
||||
@onready var _dflt_border_color := _style_box_flat.border_color
|
||||
|
||||
|
||||
#region Godot ######################################################################################
|
||||
func _ready() -> void:
|
||||
add_theme_stylebox_override("panel", _style_box_flat)
|
||||
|
||||
# Connect to own signals
|
||||
mouse_entered.connect(_on_mouse_entered)
|
||||
mouse_exited.connect(_on_mouse_exited)
|
||||
child_entered_tree.connect(_on_item_assigned)
|
||||
child_exiting_tree.connect(_on_item_removed)
|
||||
|
||||
|
||||
#endregion
|
||||
|
||||
#region Public #####################################################################################
|
||||
func get_content_height() -> float:
|
||||
# Subtract the value of the sum of the top and bottom borders of the StyleBoxFlat of this slot
|
||||
return size.y - 2
|
||||
|
||||
|
||||
#endregion
|
||||
|
||||
#region Private ####################################################################################
|
||||
func _on_mouse_entered() -> void:
|
||||
_style_box_flat.border_color = hover_color
|
||||
|
||||
|
||||
func _on_mouse_exited() -> void:
|
||||
_style_box_flat.border_color = _dflt_border_color if not _is_selected else selected_color
|
||||
|
||||
|
||||
func _on_item_assigned(node: Node) -> void:
|
||||
if not node is PopochiuInventoryItem:
|
||||
return
|
||||
|
||||
var inventory_item: PopochiuInventoryItem = node
|
||||
|
||||
inventory_item.mouse_entered.connect(_on_mouse_entered)
|
||||
inventory_item.mouse_exited.connect(_on_mouse_exited)
|
||||
inventory_item.selected.connect(_on_item_selected)
|
||||
inventory_item.unselected.connect(_on_item_unselected)
|
||||
|
||||
|
||||
func _on_item_removed(node: Node) -> void:
|
||||
if not node is PopochiuInventoryItem:
|
||||
return
|
||||
|
||||
var inventory_item: PopochiuInventoryItem = node
|
||||
|
||||
inventory_item.mouse_entered.disconnect(_on_mouse_entered)
|
||||
inventory_item.mouse_exited.disconnect(_on_mouse_exited)
|
||||
inventory_item.selected.disconnect(_on_item_selected)
|
||||
inventory_item.unselected.disconnect(_on_item_unselected)
|
||||
|
||||
|
||||
func _on_item_selected(item: PopochiuInventoryItem) -> void:
|
||||
_style_box_flat.border_color = selected_color
|
||||
_is_selected = true
|
||||
|
||||
|
||||
func _on_item_unselected() -> void:
|
||||
_is_selected = false
|
||||
_style_box_flat.border_color = _dflt_border_color
|
||||
|
||||
|
||||
#endregion
|
|
@ -0,0 +1 @@
|
|||
uid://dd4qwndlaum3n
|
|
@ -0,0 +1,18 @@
|
|||
[gd_scene load_steps=4 format=3 uid="uid://mtr05qoafpam"]
|
||||
|
||||
[ext_resource type="Theme" uid="uid://djl1xk7jgyvpp" path="res://game/gui/resources/gui_theme.tres" id="1_ofw5b"]
|
||||
[ext_resource type="Script" uid="uid://cmb1fegt5g11c" path="res://game/gui/components/sierra_inventory_popup/sierra_inventory_slot/sierra_inventory_slot_custom.gd" id="2_j0p7w"]
|
||||
|
||||
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_7pmgd"]
|
||||
draw_center = false
|
||||
border_width_left = 1
|
||||
border_width_top = 1
|
||||
border_width_right = 1
|
||||
border_width_bottom = 1
|
||||
border_color = Color(0.482353, 0.482353, 0.482353, 1)
|
||||
|
||||
[node name="SierraInventorySlot" type="PanelContainer"]
|
||||
custom_minimum_size = Vector2(24, 24)
|
||||
theme = ExtResource("1_ofw5b")
|
||||
theme_override_styles/panel = SubResource("StyleBoxFlat_7pmgd")
|
||||
script = ExtResource("2_j0p7w")
|
|
@ -0,0 +1 @@
|
|||
extends "sierra_inventory_slot.gd"
|
|
@ -0,0 +1 @@
|
|||
uid://cmb1fegt5g11c
|
Loading…
Add table
Add a link
Reference in a new issue