First commit 🎉

This commit is contained in:
Tony Bark 2025-07-17 01:49:18 -04:00
commit 43ea213f9b
728 changed files with 37080 additions and 0 deletions

View file

@ -0,0 +1,144 @@
class_name GUIDialogMenu
extends Control
@warning_ignore("return_value_discarded")
@warning_ignore("unused_signal")
signal shown
@export var option_scene: PackedScene
## Max height of the menu in pixels. If visible options make the menu to exceed this value, it will
## enable a vertical scroll bar.
@export var max_height := 49
@export_category("Option buttons")
@export var normal_font_color: Color = Color("706deb")
@export var normal_used_font_color: Color = Color("2e2c9b")
@export var hover_font_color: Color = Color("ffffff")
@export var hover_used_font_color: Color = Color("b2b2b2")
@export var pressed_font_color: Color = Color("a9ff9f")
@export var pressed_used_font_color: Color = Color("56ac4d")
var current_options := []
@onready var panel_container: PanelContainer = $PanelContainer
@onready var dialog_options_container: VBoxContainer = %DialogOptionsContainer
#region Godot ######################################################################################
func _ready() -> void:
for child in dialog_options_container.get_children():
child.queue_free()
panel_container.custom_minimum_size = Vector2.ZERO
# Connect to own signals
gui_input.connect(_clicked)
# Connect to autoloads signals
PopochiuUtils.d.dialog_options_requested.connect(_create_options.bind(true))
PopochiuUtils.d.inline_dialog_requested.connect(_create_inline_options)
PopochiuUtils.d.dialog_finished.connect(remove_options)
hide()
#endregion
#region Private ####################################################################################
func _clicked(event: InputEvent) -> void:
if PopochiuUtils.get_click_or_touch_index(event) == MOUSE_BUTTON_LEFT:
accept_event()
# Creates an Array of PopochiuDialogOption to show dialog tree options created
# during execution, (those that are created after calling D.show_inline_dialog)
func _create_inline_options(opts: Array) -> void:
var tmp_opts := []
for idx in opts.size():
var new_opt: PopochiuDialogOption = PopochiuDialogOption.new()
new_opt.id = str(idx)
new_opt.text = opts[idx]
tmp_opts.append(new_opt)
_create_options(tmp_opts, true)
func _create_options(options := [], autoshow := false) -> void:
remove_options()
if options.is_empty():
if not current_options.is_empty():
show_options()
return
current_options = options.duplicate(true)
for dialog_option: PopochiuDialogOption in options:
var dialog_menu_option := option_scene.instantiate()
dialog_menu_option.normal_color = normal_font_color
dialog_menu_option.normal_used_color = normal_used_font_color
dialog_menu_option.hover_color = hover_font_color
dialog_menu_option.hover_used_color = hover_used_font_color
dialog_menu_option.pressed_color = pressed_font_color
dialog_menu_option.pressed_used_color = pressed_used_font_color
dialog_options_container.add_child(dialog_menu_option)
dialog_menu_option.option = dialog_option
dialog_menu_option.pressed.connect(_on_option_clicked)
if dialog_option.disabled or not dialog_option.visible:
dialog_menu_option.hide()
else:
dialog_menu_option.show()
if autoshow: show_options()
await get_tree().create_timer(0.1).timeout
# Fix: Height and position of the dialog menu was wrong when changing the amount of options to
# show.
var options_height := 0
var visible_options := 0
for opt in dialog_options_container.get_children():
if not opt.visible: continue
options_height += opt.size.y
visible_options += 1
options_height += (
dialog_options_container.get_theme_constant("separation") * (visible_options - 1)
)
panel_container.size.y = min(options_height, max_height)
panel_container.position.y = PopochiuUtils.e.height - panel_container.size.y
func remove_options(_dialog: PopochiuDialog = null) -> void:
if not current_options.is_empty():
current_options.clear()
for btn in dialog_options_container.get_children():
btn.queue_free()
await get_tree().process_frame
size.y = 0
dialog_options_container.size.y = 0
func show_options() -> void:
PopochiuUtils.g.block()
PopochiuUtils.g.dialog_options_shown.emit()
show()
shown.emit()
func _on_option_clicked(opt: PopochiuDialogOption) -> void:
PopochiuUtils.g.unblock()
hide()
PopochiuUtils.d.option_selected.emit(opt)
#endregion

View file

@ -0,0 +1 @@
uid://drauy2w6dsd4l

View file

@ -0,0 +1,39 @@
[gd_scene load_steps=4 format=3 uid="uid://baht1l8l5dupo"]
[ext_resource type="Theme" uid="uid://djl1xk7jgyvpp" path="res://game/gui/resources/gui_theme.tres" id="1_vmaqy"]
[ext_resource type="Script" uid="uid://mevovjy0qsbv" path="res://game/gui/components/dialog_menu/dialog_menu_custom.gd" id="2_d8486"]
[ext_resource type="PackedScene" uid="uid://b8r2dcfb6u1e1" path="res://game/gui/components/dialog_menu/dialog_menu_option/dialog_menu_option.tscn" id="3_30v6t"]
[node name="DialogMenu" type="Control" groups=["popochiu_gui_component"]]
layout_mode = 3
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
mouse_filter = 2
theme = ExtResource("1_vmaqy")
script = ExtResource("2_d8486")
option_scene = ExtResource("3_30v6t")
[node name="PanelContainer" type="PanelContainer" parent="."]
custom_minimum_size = Vector2(0, 53)
layout_mode = 1
anchors_preset = 12
anchor_top = 1.0
anchor_right = 1.0
anchor_bottom = 1.0
offset_top = -53.0
grow_horizontal = 2
grow_vertical = 0
[node name="ScrollContainer" type="ScrollContainer" parent="PanelContainer"]
layout_mode = 2
horizontal_scroll_mode = 0
[node name="DialogOptionsContainer" type="VBoxContainer" parent="PanelContainer/ScrollContainer"]
unique_name_in_owner = true
layout_mode = 2
size_flags_horizontal = 3
size_flags_vertical = 8
theme_override_constants/separation = 1

View file

@ -0,0 +1 @@
extends "dialog_menu.gd"

View file

@ -0,0 +1 @@
uid://mevovjy0qsbv

View file

@ -0,0 +1,92 @@
class_name GUIDialogMenuOption
extends PanelContainer
signal pressed(node: PopochiuDialogOption)
var option: PopochiuDialogOption : set = set_dialog_option
var text := "" : set = set_text
var used := false : set = set_used
var normal_color := Color.WHITE
var normal_used_color := normal_color
var hover_color := Color.WHITE
var hover_used_color := hover_color
var pressed_color := Color.WHITE
var pressed_used_color := pressed_color
var _state := "normal" : set = set_state
@onready var rich_text_label: RichTextLabel = %RichTextLabel
@onready var handler: Button = %Handler
#region Godot ######################################################################################
func _ready() -> void:
handler.pressed.connect(_on_pressed)
handler.mouse_entered.connect(_on_mouse_entered)
handler.mouse_exited.connect(_on_mouse_exited)
handler.button_down.connect(_on_button_down)
handler.button_up.connect(_on_button_up)
_update_font_color()
#endregion
#region SetGet #####################################################################################
func set_dialog_option(value: PopochiuDialogOption) -> void:
option = value
if PopochiuConfig.should_dialog_options_be_gibberish():
text = PopochiuUtils.d.create_gibberish(option.text)
else:
text = option.text
used = option.used and not option.always_on
func set_text(value: String) -> void:
text = value
rich_text_label.text = value
func set_used(value: bool) -> void:
used = value
_update_font_color()
func set_state(value: String) -> void:
_state = value
_update_font_color()
#endregion
#region Private ####################################################################################
func _on_pressed() -> void:
_state = "pressed"
pressed.emit(option)
func _on_mouse_entered() -> void:
_state = "hover"
func _on_mouse_exited() -> void:
_state = "normal"
func _on_button_down() -> void:
_state = "pressed"
func _on_button_up() -> void:
_state = "hover" if handler.is_hovered() else "normal"
func _update_font_color() -> void:
rich_text_label.add_theme_color_override(
"default_color",
get("%s_color" % (_state + ("_used" if used else "")))
)
#endregion

View file

@ -0,0 +1 @@
uid://mts5xfg7vhp1

View file

@ -0,0 +1,40 @@
[gd_scene load_steps=6 format=3 uid="uid://b8r2dcfb6u1e1"]
[ext_resource type="Theme" uid="uid://djl1xk7jgyvpp" path="res://game/gui/resources/gui_theme.tres" id="1_tdxhg"]
[ext_resource type="Script" uid="uid://blkbqigv64y7w" path="res://game/gui/components/dialog_menu/dialog_menu_option/dialog_menu_option_custom.gd" id="2_rads0"]
[ext_resource type="FontFile" uid="uid://cpr61sg33sxdo" path="res://game/gui/fonts/monkeyisland_1991.ttf" id="3_35cmc"]
[sub_resource type="StyleBoxEmpty" id="StyleBoxEmpty_un1pr"]
content_margin_left = 2.0
content_margin_right = 2.0
content_margin_bottom = 2.0
[sub_resource type="StyleBoxEmpty" id="StyleBoxEmpty_we03b"]
[node name="DialogMenuOption" type="PanelContainer"]
anchors_preset = 10
anchor_right = 1.0
offset_bottom = 24.0
grow_horizontal = 2
mouse_filter = 2
theme = ExtResource("1_tdxhg")
theme_override_styles/panel = SubResource("StyleBoxEmpty_un1pr")
script = ExtResource("2_rads0")
[node name="RichTextLabel" type="RichTextLabel" parent="."]
unique_name_in_owner = true
layout_mode = 2
bbcode_enabled = true
text = "A [wave]veeeeeeeeeeeeeery[/wave] long line option that should wrap so devs can have long options......"
fit_content = true
scroll_active = false
[node name="Handler" type="Button" parent="."]
unique_name_in_owner = true
layout_mode = 2
theme_override_fonts/font = ExtResource("3_35cmc")
theme_override_font_sizes/font_size = 12
theme_override_styles/focus = SubResource("StyleBoxEmpty_we03b")
flat = true
alignment = 0
text_overrun_behavior = 4

