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