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,25 @@
extends "../popochiu_popup.gd"
#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

View file

@ -0,0 +1,82 @@
[gd_scene load_steps=7 format=3 uid="uid://d06okn5i6id2g"]
[ext_resource type="Theme" uid="uid://dpequqav4rjaf" path="res://addons/popochiu/engine/objects/gui/resources/base_gui_theme.tres" id="1_ck2qk"]
[ext_resource type="Script" path="res://addons/popochiu/engine/objects/gui/components/popups/confirmation_popup/confirmation_popup.gd" id="2_2ngwd"]
[ext_resource type="StyleBox" uid="uid://dbajakvkltfaj" path="res://addons/popochiu/engine/objects/gui/components/popups/popochiu_popup_panel_container.tres" id="3_jqrxu"]
[ext_resource type="Texture2D" uid="uid://cmxrewai8t2lm" path="res://addons/popochiu/engine/objects/gui/resources/images/close.png" id="3_n4smw"]
[ext_resource type="Texture2D" uid="uid://p32i25numi5e" path="res://addons/popochiu/engine/objects/gui/resources/images/close_highlight.png" id="4_4phlw"]
[sub_resource type="StyleBoxEmpty" id="StyleBoxEmpty_x73gy"]
[node name="ConfirmationPopup" 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_ck2qk")
script = ExtResource("2_2ngwd")
script_name = &"ConfirmationPopup"
title = "Confirmation"
[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_x73gy")
[node name="PanelContainer" type="PanelContainer" parent="Overlay"]
layout_mode = 2
size_flags_horizontal = 4
size_flags_vertical = 4
theme_override_styles/panel = ExtResource("3_jqrxu")
[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 = "Confirmation"
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_n4smw")
texture_pressed = ExtResource("4_4phlw")
texture_hover = ExtResource("4_4phlw")
[node name="Question" type="Label" parent="Overlay/PanelContainer/VBoxContainer"]
layout_mode = 2
size_flags_horizontal = 3
text = "Yes or No?"
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,13 @@
[gd_scene load_steps=2 format=3 uid="uid://b6dm3xvvr7dvi"]
[ext_resource type="FontFile" uid="uid://dixh1egf7k2fb" path="res://addons/popochiu/engine/objects/gui/fonts/monkeyisland_1991.ttf" id="1_o6vvl"]
[node name="DialogLine" type="RichTextLabel"]
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
size_flags_horizontal = 3
theme_override_fonts/normal_font = ExtResource("1_o6vvl")
bbcode_enabled = true
text = "Popochiu: Hi!"
fit_content = true

View file

@ -0,0 +1,13 @@
[gd_scene load_steps=2 format=3 uid="uid://2mnjw3qsi8hc"]
[ext_resource type="FontFile" uid="uid://dixh1egf7k2fb" path="res://addons/popochiu/engine/objects/gui/fonts/monkeyisland_1991.ttf" id="1_i1qxr"]
[node name="InteractionLine" type="RichTextLabel"]
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
size_flags_horizontal = 3
theme_override_fonts/normal_font = ExtResource("1_i1qxr")
bbcode_enabled = true
text = "Player [color=edf171]click[/color] Toy car"
fit_content = true

View file

@ -0,0 +1,57 @@
@tool
extends PopochiuPopup
@export var dialog_line: PackedScene = null
@export var interaction_line: PackedScene = null
@onready var lines_list: VBoxContainer = find_child("LinesList")
@onready var empty: Label = %Empty
@onready var lines_scroll: ScrollContainer = %LinesScroll
#region Godot ######################################################################################
func _ready() -> void:
super()
if Engine.is_editor_hint(): return
for c in lines_list.get_children():
(c as Control).queue_free()
#endregion
#region Virtual ####################################################################################
func _open() -> void:
if PopochiuUtils.e.history.is_empty():
empty.show()
lines_scroll.hide()
else:
empty.hide()
lines_scroll.show()
for data in PopochiuUtils.e.history:
var lbl: RichTextLabel
if data.has("character"):
lbl = dialog_line.instantiate()
lbl.text = "[color=%s]%s:[/color] %s" % [
(data.character as PopochiuCharacter).text_color.to_html(false),
(data.character as PopochiuCharacter).description,
data.text
]
else:
lbl = interaction_line.instantiate()
lbl.text = "[color=edf171]%s[/color] [color=a9ff9f]%s[/color]" % [
data.action, data.target
]
lines_list.add_child(lbl)
func _close() -> void:
for c in lines_list.get_children():
(c as Control).queue_free()
#endregion

View file

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

View file

@ -0,0 +1,115 @@
[gd_scene load_steps=12 format=3 uid="uid://dfrsiyyqncspo"]
[ext_resource type="Theme" uid="uid://dpequqav4rjaf" path="res://addons/popochiu/engine/objects/gui/resources/base_gui_theme.tres" id="1_ktant"]
[ext_resource type="Script" path="res://addons/popochiu/engine/objects/gui/components/popups/history_popup/history_popup.gd" id="2_bdgcw"]
[ext_resource type="Texture2D" uid="uid://cmxrewai8t2lm" path="res://addons/popochiu/engine/objects/gui/resources/images/close.png" id="3_6f0nr"]
[ext_resource type="PackedScene" uid="uid://b6dm3xvvr7dvi" path="res://addons/popochiu/engine/objects/gui/components/popups/history_popup/components/dialog_line.tscn" id="3_8deqt"]
[ext_resource type="Texture2D" uid="uid://p32i25numi5e" path="res://addons/popochiu/engine/objects/gui/resources/images/close_highlight.png" id="4_e8jii"]
[ext_resource type="PackedScene" uid="uid://2mnjw3qsi8hc" path="res://addons/popochiu/engine/objects/gui/components/popups/history_popup/components/interaction_line.tscn" id="4_ndekf"]
[ext_resource type="StyleBox" uid="uid://dbajakvkltfaj" path="res://addons/popochiu/engine/objects/gui/components/popups/popochiu_popup_panel_container.tres" id="5_odsj4"]
[sub_resource type="StyleBoxEmpty" id="StyleBoxEmpty_xipc1"]
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_pm06l"]
bg_color = Color(1, 1, 1, 1)
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_gr6a3"]
bg_color = Color(0.768627, 0.423529, 0.443137, 1)
border_width_left = 8
border_color = Color(0.388235, 0.607843, 1, 1)
[sub_resource type="Theme" id="Theme_cqgnt"]
VScrollBar/styles/grabber = SubResource("StyleBoxFlat_pm06l")
VScrollBar/styles/grabber_highlight = SubResource("StyleBoxFlat_pm06l")
VScrollBar/styles/grabber_pressed = SubResource("StyleBoxFlat_pm06l")
VScrollBar/styles/scroll = SubResource("StyleBoxFlat_gr6a3")
VScrollBar/styles/scroll_focus = SubResource("StyleBoxFlat_gr6a3")
[node name="HistoryPopup" 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_ktant")
script = ExtResource("2_bdgcw")
dialog_line = ExtResource("3_8deqt")
interaction_line = ExtResource("4_ndekf")
script_name = &"HistoryPopup"
title = "History"
[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_xipc1")
[node name="PanelContainer" type="PanelContainer" parent="Overlay"]
custom_minimum_size = Vector2(256, 144)
layout_mode = 2
size_flags_horizontal = 4
size_flags_vertical = 4
theme_override_styles/panel = ExtResource("5_odsj4")
[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 = "History"
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_6f0nr")
texture_pressed = ExtResource("4_e8jii")
texture_hover = ExtResource("4_e8jii")
[node name="Empty" type="Label" parent="Overlay/PanelContainer/VBoxContainer"]
unique_name_in_owner = true
layout_mode = 2
size_flags_vertical = 3
text = "Nothing to show yet"
horizontal_alignment = 1
vertical_alignment = 1
[node name="LinesScroll" type="ScrollContainer" parent="Overlay/PanelContainer/VBoxContainer"]
unique_name_in_owner = true
visible = false
layout_mode = 2
size_flags_vertical = 3
theme = SubResource("Theme_cqgnt")
[node name="LinesList" type="VBoxContainer" parent="Overlay/PanelContainer/VBoxContainer/LinesScroll"]
layout_mode = 2
size_flags_horizontal = 3
size_flags_vertical = 3
[node name="FooterContainer" type="HBoxContainer" parent="Overlay/PanelContainer/VBoxContainer"]
visible = false
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,139 @@
@tool
class_name PopochiuPopup
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://bmlrdxcv748wb

View file

@ -0,0 +1,69 @@
[gd_scene load_steps=6 format=3 uid="uid://c51xplyeuk787"]
[ext_resource type="Theme" uid="uid://dpequqav4rjaf" path="res://addons/popochiu/engine/objects/gui/resources/base_gui_theme.tres" id="1_4hfpy"]
[ext_resource type="Script" path="res://addons/popochiu/engine/objects/gui/components/popups/popochiu_popup.gd" id="2_yuv82"]
[ext_resource type="Texture2D" uid="uid://cmxrewai8t2lm" path="res://addons/popochiu/engine/objects/gui/resources/images/close.png" id="3_5rk5h"]
[ext_resource type="StyleBox" uid="uid://dbajakvkltfaj" path="res://addons/popochiu/engine/objects/gui/components/popups/popochiu_popup_panel_container.tres" id="3_co4j2"]
[ext_resource type="Texture2D" uid="uid://p32i25numi5e" path="res://addons/popochiu/engine/objects/gui/resources/images/close_highlight.png" id="4_4odj8"]
[node name="PopochiuPopup" 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_4hfpy")
script = ExtResource("2_yuv82")
[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
[node name="PanelContainer" type="PanelContainer" parent="Overlay"]
layout_mode = 2
size_flags_horizontal = 4
size_flags_vertical = 4
theme_override_styles/panel = ExtResource("3_co4j2")
[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 = "Title"
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_5rk5h")
texture_pressed = ExtResource("4_4odj8")
texture_hover = ExtResource("4_4odj8")
[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,12 @@
[gd_resource type="StyleBoxFlat" format=3 uid="uid://dbajakvkltfaj"]
[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://bqvdywnh28ces

View file

@ -0,0 +1,84 @@
[gd_scene load_steps=7 format=3 uid="uid://bnjo044fkdcq7"]
[ext_resource type="Theme" uid="uid://dpequqav4rjaf" path="res://addons/popochiu/engine/objects/gui/resources/base_gui_theme.tres" id="1_3nwvu"]
[ext_resource type="Script" path="res://addons/popochiu/engine/objects/gui/components/popups/quit_popup/quit_popup.gd" id="2_nkwwk"]
[ext_resource type="StyleBox" uid="uid://dbajakvkltfaj" path="res://addons/popochiu/engine/objects/gui/components/popups/popochiu_popup_panel_container.tres" id="3_828u5"]
[ext_resource type="Texture2D" uid="uid://cmxrewai8t2lm" path="res://addons/popochiu/engine/objects/gui/resources/images/close.png" id="3_r2fp8"]
[ext_resource type="Texture2D" uid="uid://p32i25numi5e" path="res://addons/popochiu/engine/objects/gui/resources/images/close_highlight.png" id="4_mra7q"]
[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_3nwvu")
script = ExtResource("2_nkwwk")
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_828u5")
[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("3_r2fp8")
texture_pressed = ExtResource("4_mra7q")
texture_hover = ExtResource("4_mra7q")
[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,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,100 @@
[gd_scene load_steps=7 format=3 uid="uid://cndputybyj57n"]
[ext_resource type="Theme" uid="uid://dpequqav4rjaf" path="res://addons/popochiu/engine/objects/gui/resources/base_gui_theme.tres" id="1_llqb8"]
[ext_resource type="Script" path="res://addons/popochiu/engine/objects/gui/components/popups/save_and_load_popup/save_and_load_popup.gd" id="2_m1ot6"]
[ext_resource type="StyleBox" uid="uid://dbajakvkltfaj" path="res://addons/popochiu/engine/objects/gui/components/popups/popochiu_popup_panel_container.tres" id="3_inruf"]
[ext_resource type="Texture2D" uid="uid://cmxrewai8t2lm" path="res://addons/popochiu/engine/objects/gui/resources/images/close.png" id="3_n4oyj"]
[ext_resource type="Texture2D" uid="uid://p32i25numi5e" path="res://addons/popochiu/engine/objects/gui/resources/images/close_highlight.png" id="4_jqolx"]
[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_llqb8")
script = ExtResource("2_m1ot6")
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_inruf")
[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("3_n4oyj")
texture_pressed = ExtResource("4_jqolx")
texture_hover = ExtResource("4_jqolx")
[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,16 @@
@tool
extends PopochiuPopup
@onready var sound_volumes: GridContainer = %SoundVolumes
#region Virtual ####################################################################################
func _open() -> void:
sound_volumes.update_sliders()
func _on_cancel() -> void:
sound_volumes.restore_last_volumes()
#endregion

View file

@ -0,0 +1,80 @@
[gd_scene load_steps=8 format=3 uid="uid://dwxm2p1iyhpx6"]
[ext_resource type="Theme" uid="uid://dpequqav4rjaf" path="res://addons/popochiu/engine/objects/gui/resources/base_gui_theme.tres" id="1_rwmoe"]
[ext_resource type="Script" path="res://addons/popochiu/engine/objects/gui/components/popups/sound_settings_popup/sound_settings_popup.gd" id="2_qt85i"]
[ext_resource type="Texture2D" uid="uid://cmxrewai8t2lm" path="res://addons/popochiu/engine/objects/gui/resources/images/close.png" id="3_knqsp"]
[ext_resource type="StyleBox" uid="uid://dbajakvkltfaj" path="res://addons/popochiu/engine/objects/gui/components/popups/popochiu_popup_panel_container.tres" id="3_nqnfj"]
[ext_resource type="Texture2D" uid="uid://p32i25numi5e" path="res://addons/popochiu/engine/objects/gui/resources/images/close_highlight.png" id="4_v7y6x"]
[ext_resource type="PackedScene" uid="uid://drx0r8w00ivck" path="res://addons/popochiu/engine/objects/gui/components/sound_volumes/sound_volumes.tscn" id="5_lh576"]
[sub_resource type="StyleBoxEmpty" id="StyleBoxEmpty_6mo8y"]
[node name="SoundSettingsPopup" 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_rwmoe")
script = ExtResource("2_qt85i")
script_name = &"SoundSettingsPopup"
title = "Sound Settings"
[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_6mo8y")
[node name="PanelContainer" type="PanelContainer" parent="Overlay"]
layout_mode = 2
size_flags_horizontal = 4
size_flags_vertical = 4
theme_override_styles/panel = ExtResource("3_nqnfj")
[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 Settings"
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("3_knqsp")
texture_pressed = ExtResource("4_v7y6x")
texture_hover = ExtResource("4_v7y6x")
[node name="SoundVolumes" parent="Overlay/PanelContainer/VBoxContainer" instance=ExtResource("5_lh576")]
unique_name_in_owner = true
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
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,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,151 @@
[gd_scene load_steps=13 format=3 uid="uid://de68lx1xqv7fb"]
[ext_resource type="Theme" uid="uid://dpequqav4rjaf" path="res://addons/popochiu/engine/objects/gui/resources/base_gui_theme.tres" id="1_7sq5d"]
[ext_resource type="Script" path="res://addons/popochiu/engine/objects/gui/components/popups/text_settings_popup/text_settings_popup.gd" id="2_nmcxa"]
[ext_resource type="StyleBox" uid="uid://dbajakvkltfaj" path="res://addons/popochiu/engine/objects/gui/components/popups/popochiu_popup_panel_container.tres" id="3_coq7y"]
[ext_resource type="Texture2D" uid="uid://cmxrewai8t2lm" path="res://addons/popochiu/engine/objects/gui/resources/images/close.png" id="3_rckox"]
[ext_resource type="Texture2D" uid="uid://p32i25numi5e" path="res://addons/popochiu/engine/objects/gui/resources/images/close_highlight.png" id="4_gfs8i"]
[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_7sq5d")
script = ExtResource("2_nmcxa")
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_coq7y")
[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("3_rckox")
texture_pressed = ExtResource("4_gfs8i")
texture_hover = ExtResource("4_gfs8i")
[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"