View file

@ -0,0 +1 @@
extends "dialog_menu_option.gd"

View file

@ -0,0 +1 @@
uid://ng1tegikh23s

View file

@ -0,0 +1,45 @@
extends PopochiuDialogText
@onready var left_avatar_container: PanelContainer = %LeftAvatarContainer
@onready var left_avatar: TextureRect = %LeftAvatar
@onready var right_avatar_container: PanelContainer = %RightAvatarContainer
@onready var right_avatar: TextureRect = %RightAvatar
#region Godot ######################################################################################
func _ready() -> void:
super()
# Connect to singletons signals
PopochiuUtils.c.character_spoke.connect(_update_avatar)
#endregion
#region Private ####################################################################################
func _update_avatar(chr: PopochiuCharacter, _msg := '') -> void:
if not rich_text_label.visible:
return
left_avatar_container.modulate.a = 0.0
left_avatar.texture = null
right_avatar_container.modulate.a = 0.0
right_avatar.texture = null
var char_pos: Vector2 = PopochiuUtils.get_screen_coords_for(chr).floor() / (
PopochiuUtils.e.scale if PopochiuUtils.e.settings.scale_gui else Vector2.ONE
)
if char_pos.x <= PopochiuUtils.e.half_width:
left_avatar_container.modulate.a = 1.0
left_avatar.texture = chr.get_avatar_for_emotion(chr.emotion)
else:
right_avatar_container.modulate.a = 1.0
right_avatar.texture = chr.get_avatar_for_emotion(chr.emotion)
func _set_default_size() -> void:
pass
#endregion

View file

@ -0,0 +1 @@
uid://b4larqo8mq285

View file

@ -0,0 +1,106 @@
[gd_scene load_steps=6 format=3 uid="uid://dpe2nwlyydj1d"]
[ext_resource type="Theme" uid="uid://djl1xk7jgyvpp" path="res://game/gui/resources/gui_theme.tres" id="1_63p8a"]
[ext_resource type="Script" uid="uid://cboqsfemowull" path="res://game/gui/components/dialog_text/dialog_portrait/dialog_portrait_custom.gd" id="2_4t5hq"]
[ext_resource type="Texture2D" uid="uid://bvx3a5es30q08" path="res://game/gui/components/dialog_text/images/ico_continue.png" id="3_44vf5"]
[sub_resource type="StyleBoxEmpty" id="StyleBoxEmpty_8fbbc"]
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_mjjs7"]
content_margin_left = 4.0
content_margin_top = 2.0
content_margin_right = 4.0
content_margin_bottom = 2.0
bg_color = Color(0, 0, 0, 0.705882)
[node name="DialogPortrait" type="Control" groups=["popochiu_gui_component"]]
layout_mode = 3
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
mouse_filter = 2
theme = ExtResource("1_63p8a")
script = ExtResource("2_4t5hq")
[node name="PanelContainer" type="PanelContainer" parent="."]
layout_mode = 1
anchors_preset = 12
anchor_top = 1.0
anchor_right = 1.0
anchor_bottom = 1.0
offset_top = -48.0
grow_horizontal = 2
grow_vertical = 0
mouse_filter = 2
theme_override_styles/panel = SubResource("StyleBoxEmpty_8fbbc")
[node name="HBoxContainer" type="HBoxContainer" parent="PanelContainer"]
layout_mode = 2
mouse_filter = 2
theme_override_constants/separation = 2
[node name="LeftAvatarContainer" type="PanelContainer" parent="PanelContainer/HBoxContainer"]
unique_name_in_owner = true
layout_mode = 2
mouse_filter = 2
[node name="LeftAvatar" type="TextureRect" parent="PanelContainer/HBoxContainer/LeftAvatarContainer"]
unique_name_in_owner = true
texture_filter = 1
custom_minimum_size = Vector2(48, 48)
layout_mode = 2
size_flags_vertical = 4
mouse_filter = 2
stretch_mode = 3
[node name="TextContainer" type="PanelContainer" parent="PanelContainer/HBoxContainer"]
layout_mode = 2
size_flags_horizontal = 3
mouse_filter = 2
theme_override_styles/panel = SubResource("StyleBoxFlat_mjjs7")
[node name="RichTextLabel" type="RichTextLabel" parent="PanelContainer/HBoxContainer/TextContainer"]
unique_name_in_owner = true
clip_contents = false
custom_minimum_size = Vector2(16, 16)
layout_mode = 2
size_flags_horizontal = 3
mouse_filter = 2
bbcode_enabled = true
text = "A [shake]portrait[/shake] dialog text."
scroll_active = false
meta_underlined = false
[node name="ContinueIcon" type="TextureProgressBar" parent="PanelContainer/HBoxContainer/TextContainer/RichTextLabel"]
unique_name_in_owner = true
texture_filter = 1
layout_mode = 1
anchors_preset = 3
anchor_left = 1.0
anchor_top = 1.0
anchor_right = 1.0
anchor_bottom = 1.0
offset_left = -16.0
offset_top = -16.0
grow_horizontal = 0
grow_vertical = 0
mouse_filter = 2
value = 100.0
fill_mode = 2
texture_progress = ExtResource("3_44vf5")
[node name="RightAvatarContainer" type="PanelContainer" parent="PanelContainer/HBoxContainer"]
unique_name_in_owner = true
layout_mode = 2
mouse_filter = 2
[node name="RightAvatar" type="TextureRect" parent="PanelContainer/HBoxContainer/RightAvatarContainer"]
unique_name_in_owner = true
texture_filter = 1
custom_minimum_size = Vector2(48, 48)
layout_mode = 2
size_flags_vertical = 4
mouse_filter = 2
stretch_mode = 3

View file

@ -0,0 +1 @@
extends "dialog_portrait.gd"

View file

@ -0,0 +1 @@
uid://cboqsfemowull

Binary file not shown.

After

Width:  |  Height:  |  Size: 173 B

View file

@ -0,0 +1,34 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://bvx3a5es30q08"
path="res://.godot/imported/ico_continue.png-eabcb3088fcbe3340e65e6c0e9d1d5bb.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://game/gui/components/dialog_text/images/ico_continue.png"
dest_files=["res://.godot/imported/ico_continue.png-eabcb3088fcbe3340e65e6c0e9d1d5bb.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

@ -0,0 +1,39 @@
extends Control
class_name GUIHoverText
@export var hide_during_dialogs := false
@onready var label: RichTextLabel = $RichTextLabel
#region Godot ######################################################################################
func _ready() -> void:
label.text = ""
# Connect to autoloads' signals
PopochiuUtils.g.hover_text_shown.connect(_show_text)
PopochiuUtils.g.dialog_line_started.connect(_on_dialog_line_started)
PopochiuUtils.g.dialog_line_finished.connect(_on_dialog_line_finished)
#endregion
#region Virtual ####################################################################################
func _show_text(txt := "") -> void:
label.text = "[center]%s[/center]" % txt
#endregion
#region Private ####################################################################################
func _on_dialog_line_started() -> void:
if hide_during_dialogs:
hide()
func _on_dialog_line_finished() -> void:
if hide_during_dialogs:
show()
#endregion

View file

@ -0,0 +1 @@
uid://dpntx5tuyavax

View file

@ -0,0 +1,29 @@
[gd_scene load_steps=3 format=3 uid="uid://b71fus0srl1s6"]
[ext_resource type="Theme" uid="uid://djl1xk7jgyvpp" path="res://game/gui/resources/gui_theme.tres" id="1_3qkco"]
[ext_resource type="Script" uid="uid://cctf1a46ej4r" path="res://game/gui/components/hover_text/hover_text_custom.gd" id="2_18lgb"]
[node name="HoverText" type="Control" groups=["popochiu_gui_component"]]
layout_mode = 3
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
mouse_filter = 2
theme = ExtResource("1_3qkco")
script = ExtResource("2_18lgb")
[node name="RichTextLabel" type="RichTextLabel" parent="."]
layout_mode = 1
anchors_preset = 10
anchor_right = 1.0
offset_bottom = 12.0
grow_horizontal = 2
mouse_filter = 2
theme_override_colors/font_outline_color = Color(0, 0, 0, 1)
theme_override_constants/outline_size = 4
bbcode_enabled = true
text = "[center]text for hovered objects[/center]"
fit_content = true
scroll_active = false

View file

@ -0,0 +1 @@
extends "hover_text.gd"

View file

@ -0,0 +1 @@
uid://cctf1a46ej4r

View file

@ -0,0 +1,226 @@
@tool
class_name GUIInventoryGrid
extends HBoxContainer
const EMPTY_SLOT := "[Empty Slot]00"
@export var slot_scene: PackedScene = null : set = set_slot_scene
@export var columns := 4 : set = set_columns
@export var visible_rows := 2 : set = set_visible_rows
@export var number_of_slots := 16 : set = set_number_of_slots
@export var h_separation := 0 : set = set_h_separation
@export var v_separation := 0 : set = set_v_separation
@export var show_arrows := true : set = set_show_arrows
@export var scroll_with_mouse_wheel := true
var rows := 0
var max_scroll := 0.0
var slot_size: float = 0.0
@onready var scroll_container: ScrollContainer = $ScrollContainer
@onready var box: GridContainer = %Box
@onready var scroll_buttons: VBoxContainer = $ScrollButtons
@onready var up: TextureButton = %Up
@onready var down: TextureButton = %Down
@onready var gap_size: int = box.get_theme_constant("v_separation")
#region Godot ######################################################################################
func _ready():
if Engine.is_editor_hint():
_update_box()
return
scroll_container.mouse_filter = (
Control.MOUSE_FILTER_PASS if scroll_with_mouse_wheel else Control.MOUSE_FILTER_IGNORE
)
_update_box()
_calculate_rows_and_scroll()
# _check_starting_items()
# Connect to child signals
up.pressed.connect(_on_up_pressed)
down.pressed.connect(_on_down_pressed)
scroll_container.get_v_scroll_bar().value_changed.connect(_on_scroll)
# Connect to singletons signals
PopochiuUtils.i.item_added.connect(_add_item)
PopochiuUtils.i.item_removed.connect(_remove_item)
PopochiuUtils.i.item_replaced.connect(_replace_item)
_check_scroll_buttons()
#endregion
#region SetGet #####################################################################################
func set_visible_rows(value: int) -> void:
visible_rows = value
_update_box()
func set_columns(value: int) -> void:
columns = value
_update_box()
func set_slot_scene(value: PackedScene) -> void:
slot_scene = value
_update_box()
func set_number_of_slots(value: int) -> void:
number_of_slots = value
_update_box()
func set_h_separation(value: int) -> void:
h_separation = value
_update_box()
func set_v_separation(value: int) -> void:
v_separation = value
_update_box()
func set_show_arrows(value: bool) -> void:
show_arrows = value
if is_instance_valid(scroll_buttons):
scroll_buttons.visible = value
#endregion
#region Private ####################################################################################
func _update_box() -> void:
if not is_instance_valid(box): return
box.columns = columns
box.add_theme_constant_override("h_separation", h_separation)
box.add_theme_constant_override("v_separation", v_separation)
# Fix: remove the child immediately (instead of calling queue_free()), and do not await for
# a process frame cause it can cause an issue when adding items marked as "Start with it".
for child in box.get_children():
child.free()
for idx in number_of_slots:
var slot := slot_scene.instantiate()
box.add_child(slot)
slot.name = EMPTY_SLOT
slot_size = slot.size.y
scroll_container.custom_minimum_size = Vector2(
(columns * (slot_size + h_separation)) - h_separation,
(visible_rows * (slot_size + v_separation)) - v_separation
)
## Calculate the number of rows in the box and the max scroll
func _calculate_rows_and_scroll() -> void:
var visible_slots := 0
for slot in box.get_children():
if slot.visible:
visible_slots += 1
@warning_ignore("integer_division")
rows = visible_slots / box.columns
max_scroll = ((slot_size + gap_size) * int(rows / 2))
## Check if there are inventory items in the scene tree and add them to the
## Inventory interface class (I).
func _check_starting_items() -> void:
for slot in box.get_children():
if (slot.get_child_count() > 0
and slot.get_child(0) is PopochiuInventoryItem
):
PopochiuUtils.i.items.append(slot.get_child(0).script_name)
slot.name = slot.get_child(0).script_name
else:
slot.name = EMPTY_SLOT
func _on_up_pressed() -> void:
scroll_container.scroll_vertical -= (slot_size + gap_size) + 1
_check_scroll_buttons()
func _on_down_pressed() -> void:
scroll_container.scroll_vertical += (slot_size + gap_size) + 1
_check_scroll_buttons()
func _add_item(item: PopochiuInventoryItem, _animate := true) -> void:
var slot := box.get_child(PopochiuUtils.i.items.size() - 1)
slot.name = "[%s]" % item.script_name
slot.add_child(item)
item.expand_mode = TextureRect.EXPAND_FIT_WIDTH
if slot.has_method("get_content_height"):
item.custom_minimum_size.y = slot.get_content_height()
else:
item.custom_minimum_size.y = slot.size.y
box.set_meta(item.script_name, slot)
item.selected.connect(_change_cursor)
_check_scroll_buttons()
# Common call to all inventories. Should be in the class from where inventory panels will
# inherit from
await get_tree().process_frame
PopochiuUtils.i.item_add_done.emit(item)
func _remove_item(item: PopochiuInventoryItem, _animate := true) -> void:
item.selected.disconnect(_change_cursor)
box.get_meta(item.script_name).remove_child(item)
box.get_meta(item.script_name).name = EMPTY_SLOT
_check_scroll_buttons()
await get_tree().process_frame
PopochiuUtils.i.item_remove_done.emit(item)
func _replace_item(
item: PopochiuInventoryItem, new_item: PopochiuInventoryItem
) -> void:
item.replace_by(new_item)
box.remove_meta(item.script_name)
box.set_meta(new_item.script_name, new_item.get_parent())
_check_scroll_buttons()
await get_tree().process_frame
PopochiuUtils.i.item_replace_done.emit()
func _change_cursor(item: PopochiuInventoryItem) -> void:
PopochiuUtils.i.set_active_item(item)
## Checks if the UP and DOWN buttons should be enabled
func _check_scroll_buttons() -> void:
up.disabled = scroll_container.scroll_vertical == 0
down.disabled = (
scroll_container.scroll_vertical >= max_scroll
or not (PopochiuUtils.i.items.size() > box.columns * visible_rows)
)
func _on_scroll(_value: float) -> void:
_check_scroll_buttons()
#endregion

View file

@ -0,0 +1 @@
uid://bcqea7ns3wfuo

View file

@ -0,0 +1,2 @@
@tool
extends "inventory_grid.gd"

View file

@ -0,0 +1 @@
uid://bjpy5q7v6dmrb

View file

@ -0,0 +1,139 @@
@tool
class_name GUIPopup
extends Control
## The base popup node used by Popochiu GUIs.
@export var closes_by_clicking_out := true
@export var script_name: StringName = ""
@export var title := "" : set = set_title
@onready var lbl_title: Label = %Title
@onready var btn_ok: Button = %Ok
@onready var btn_cancel: Button = %Cancel
@onready var btn_close: TextureButton = %Close
#region Godot ######################################################################################
func _ready() -> void:
if not title.is_empty():
lbl_title.text = title
if Engine.is_editor_hint(): return
# Connect to own signals
$Overlay.gui_input.connect(_check_click)
# Connect to child signals
btn_ok.pressed.connect(on_ok_pressed)
btn_cancel.pressed.connect(on_cancel_pressed)
btn_close.pressed.connect(on_cancel_pressed)
# Connect to singleton signals
PopochiuUtils.g.popup_requested.connect(_on_popup_requested)
close()
#endregion
#region Virtual ####################################################################################
## Called when the popup is opened. At this point it is not visible yet.
func _open() -> void:
pass
## Called when the popup is closed. The node hides after calling this method.
func _close() -> void:
pass
## Called when OK is pressed.
func _on_ok() -> void:
pass
## Called when CANCEL or X (top-right corner) are pressed.
func _on_cancel() -> void:
pass
#endregion
#region Public #####################################################################################
## Shows the popup scaling it and blocking interactions with the graphic interface.
func open() -> void:
_open()
PopochiuUtils.g.block()
PopochiuUtils.cursor.show_cursor("gui", true)
# Never open a popup on top of another
if not PopochiuUtils.e.gui.popups_stack.is_empty():
PopochiuUtils.e.gui.popups_stack.back().hide()
PopochiuUtils.e.gui.popups_stack.append(self)
show()
## Closes the popup unlocking interactions with the graphic interface.
func close() -> void:
PopochiuUtils.e.gui.popups_stack.erase(self)
hide()
if PopochiuUtils.e.gui.popups_stack.is_empty():
PopochiuUtils.g.unblock()
PopochiuUtils.cursor.unblock()
else:
# Idempotent call, no need to check the mode
PopochiuUtils.e.gui.popups_stack.back().show()
_close()
## Called when the OK button is pressed. It closes the popup afterwards.
func on_ok_pressed() -> void:
_on_ok()
close()
## Called when the CANCEL button is pressed. It closes the popup afterwards.
func on_cancel_pressed() -> void:
_on_cancel()
close()
## Called when the X (top-right corner) button is pressed. It closes the popup
## afterwards.
func on_close_pressed() -> void:
_on_cancel()
close()
#endregion
#region SetGet #####################################################################################
func set_title(value: String) -> void:
title = value
if is_instance_valid(lbl_title):
lbl_title.text = title
#endregion
#region Private ####################################################################################
## Checks if the overlay area of the popup was clicked in order to close it.
func _check_click(event: InputEvent) -> void:
if (
PopochiuUtils.get_click_or_touch_index(event) == MOUSE_BUTTON_LEFT
and closes_by_clicking_out
):
_on_cancel()
close()
func _on_popup_requested(popup_script_name: StringName) -> void:
if popup_script_name == script_name:
open()
#endregion

View file

@ -0,0 +1 @@
uid://dkhut4ro2glfh

View file

@ -0,0 +1,2 @@
@tool
extends "popochiu_popup.gd"

View file

@ -0,0 +1 @@
uid://deajt0yn7u242

View file

@ -0,0 +1,12 @@
[gd_resource type="StyleBoxFlat" format=3 uid="uid://ue48aimeiar7"]
[resource]
content_margin_left = 4.0
content_margin_top = 2.0
content_margin_right = 4.0
content_margin_bottom = 2.0
bg_color = Color(0, 0, 0, 0.705882)
expand_margin_left = 2.0
expand_margin_top = 2.0
expand_margin_right = 2.0
expand_margin_bottom = 2.0

View file

@ -0,0 +1,26 @@
@tool
extends PopochiuPopup
#region Virtual ####################################################################################
## Called when the popup is opened. At this point it is not visible yet.
func _open() -> void:
pass
## Called when the popup is closed. The node hides after calling this method.
func _close() -> void:
pass
## Called when OK is pressed.
func _on_ok() -> void:
get_tree().quit()
## Called when CANCEL or X (top-right corner) are pressed.
func _on_cancel() -> void:
pass
#endregion

View file

@ -0,0 +1 @@
uid://tmuymrue3vd2

View file

@ -0,0 +1,84 @@
[gd_scene load_steps=7 format=3 uid="uid://cvuyvuwt3dh4r"]
[ext_resource type="Theme" uid="uid://djl1xk7jgyvpp" path="res://game/gui/resources/gui_theme.tres" id="1_80fb2"]
[ext_resource type="Script" uid="uid://b01j2is3thxla" path="res://game/gui/components/popups/quit_popup/quit_popup_custom.gd" id="2_6j1m7"]
[ext_resource type="StyleBox" uid="uid://ue48aimeiar7" path="res://game/gui/components/popups/popochiu_popup_panel_container.tres" id="3_ou8w6"]
[ext_resource type="Texture2D" uid="uid://d127ve13o2kpl" path="res://game/gui/resources/images/close.png" id="4_jwtna"]
[ext_resource type="Texture2D" uid="uid://b3q226w2e3giu" path="res://game/gui/resources/images/close_highlight.png" id="5_8umn4"]
[sub_resource type="StyleBoxEmpty" id="StyleBoxEmpty_il3mr"]
[node name="QuitPopup" 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_80fb2")
script = ExtResource("2_6j1m7")
script_name = &"QuitPopup"
title = "Quit game"
[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_il3mr")
[node name="PanelContainer" type="PanelContainer" parent="Overlay"]
custom_minimum_size = Vector2(256, 0)
layout_mode = 2
size_flags_horizontal = 4
size_flags_vertical = 4
theme_override_styles/panel = ExtResource("3_ou8w6")
[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 = "Quit game"
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("4_jwtna")
texture_pressed = ExtResource("5_8umn4")
texture_hover = ExtResource("5_8umn4")
[node name="Question" type="Label" parent="Overlay/PanelContainer/VBoxContainer"]
layout_mode = 2
size_flags_horizontal = 3
text = "Are you sure you want to quit?"
horizontal_alignment = 1
vertical_alignment = 1
autowrap_mode = 3
[node name="FooterContainer" type="HBoxContainer" parent="Overlay/PanelContainer/VBoxContainer"]
layout_mode = 2
size_flags_vertical = 10
alignment = 1
[node name="Ok" type="Button" parent="Overlay/PanelContainer/VBoxContainer/FooterContainer"]
unique_name_in_owner = true
layout_mode = 2
text = "OK"
[node name="Cancel" type="Button" parent="Overlay/PanelContainer/VBoxContainer/FooterContainer"]
unique_name_in_owner = true
layout_mode = 2
text = "Cancel
"

View file

@ -0,0 +1,2 @@
@tool
extends "quit_popup.gd"

View file

@ -0,0 +1 @@
uid://b01j2is3thxla

View file

@ -0,0 +1,134 @@
@tool
extends PopochiuPopup
signal slot_selected
const SELECTION_COLOR := Color("edf171")
const OVERWRITE_COLOR := Color("c46c71")
var _current_slot: Button = null
var _slot_name := ""
var _prev_text := ""
var _slot := 0
@onready var slots: VBoxContainer = %Slots
#region Godot ######################################################################################
func _ready() -> void:
super()
if Engine.is_editor_hint(): return
btn_ok.disabled = true
var saves: Dictionary = PopochiuUtils.e.get_saves_descriptions()
for btn: Button in slots.get_children():
btn.set_meta("has_save", false)
if saves.has(btn.get_index() + 1):
btn.text = saves[btn.get_index() + 1]
btn.set_meta("has_save", true)
else:
btn.disabled = true
btn.pressed.connect(_select_slot.bind(btn))
#endregion
#region Virtual ####################################################################################
func _open() -> void:
btn_ok.disabled = true
_slot = 0
if _current_slot:
_current_slot.text = _prev_text
_current_slot.button_pressed = false
_current_slot = null
_prev_text = ""
func _close() -> void:
if not _slot: return
slot_selected.emit()
if _slot_name:
PopochiuUtils.e.save_game(_slot, _slot_name)
else:
PopochiuUtils.e.load_game(_slot)
func _on_ok() -> void:
_slot = _current_slot.get_index() + 1
if _slot_name:
_prev_text = _current_slot.text
_current_slot.set_meta("has_save", true)
#endregion
#region Public #####################################################################################
func open_save() -> void:
_show_save()
func open_load() -> void:
_show_load()
#endregion
#region Private ####################################################################################
func _show_save(slot_text := "") -> void:
lbl_title.text = "Choose a slot to save the game"
_slot_name = slot_text
if _slot_name.is_empty():
_slot_name = _format_date(Time.get_datetime_dict_from_system())
for btn in slots.get_children():
btn.disabled = false
open()
func _show_load() -> void:
lbl_title.text = "Choose the slot to load"
_slot_name = ""
for btn in slots.get_children():
btn.disabled = !(btn as Button).get_meta("has_save")
open()
func _select_slot(btn: Button) -> void:
if _slot_name:
if _current_slot:
_current_slot.text = _prev_text
_current_slot.button_pressed = false
_current_slot = btn
_prev_text = _current_slot.text
_current_slot.text = _slot_name
else:
if _current_slot:
_current_slot.button_pressed = false
_current_slot = btn
_prev_text = _current_slot.text
btn_ok.disabled = false
func _format_date(date: Dictionary) -> String:
return "%d/%02d/%02d %02d:%02d:%02d" % [
date.year, date.month, date.day, date.hour, date.minute, date.second
]
#endregion

View file

@ -0,0 +1 @@
uid://5wnpp5td5dcx

View file

@ -0,0 +1,100 @@
[gd_scene load_steps=7 format=3 uid="uid://tgyca2usqnn1"]
[ext_resource type="Theme" uid="uid://djl1xk7jgyvpp" path="res://game/gui/resources/gui_theme.tres" id="1_vmhif"]
[ext_resource type="Script" uid="uid://c30sbvthxnrr0" path="res://game/gui/components/popups/save_and_load_popup/save_and_load_popup_custom.gd" id="2_mh08k"]
[ext_resource type="StyleBox" uid="uid://ue48aimeiar7" path="res://game/gui/components/popups/popochiu_popup_panel_container.tres" id="3_3nj74"]
[ext_resource type="Texture2D" uid="uid://d127ve13o2kpl" path="res://game/gui/resources/images/close.png" id="4_sf4bt"]
[ext_resource type="Texture2D" uid="uid://b3q226w2e3giu" path="res://game/gui/resources/images/close_highlight.png" id="5_xdowh"]
[sub_resource type="StyleBoxEmpty" id="StyleBoxEmpty_yg86r"]
[node name="SaveAndLoadPopup" 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_vmhif")
script = ExtResource("2_mh08k")
script_name = &"SaveAndLoadPopup"
[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_yg86r")
[node name="PanelContainer" type="PanelContainer" parent="Overlay"]
custom_minimum_size = Vector2(192, 0)
layout_mode = 2
size_flags_horizontal = 4
size_flags_vertical = 4
theme_override_styles/panel = ExtResource("3_3nj74")
[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 = "Choose a slot to..."
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("4_sf4bt")
texture_pressed = ExtResource("5_xdowh")
texture_hover = ExtResource("5_xdowh")
[node name="Slots" type="VBoxContainer" parent="Overlay/PanelContainer/VBoxContainer"]
unique_name_in_owner = true
layout_mode = 2
size_flags_vertical = 3
alignment = 1
[node name="BtnSlot1" type="Button" parent="Overlay/PanelContainer/VBoxContainer/Slots"]
layout_mode = 2
toggle_mode = true
text = "slot 1"
[node name="BtnSlot2" type="Button" parent="Overlay/PanelContainer/VBoxContainer/Slots"]
layout_mode = 2
toggle_mode = true
text = "slot 2"
[node name="BtnSlot3" type="Button" parent="Overlay/PanelContainer/VBoxContainer/Slots"]
layout_mode = 2
toggle_mode = true
text = "slot 3"
[node name="BtnSlot4" type="Button" parent="Overlay/PanelContainer/VBoxContainer/Slots"]
layout_mode = 2
toggle_mode = true
text = "slot 4"
[node name="FooterContainer" type="HBoxContainer" parent="Overlay/PanelContainer/VBoxContainer"]
layout_mode = 2
size_flags_vertical = 10
alignment = 1
[node name="Ok" type="Button" parent="Overlay/PanelContainer/VBoxContainer/FooterContainer"]
unique_name_in_owner = true
layout_mode = 2
text = "OK"
[node name="Cancel" type="Button" parent="Overlay/PanelContainer/VBoxContainer/FooterContainer"]
unique_name_in_owner = true
layout_mode = 2
text = "Cancel"

View file

@ -0,0 +1,2 @@
@tool
extends "save_and_load_popup.gd"

View file

@ -0,0 +1 @@
uid://c30sbvthxnrr0

View file

@ -0,0 +1,40 @@
@tool
extends PopochiuPopup
@onready var text_speed: HSlider = %TextSpeed
@onready var dialog_style: OptionButton = %DialogStyle
@onready var continue_mode: CheckButton = %ContinueMode
#region Godot ######################################################################################
func _ready() -> void:
super()
if Engine.is_editor_hint(): return
text_speed.value = 0.1 - PopochiuUtils.e.text_speed
dialog_style.selected = PopochiuUtils.e.settings.dialog_style
continue_mode.button_pressed = PopochiuUtils.e.settings.auto_continue_text
# Connect to child signals
text_speed.value_changed.connect(_on_text_speed_changed)
dialog_style.item_selected.connect(_on_dialog_style_selected)
continue_mode.toggled.connect(_on_continue_mode_toggled)
#endregion
#region Private ####################################################################################
func _on_text_speed_changed(value: float) -> void:
PopochiuUtils.e.text_speed = 0.1 - value
func _on_dialog_style_selected(idx: int) -> void:
PopochiuUtils.e.current_dialog_style = dialog_style.get_item_id(idx)
func _on_continue_mode_toggled(toggled_on: bool) -> void:
PopochiuUtils.e.settings.auto_continue_text = toggled_on
#endregion

View file

@ -0,0 +1 @@
uid://dri5b2wiyrk2k

View file

@ -0,0 +1,151 @@
[gd_scene load_steps=13 format=3 uid="uid://b7eigjmiv4k0y"]
[ext_resource type="Theme" uid="uid://djl1xk7jgyvpp" path="res://game/gui/resources/gui_theme.tres" id="1_0bw1h"]
[ext_resource type="Script" uid="uid://bme4hhwe1ej25" path="res://game/gui/components/popups/text_settings_popup/text_settings_popup_custom.gd" id="2_t0dmb"]
[ext_resource type="StyleBox" uid="uid://ue48aimeiar7" path="res://game/gui/components/popups/popochiu_popup_panel_container.tres" id="3_1lm8y"]
[ext_resource type="Texture2D" uid="uid://d127ve13o2kpl" path="res://game/gui/resources/images/close.png" id="4_ml574"]
[ext_resource type="Texture2D" uid="uid://b3q226w2e3giu" path="res://game/gui/resources/images/close_highlight.png" id="5_8vsjw"]
[sub_resource type="StyleBoxEmpty" id="StyleBoxEmpty_bh5os"]
[sub_resource type="StyleBoxEmpty" id="StyleBoxEmpty_b5jxw"]
[sub_resource type="StyleBoxEmpty" id="StyleBoxEmpty_rinqp"]
[sub_resource type="StyleBoxEmpty" id="StyleBoxEmpty_vprmd"]
[sub_resource type="StyleBoxEmpty" id="StyleBoxEmpty_372y7"]
[sub_resource type="StyleBoxEmpty" id="StyleBoxEmpty_t5skw"]
[sub_resource type="StyleBoxEmpty" id="StyleBoxEmpty_5015x"]
[node name="TextSettingsPopup" 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_0bw1h")
script = ExtResource("2_t0dmb")
script_name = &"SierraTextPopup"
title = "Text options"
[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_bh5os")
[node name="PanelContainer" type="PanelContainer" parent="Overlay"]
custom_minimum_size = Vector2(160, 140)
layout_mode = 2
size_flags_horizontal = 4
size_flags_vertical = 4
theme_override_styles/panel = ExtResource("3_1lm8y")
[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 = "Text options"
horizontal_alignment = 1
vertical_alignment = 1
[node name="Close" type="TextureButton" parent="Overlay/PanelContainer/VBoxContainer/HeaderContainer"]
unique_name_in_owner = true
visible = false
texture_filter = 1
layout_mode = 2
size_flags_vertical = 4
texture_normal = ExtResource("4_ml574")
texture_pressed = ExtResource("5_8vsjw")
texture_hover = ExtResource("5_8vsjw")
[node name="BodyContainer" type="VBoxContainer" parent="Overlay/PanelContainer/VBoxContainer"]
layout_mode = 2
[node name="TextSpeedContainer" type="HBoxContainer" parent="Overlay/PanelContainer/VBoxContainer/BodyContainer"]
layout_mode = 2
[node name="Label" type="Label" parent="Overlay/PanelContainer/VBoxContainer/BodyContainer/TextSpeedContainer"]
layout_mode = 2
text = "Typing speed"
[node name="TextSpeed" type="HSlider" parent="Overlay/PanelContainer/VBoxContainer/BodyContainer/TextSpeedContainer"]
unique_name_in_owner = true
texture_filter = 1
layout_mode = 2
size_flags_horizontal = 3
max_value = 0.1
step = 0.01
[node name="DialogStyleContainer" type="HBoxContainer" parent="Overlay/PanelContainer/VBoxContainer/BodyContainer"]
visible = false
layout_mode = 2
[node name="Label" type="Label" parent="Overlay/PanelContainer/VBoxContainer/BodyContainer/DialogStyleContainer"]
layout_mode = 2
text = "Style"
horizontal_alignment = 1
[node name="DialogStyle" type="OptionButton" parent="Overlay/PanelContainer/VBoxContainer/BodyContainer/DialogStyleContainer"]
unique_name_in_owner = true
texture_filter = 1
layout_mode = 2
size_flags_horizontal = 3
selected = 0
item_count = 3
popup/item_0/text = "Above character"
popup/item_1/text = "Portrait"
popup/item_1/id = 1
popup/item_2/text = "Caption"
popup/item_2/id = 2
[node name="ContinueModeContainer" type="HBoxContainer" parent="Overlay/PanelContainer/VBoxContainer/BodyContainer"]
layout_mode = 2
[node name="Label" type="Label" parent="Overlay/PanelContainer/VBoxContainer/BodyContainer/ContinueModeContainer"]
layout_mode = 2
text = "Autoadvance"
horizontal_alignment = 1
[node name="ContinueMode" type="CheckButton" parent="Overlay/PanelContainer/VBoxContainer/BodyContainer/ContinueModeContainer"]
unique_name_in_owner = true
texture_filter = 1
layout_mode = 2
size_flags_horizontal = 10
size_flags_vertical = 0
theme_override_styles/focus = SubResource("StyleBoxEmpty_b5jxw")
theme_override_styles/disabled = SubResource("StyleBoxEmpty_rinqp")
theme_override_styles/hover_pressed = SubResource("StyleBoxEmpty_vprmd")
theme_override_styles/hover = SubResource("StyleBoxEmpty_372y7")
theme_override_styles/pressed = SubResource("StyleBoxEmpty_t5skw")
theme_override_styles/normal = SubResource("StyleBoxEmpty_5015x")
icon_alignment = 2
[node name="FooterContainer" type="HBoxContainer" parent="Overlay/PanelContainer/VBoxContainer"]
layout_mode = 2
size_flags_vertical = 10
alignment = 1
[node name="Ok" type="Button" parent="Overlay/PanelContainer/VBoxContainer/FooterContainer"]
unique_name_in_owner = true
visible = false
layout_mode = 2
text = "OK"
[node name="Cancel" type="Button" parent="Overlay/PanelContainer/VBoxContainer/FooterContainer"]
unique_name_in_owner = true
layout_mode = 2
text = "Back"

View file

@ -0,0 +1,2 @@
@tool
extends "text_settings_popup.gd"

View file

@ -0,0 +1 @@
uid://bme4hhwe1ej25

View file

@ -0,0 +1,37 @@
extends Control
@export var score := 0
@export var max_score := 100
@onready var lbl_game_name: Label = %LblGameName
@onready var lbl_score: Label = %LblScore
#region Public #####################################################################################
func set_game_name(game_name: String) -> void:
lbl_game_name.text = game_name
func reset_score() -> void:
score = 0
_update_text()
func add_score(value: int) -> void:
score += value
_update_text()
func subtract_score(value: int) -> void:
score -= value
_update_text()
#endregion
#region Private ####################################################################################
func _update_text() -> void:
lbl_score.text = "%d/%d" % [score, max_score]
#endregion

View file

@ -0,0 +1 @@
uid://cnnpvj3tgrsyy

View file

@ -0,0 +1,42 @@
[gd_scene load_steps=4 format=3 uid="uid://16tq4pfptkuh"]
[ext_resource type="Theme" uid="uid://djl1xk7jgyvpp" path="res://game/gui/resources/gui_theme.tres" id="1_j5rt6"]
[ext_resource type="Script" uid="uid://dp4w7xf6ofa53" path="res://game/gui/components/sierra_bar/sierra_bar_custom.gd" id="2_l561w"]
[ext_resource type="PackedScene" uid="uid://b71fus0srl1s6" path="res://game/gui/components/hover_text/hover_text.tscn" id="3_q6hqu"]
[node name="SierraBar" type="Control" groups=["popochiu_gui_component"]]
layout_mode = 3
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
mouse_filter = 2
theme = ExtResource("1_j5rt6")
script = ExtResource("2_l561w")
[node name="PanelContainer" type="PanelContainer" parent="."]
layout_mode = 1
anchors_preset = 10
anchor_right = 1.0
offset_bottom = 15.0
grow_horizontal = 2
[node name="HBoxContainer" type="HBoxContainer" parent="PanelContainer"]
layout_mode = 2
theme_override_constants/separation = 0
[node name="LblGameName" type="Label" parent="PanelContainer/HBoxContainer"]
unique_name_in_owner = true
layout_mode = 2
text = "Sierra GUI"
[node name="HoverText" parent="PanelContainer/HBoxContainer" instance=ExtResource("3_q6hqu")]
layout_mode = 2
size_flags_horizontal = 3
theme = null
[node name="LblScore" type="Label" parent="PanelContainer/HBoxContainer"]
unique_name_in_owner = true
layout_mode = 2
text = "Score: 0"

View file

@ -0,0 +1 @@
extends "sierra_bar.gd"

View file

@ -0,0 +1 @@
uid://dp4w7xf6ofa53

View file

@ -0,0 +1,19 @@
extends TextureButton
@export var command: SierraCommands.Commands = 0
#region Godot ######################################################################################
func _ready() -> void:
toggled.connect(on_toggled)
#endregion
#region Public #####################################################################################
func on_toggled(is_pressed: bool) -> void:
if is_pressed:
PopochiuUtils.e.current_command = command
#endregion

View file

@ -0,0 +1 @@
uid://dqnvapmr0fyh3

View file

@ -0,0 +1 @@
extends "sierra_command_button.gd"

View file

@ -0,0 +1 @@
uid://bp2gnas5b8uc6

Binary file not shown.

After

Width:  |  Height:  |  Size: 321 B

View file

@ -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

Binary file not shown.

After

Width:  |  Height:  |  Size: 306 B

View file

@ -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

View file

@ -0,0 +1,4 @@
[gd_resource type="ButtonGroup" format=3 uid="uid://4h08p4mg3i5b"]
[resource]
resource_name = "SierraInventoryButtonGroup"

View file

@ -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

View file

@ -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

View file

@ -0,0 +1 @@
uid://1huwoqm2cibs

View file

@ -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"

View file

@ -0,0 +1,2 @@
@tool
extends "sierra_inventory_popup.gd"

View file

@ -0,0 +1 @@
uid://bjvh1mgd6xryk

View file

@ -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

View file

@ -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")

View file

@ -0,0 +1 @@
extends "sierra_inventory_slot.gd"

View file

@ -0,0 +1,20 @@
extends HBoxContainer
#region Godot ######################################################################################
func _ready() -> void:
PopochiuUtils.e.command_selected.connect(_on_command_selected)
#endregion
#region Public #####################################################################################
func _on_command_selected() -> void:
for b in get_children():
(b as TextureButton).set_pressed_no_signal(false)
(get_child(PopochiuUtils.e.current_command) as TextureButton).set_pressed_no_signal(true)
PopochiuUtils.cursor.show_cursor(PopochiuUtils.e.get_current_command_name().to_snake_case())
#endregion

View file

@ -0,0 +1 @@
uid://hf44bjih0l8g

View file

@ -0,0 +1 @@
extends "sierra_commands_container.gd"

View file

@ -0,0 +1 @@
uid://c1qis2wgq3wss

View file

@ -0,0 +1,78 @@
extends Control
## Defines the height in pixels of the zone where moving the mouse in the top of the screen will
## make the bar to show. Note: This value will be affected by the Experimental Scale GUI checkbox
## in Project Settings > Popochiu > GUI.
@export var input_zone_height := 4
@onready var panel_container: PanelContainer = $PanelContainer
@onready var inventory = %Inventory
@onready var settings = %Settings
@onready var help = %Help
@onready var quit = %Quit
#region Godot ######################################################################################
func _ready():
inventory.pressed.connect(_on_inventory_pressed)
settings.pressed.connect(_on_settings_pressed)
help.pressed.connect(_on_help_pressed)
quit.pressed.connect(_on_quit_pressed)
hide()
func _input(event: InputEvent) -> void:
if PopochiuUtils.g.is_blocked: return
if event is InputEventMouseMotion:
var rect := panel_container.get_rect()
if not visible:
rect.size.y = input_zone_height
if PopochiuUtils.e.settings.scale_gui:
rect = Rect2(
panel_container.get_rect().position * PopochiuUtils.e.scale,
(Vector2(
panel_container.get_rect().size.x,
panel_container.get_rect().size.y if visible
else panel_container.get_rect().size.y / 2.0
)) * PopochiuUtils.e.scale
)
if not visible and rect.has_point(get_global_mouse_position()):
# Show the top menu
if not PopochiuUtils.i.active:
PopochiuUtils.cursor.show_cursor("gui")
show()
elif visible and not rect.has_point(get_global_mouse_position()):
# Hide the top menu
if not PopochiuUtils.i.active:
PopochiuUtils.cursor.show_cursor(PopochiuUtils.e.get_current_command_name().to_snake_case())
hide()
#endregion
#region Private ####################################################################################
func _on_inventory_pressed() -> void:
hide()
PopochiuUtils.g.popup_requested.emit("SierraInventoryPopup")
func _on_settings_pressed() -> void:
hide()
PopochiuUtils.g.popup_requested.emit("SierraSettingsPopup")
func _on_help_pressed() -> void:
# TODO: Open the help popup
pass
func _on_quit_pressed() -> void:
PopochiuUtils.g.popup_requested.emit("QuitPopup")
#endregion

View file

@ -0,0 +1 @@
uid://c0m0wibnq85lo

View file

@ -0,0 +1,204 @@
[gd_scene load_steps=35 format=3 uid="uid://c0cj1ckrygig8"]
[ext_resource type="Theme" uid="uid://djl1xk7jgyvpp" path="res://game/gui/resources/gui_theme.tres" id="1_ud5cn"]
[ext_resource type="Script" uid="uid://cvkymnm6vq3k0" path="res://game/gui/components/sierra_menu/sierra_menu_custom.gd" id="2_8nno7"]
[ext_resource type="Script" uid="uid://c1qis2wgq3wss" path="res://game/gui/components/sierra_menu/sierra_commands_container_custom.gd" id="3_rs6cd"]
[ext_resource type="Texture2D" uid="uid://dceipb6j03b7u" path="res://game/gui/images/btn_walk.png" id="4_xgctf"]
[ext_resource type="Script" uid="uid://bp2gnas5b8uc6" path="res://game/gui/components/sierra_command_button/sierra_command_button_custom.gd" id="5_nbbu2"]
[ext_resource type="Texture2D" uid="uid://c6j2obrx3bjug" path="res://game/gui/images/btn_look.png" id="6_6t2xu"]
[ext_resource type="Texture2D" uid="uid://mv2x206ftad" path="res://game/gui/images/btn_interact.png" id="7_05ecu"]
[ext_resource type="Texture2D" uid="uid://w8fcambs2g6l" path="res://game/gui/images/btn_talk.png" id="8_fd15y"]
[ext_resource type="Texture2D" uid="uid://lv4c6aalk6xk" path="res://game/gui/images/btn_inventory.png" id="9_wsgk5"]
[ext_resource type="Texture2D" uid="uid://ci5l1spqgxwnf" path="res://game/gui/images/btn_settings.png" id="10_iwmbg"]
[ext_resource type="Texture2D" uid="uid://1bv3yql4x3mr" path="res://game/gui/images/btn_help.png" id="11_ox5dl"]
[ext_resource type="Texture2D" uid="uid://lthnvxmoyv5u" path="res://game/gui/images/btn_quit.png" id="12_w05ne"]
[sub_resource type="AtlasTexture" id="AtlasTexture_csu2p"]
atlas = ExtResource("4_xgctf")
region = Rect2(0, 0, 24, 24)
[sub_resource type="AtlasTexture" id="AtlasTexture_ylk7h"]
atlas = ExtResource("4_xgctf")
region = Rect2(0, 24, 24, 24)
[sub_resource type="AtlasTexture" id="AtlasTexture_ao1oe"]
atlas = ExtResource("4_xgctf")
region = Rect2(0, 24, 24, 24)
[sub_resource type="AtlasTexture" id="AtlasTexture_irg4s"]
atlas = ExtResource("6_6t2xu")
region = Rect2(0, 0, 24, 24)
[sub_resource type="AtlasTexture" id="AtlasTexture_sijr3"]
atlas = ExtResource("6_6t2xu")
region = Rect2(0, 24, 24, 24)
[sub_resource type="AtlasTexture" id="AtlasTexture_msotb"]
atlas = ExtResource("6_6t2xu")
region = Rect2(0, 24, 24, 24)
[sub_resource type="AtlasTexture" id="AtlasTexture_u5ilp"]
atlas = ExtResource("7_05ecu")
region = Rect2(0, 0, 24, 24)
[sub_resource type="AtlasTexture" id="AtlasTexture_nkumn"]
atlas = ExtResource("7_05ecu")
region = Rect2(0, 24, 24, 24)
[sub_resource type="AtlasTexture" id="AtlasTexture_ddbjm"]
atlas = ExtResource("7_05ecu")
region = Rect2(0, 24, 24, 24)
[sub_resource type="AtlasTexture" id="AtlasTexture_r0y6q"]
atlas = ExtResource("8_fd15y")
region = Rect2(0, 0, 24, 24)
[sub_resource type="AtlasTexture" id="AtlasTexture_yyrpv"]
atlas = ExtResource("8_fd15y")
region = Rect2(0, 24, 24, 24)
[sub_resource type="AtlasTexture" id="AtlasTexture_m2m36"]
atlas = ExtResource("8_fd15y")
region = Rect2(0, 24, 24, 24)
[sub_resource type="StyleBoxEmpty" id="StyleBoxEmpty_a3v2b"]
[sub_resource type="AtlasTexture" id="AtlasTexture_uvguw"]
atlas = ExtResource("9_wsgk5")
region = Rect2(0, 0, 24, 24)
[sub_resource type="AtlasTexture" id="AtlasTexture_mdjye"]
atlas = ExtResource("9_wsgk5")
region = Rect2(0, 24, 24, 24)
[sub_resource type="AtlasTexture" id="AtlasTexture_odwa6"]
atlas = ExtResource("9_wsgk5")
region = Rect2(0, 24, 24, 24)
[sub_resource type="AtlasTexture" id="AtlasTexture_wy7fm"]
atlas = ExtResource("10_iwmbg")
region = Rect2(0, 0, 24, 24)
[sub_resource type="AtlasTexture" id="AtlasTexture_eccvv"]
atlas = ExtResource("10_iwmbg")
region = Rect2(0, 24, 24, 24)
[sub_resource type="AtlasTexture" id="AtlasTexture_0ahol"]
atlas = ExtResource("10_iwmbg")
region = Rect2(0, 24, 24, 24)
[sub_resource type="AtlasTexture" id="AtlasTexture_f8jt5"]
atlas = ExtResource("12_w05ne")
region = Rect2(0, 0, 24, 24)
[sub_resource type="AtlasTexture" id="AtlasTexture_c0o1t"]
atlas = ExtResource("12_w05ne")
region = Rect2(0, 24, 24, 24)
[sub_resource type="AtlasTexture" id="AtlasTexture_hs767"]
atlas = ExtResource("12_w05ne")
region = Rect2(0, 24, 24, 24)
[node name="SierraMenu" type="Control" groups=["popochiu_gui_component"]]
layout_mode = 3
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
mouse_filter = 2
theme = ExtResource("1_ud5cn")
script = ExtResource("2_8nno7")
[node name="PanelContainer" type="PanelContainer" parent="."]
layout_mode = 1
anchors_preset = 10
anchor_right = 1.0
offset_bottom = 24.0
grow_horizontal = 2
[node name="HBoxContainer" type="HBoxContainer" parent="PanelContainer"]
layout_mode = 2
theme_override_constants/separation = 0
[node name="SierraCommandsContainer" type="HBoxContainer" parent="PanelContainer/HBoxContainer"]
layout_mode = 2
theme_override_constants/separation = 0
script = ExtResource("3_rs6cd")
[node name="Walk" type="TextureButton" parent="PanelContainer/HBoxContainer/SierraCommandsContainer"]
texture_filter = 1
layout_mode = 2
toggle_mode = true
texture_normal = SubResource("AtlasTexture_csu2p")
texture_pressed = SubResource("AtlasTexture_ylk7h")
texture_hover = SubResource("AtlasTexture_ao1oe")
script = ExtResource("5_nbbu2")
[node name="Look" type="TextureButton" parent="PanelContainer/HBoxContainer/SierraCommandsContainer"]
texture_filter = 1
layout_mode = 2
toggle_mode = true
texture_normal = SubResource("AtlasTexture_irg4s")
texture_pressed = SubResource("AtlasTexture_sijr3")
texture_hover = SubResource("AtlasTexture_msotb")
script = ExtResource("5_nbbu2")
command = 1
[node name="Interact" type="TextureButton" parent="PanelContainer/HBoxContainer/SierraCommandsContainer"]
texture_filter = 1
layout_mode = 2
toggle_mode = true
texture_normal = SubResource("AtlasTexture_u5ilp")
texture_pressed = SubResource("AtlasTexture_nkumn")
texture_hover = SubResource("AtlasTexture_ddbjm")
script = ExtResource("5_nbbu2")
command = 2
[node name="Talk" type="TextureButton" parent="PanelContainer/HBoxContainer/SierraCommandsContainer"]
texture_filter = 1
layout_mode = 2
toggle_mode = true
texture_normal = SubResource("AtlasTexture_r0y6q")
texture_pressed = SubResource("AtlasTexture_yyrpv")
texture_hover = SubResource("AtlasTexture_m2m36")
script = ExtResource("5_nbbu2")
command = 3
[node name="PanelContainer" type="PanelContainer" parent="PanelContainer/HBoxContainer"]
texture_filter = 1
layout_mode = 2
size_flags_horizontal = 3
theme_override_styles/panel = SubResource("StyleBoxEmpty_a3v2b")
[node name="Inventory" type="TextureButton" parent="PanelContainer/HBoxContainer"]
unique_name_in_owner = true
texture_filter = 1
layout_mode = 2
texture_normal = SubResource("AtlasTexture_uvguw")
texture_pressed = SubResource("AtlasTexture_mdjye")
texture_hover = SubResource("AtlasTexture_odwa6")
[node name="Settings" type="TextureButton" parent="PanelContainer/HBoxContainer"]
unique_name_in_owner = true
texture_filter = 1
layout_mode = 2
texture_normal = SubResource("AtlasTexture_wy7fm")
texture_pressed = SubResource("AtlasTexture_eccvv")
texture_hover = SubResource("AtlasTexture_0ahol")
[node name="Help" type="TextureButton" parent="PanelContainer/HBoxContainer"]
unique_name_in_owner = true
visible = false
texture_filter = 1
layout_mode = 2
texture_normal = ExtResource("11_ox5dl")
[node name="Quit" type="TextureButton" parent="PanelContainer/HBoxContainer"]
unique_name_in_owner = true
visible = false
texture_filter = 1
layout_mode = 2
texture_normal = SubResource("AtlasTexture_f8jt5")
texture_pressed = SubResource("AtlasTexture_c0o1t")
texture_hover = SubResource("AtlasTexture_hs767")

View file

@ -0,0 +1 @@
extends "sierra_menu.gd"

View file

@ -0,0 +1 @@
uid://cvkymnm6vq3k0

View file

@ -0,0 +1,42 @@
@tool
extends PopochiuPopup
signal option_selected(option_name)
@onready var save: Button = %Save
@onready var load: Button = %Load
@onready var sound: Button = %Sound
@onready var text: Button = %Text
@onready var quit: Button = %Quit
#region Godot ######################################################################################
func _ready() -> void:
super()
if Engine.is_editor_hint(): return
# Connect to childrens' signals
save.pressed.connect(_on_option_pressed.bind("save"))
load.pressed.connect(_on_option_pressed.bind("load"))
sound.pressed.connect(_on_option_pressed.bind("sound"))
text.pressed.connect(_on_option_pressed.bind("text"))
quit.pressed.connect(_on_option_pressed.bind("quit"))
# Connect to autoloads signals
# Fix #219: Close the popup whenever a slot is selected for saving or loading
PopochiuUtils.e.game_saved.connect(close)
PopochiuUtils.e.game_load_started.connect(close)
if OS.has_feature("web"):
quit.hide()
#endregion
#region Private ####################################################################################
func _on_option_pressed(option_name: String) -> void:
option_selected.emit(option_name)
#endregion

View file

@ -0,0 +1 @@
uid://dngcrm4eksml8

View file

@ -0,0 +1,111 @@
[gd_scene load_steps=7 format=3 uid="uid://cip0ocpfmf6cj"]
[ext_resource type="Theme" uid="uid://djl1xk7jgyvpp" path="res://game/gui/resources/gui_theme.tres" id="1_xb5sb"]
[ext_resource type="Script" uid="uid://8uetmksup2e7" path="res://game/gui/components/sierra_settings_popup/sierra_settings_popup_custom.gd" id="2_ph6np"]
[ext_resource type="StyleBox" uid="uid://ue48aimeiar7" path="res://game/gui/components/popups/popochiu_popup_panel_container.tres" id="3_b3hcl"]
[ext_resource type="Texture2D" uid="uid://d127ve13o2kpl" path="res://game/gui/resources/images/close.png" id="4_07xb6"]
[ext_resource type="Texture2D" uid="uid://b3q226w2e3giu" path="res://game/gui/resources/images/close_highlight.png" id="5_fkdxu"]
[sub_resource type="StyleBoxEmpty" id="StyleBoxEmpty_fkove"]
[node name="SierraSettingsPopup" 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_xb5sb")
script = ExtResource("2_ph6np")
script_name = &"SierraSettingsPopup"
title = "Options"
[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_fkove")
[node name="PanelContainer" type="PanelContainer" parent="Overlay"]
custom_minimum_size = Vector2(120, 0)
layout_mode = 2
size_flags_horizontal = 4
size_flags_vertical = 4
theme_override_styles/panel = ExtResource("3_b3hcl")
[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 = "Options"
horizontal_alignment = 1
vertical_alignment = 1
[node name="Close" type="TextureButton" parent="Overlay/PanelContainer/VBoxContainer/HeaderContainer"]
unique_name_in_owner = true
visible = false
texture_filter = 1
layout_mode = 2
size_flags_vertical = 4
texture_normal = ExtResource("4_07xb6")
texture_pressed = ExtResource("5_fkdxu")
texture_hover = ExtResource("5_fkdxu")
[node name="BodyContainer" type="VBoxContainer" parent="Overlay/PanelContainer/VBoxContainer"]
custom_minimum_size = Vector2(112, 0)
layout_mode = 2
[node name="HBoxContainer" type="HBoxContainer" parent="Overlay/PanelContainer/VBoxContainer/BodyContainer"]
layout_mode = 2
[node name="Save" type="Button" parent="Overlay/PanelContainer/VBoxContainer/BodyContainer/HBoxContainer"]
unique_name_in_owner = true
layout_mode = 2
size_flags_horizontal = 3
text = "Save"
[node name="Load" type="Button" parent="Overlay/PanelContainer/VBoxContainer/BodyContainer/HBoxContainer"]
unique_name_in_owner = true
layout_mode = 2
size_flags_horizontal = 3
text = "Load"
[node name="Sound" type="Button" parent="Overlay/PanelContainer/VBoxContainer/BodyContainer"]
unique_name_in_owner = true
layout_mode = 2
text = "Sound options"
[node name="Text" type="Button" parent="Overlay/PanelContainer/VBoxContainer/BodyContainer"]
unique_name_in_owner = true
layout_mode = 2
text = "Text options"
[node name="Quit" type="Button" parent="Overlay/PanelContainer/VBoxContainer/BodyContainer"]
unique_name_in_owner = true
layout_mode = 2
text = "Quit"
[node name="FooterContainer" type="HBoxContainer" parent="Overlay/PanelContainer/VBoxContainer"]
layout_mode = 2
size_flags_vertical = 10
alignment = 1
[node name="Ok" type="Button" parent="Overlay/PanelContainer/VBoxContainer/FooterContainer"]
unique_name_in_owner = true
visible = false
layout_mode = 2
text = "OK"
[node name="Cancel" type="Button" parent="Overlay/PanelContainer/VBoxContainer/FooterContainer"]
unique_name_in_owner = true
layout_mode = 2
text = "Back"

View file

@ -0,0 +1,2 @@
@tool
extends "sierra_settings_popup.gd"

View file

@ -0,0 +1 @@
uid://8uetmksup2e7

View file

@ -0,0 +1,81 @@
[gd_scene load_steps=8 format=3 uid="uid://cp38nym5lwfy5"]
[ext_resource type="Theme" uid="uid://djl1xk7jgyvpp" path="res://game/gui/resources/gui_theme.tres" id="1_neafu"]
[ext_resource type="Script" uid="uid://deajt0yn7u242" path="res://game/gui/components/popups/popochiu_popup_custom.gd" id="2_55tnw"]
[ext_resource type="StyleBox" uid="uid://ue48aimeiar7" path="res://game/gui/components/popups/popochiu_popup_panel_container.tres" id="3_pa8o7"]
[ext_resource type="Texture2D" uid="uid://d127ve13o2kpl" path="res://game/gui/resources/images/close.png" id="4_wqufc"]
[ext_resource type="Texture2D" uid="uid://b3q226w2e3giu" path="res://game/gui/resources/images/close_highlight.png" id="5_3y1e5"]
[ext_resource type="PackedScene" uid="uid://ha1e5ahv76vv" path="res://game/gui/components/sound_volumes/sound_volumes.tscn" id="6_618p5"]
[sub_resource type="StyleBoxEmpty" id="StyleBoxEmpty_ygj01"]
[node name="SierraSoundPopup" 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_neafu")
script = ExtResource("2_55tnw")
script_name = &"SierraSoundPopup"
title = "Sound options"
[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_ygj01")
[node name="PanelContainer" type="PanelContainer" parent="Overlay"]
custom_minimum_size = Vector2(0, 140)
layout_mode = 2
size_flags_horizontal = 4
size_flags_vertical = 4
theme_override_styles/panel = ExtResource("3_pa8o7")
[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 = "Sound options"
horizontal_alignment = 1
vertical_alignment = 1
[node name="Close" type="TextureButton" parent="Overlay/PanelContainer/VBoxContainer/HeaderContainer"]
unique_name_in_owner = true
visible = false
texture_filter = 1
layout_mode = 2
size_flags_vertical = 4
texture_normal = ExtResource("4_wqufc")
texture_pressed = ExtResource("5_3y1e5")
texture_hover = ExtResource("5_3y1e5")
[node name="SoundVolumes" parent="Overlay/PanelContainer/VBoxContainer" instance=ExtResource("6_618p5")]
layout_mode = 2
[node name="FooterContainer" type="HBoxContainer" parent="Overlay/PanelContainer/VBoxContainer"]
layout_mode = 2
size_flags_vertical = 10
alignment = 1
[node name="Ok" type="Button" parent="Overlay/PanelContainer/VBoxContainer/FooterContainer"]
unique_name_in_owner = true
visible = false
layout_mode = 2
text = "OK"
[node name="Cancel" type="Button" parent="Overlay/PanelContainer/VBoxContainer/FooterContainer"]
unique_name_in_owner = true
layout_mode = 2
text = "Back"

View file

@ -0,0 +1,73 @@
extends GridContainer
const MIN_VOLUME := -30
const MUTE_VOLUME := -70
var dflt_volumes := {}
#region Godot ######################################################################################
func _ready() -> void:
# Connect to AudioManager ready signal
PopochiuUtils.e.am.ready.connect(_on_audio_manager_ready)
#endregion
#region Public #####################################################################################
func update_sliders() -> void:
for slider in $SlidersContainer.get_children():
if not slider.has_meta("bus_name"): continue
var bus_name: String = slider.get_meta("bus_name")
slider.value = PopochiuUtils.e.am.volume_settings[bus_name]
dflt_volumes[bus_name] = slider.value
func restore_last_volumes() -> void:
for slider in $SlidersContainer.get_children():
if not slider.has_meta("bus_name"): continue
var bus_name: String = slider.get_meta("bus_name")
PopochiuUtils.e.am.set_bus_volume_db(bus_name, dflt_volumes[bus_name])
#endregion
#region Private ####################################################################################
func _on_audio_manager_ready() -> void:
PopochiuUtils.e.am.load_sound_settings()
# Build sound settings UI
for bus_idx in range(AudioServer.get_bus_count()):
var bus_name := AudioServer.get_bus_name(bus_idx)
# Create the label for the slider
var label := Label.new()
label.text = bus_name
$ChannelsContainer.add_child(label)
# Create the node that will allow players to modify buses volumes
var slider = HSlider.new()
slider.min_value = MIN_VOLUME
slider.max_value = 0
slider.value = PopochiuUtils.e.am.volume_settings[bus_name]
slider.texture_filter = CanvasItem.TEXTURE_FILTER_NEAREST
slider.size_flags_horizontal = Control.SIZE_EXPAND_FILL
slider.size_flags_vertical = Control.SIZE_EXPAND_FILL
slider.custom_minimum_size.x = 120.0
slider.set_meta("bus_name", bus_name)
slider.value_changed.connect(_on_volume_slider_changed.bind(bus_name))
$SlidersContainer.add_child(slider)
# Called when a volume slider changes. It will update the volume of the [param bus_name_param] bus
# to [param value]. If the volume is set below or equal to the minimum volume, it will mute the bus.
func _on_volume_slider_changed(value: float, bus_name_param: String) -> void:
if value > MIN_VOLUME:
PopochiuUtils.e.am.set_bus_volume_db(bus_name_param, value)
else:
PopochiuUtils.e.am.set_bus_volume_db(bus_name_param, MUTE_VOLUME)
#endregion

View file

@ -0,0 +1 @@
uid://bgmxhq6qjswse

View file

@ -0,0 +1,19 @@
[gd_scene load_steps=3 format=3 uid="uid://ha1e5ahv76vv"]
[ext_resource type="Theme" uid="uid://djl1xk7jgyvpp" path="res://game/gui/resources/gui_theme.tres" id="1_ehufi"]
[ext_resource type="Script" uid="uid://bwqgmpgd1qi3" path="res://game/gui/components/sound_volumes/sound_volumes_custom.gd" id="2_11q3r"]
[node name="SoundVolumes" type="GridContainer" groups=["popochiu_gui_component"]]
size_flags_horizontal = 3
size_flags_vertical = 3
theme = ExtResource("1_ehufi")
columns = 2
script = ExtResource("2_11q3r")
[node name="ChannelsContainer" type="VBoxContainer" parent="."]
layout_mode = 2
alignment = 1
[node name="SlidersContainer" type="VBoxContainer" parent="."]
custom_minimum_size = Vector2(120, 0)
layout_mode = 2

View file

@ -0,0 +1 @@
extends "sound_volumes.gd"

View file

@ -0,0 +1 @@
uid://bwqgmpgd1qi3

View file

@ -0,0 +1,81 @@
extends Control
## Show a text in the form of GUI. Can be used to show game (or narrator)
## messages.
const DFLT_SIZE := "dflt_size"
# Used to fix a warning shown by Godot related to the anchors of the node and changing its size
# during a _ready() execution
var _can_change_size := false
@onready var rich_text_label: RichTextLabel = %RichTextLabel
#region Godot ######################################################################################
func _ready() -> void:
set_meta(DFLT_SIZE, rich_text_label.size)
# Connect to singletons signals
PopochiuUtils.g.system_text_shown.connect(_show_text)
PopochiuUtils.e.ready.connect(set.bind("_can_change_size", true))
close()
func _draw() -> void:
rich_text_label.position = get_parent().size / 2.0 - (rich_text_label.size / 2.0)
func _input(event: InputEvent) -> void:
if event.is_action_released("popochiu-skip"):
close.call_deferred()
if not PopochiuUtils.is_click_or_touch_pressed(event) or not visible:
return
accept_event()
if PopochiuUtils.get_click_or_touch_index(event) == MOUSE_BUTTON_LEFT:
close()
#endregion
#region Public #####################################################################################
func appear() -> void:
show()
set_process_input(true)
func close() -> void:
set_process_input(false)
rich_text_label.clear()
rich_text_label.text = ""
if _can_change_size:
rich_text_label.size = get_meta(DFLT_SIZE)
hide()
PopochiuUtils.g.system_text_hidden.emit()
#endregion
#region Private ####################################################################################
func _show_text(msg := "") -> void:
if PopochiuUtils.e.cutscene_skipped:
close.call_deferred()
return
rich_text_label.clear()
rich_text_label.text = ""
rich_text_label.size = get_meta(DFLT_SIZE)
rich_text_label.append_text("[center]%s[/center]" % msg)
if msg:
appear()
else:
close()
#endregion

View file

@ -0,0 +1 @@
uid://dlgryiv7jeugt

View file

@ -0,0 +1,43 @@
[gd_scene load_steps=4 format=3 uid="uid://csh5wtdwj67gi"]
[ext_resource type="Theme" uid="uid://djl1xk7jgyvpp" path="res://game/gui/resources/gui_theme.tres" id="1_lthlu"]
[ext_resource type="Script" uid="uid://cfubxbrqvbpi" path="res://game/gui/components/system_text/system_text_custom.gd" id="2_q0ndn"]
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_4eue6"]
content_margin_left = 8.0
content_margin_top = 6.0
content_margin_right = 8.0
content_margin_bottom = 6.0
bg_color = Color(0, 0, 0, 0.705882)
corner_detail = 4
anti_aliasing = false
[node name="SystemText" type="Control" groups=["popochiu_gui_component"]]
layout_mode = 3
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
mouse_filter = 2
theme = ExtResource("1_lthlu")
script = ExtResource("2_q0ndn")
[node name="RichTextLabel" type="RichTextLabel" parent="."]
unique_name_in_owner = true
layout_mode = 1
anchors_preset = 14
anchor_top = 0.5
anchor_right = 1.0
anchor_bottom = 0.5
offset_left = 33.0
offset_top = -9.0
offset_right = -33.0
offset_bottom = 9.0
grow_horizontal = 2
grow_vertical = 2
theme_override_styles/normal = SubResource("StyleBoxFlat_4eue6")
bbcode_enabled = true
text = "[center]Text from the game itself[/center]"
fit_content = true
scroll_active = false

View file

@ -0,0 +1 @@
extends "system_text.gd"

View file

@ -0,0 +1 @@
uid://cfubxbrqvbpi