First commit 🎉
This commit is contained in:
commit
43ea213f9b
728 changed files with 37080 additions and 0 deletions
|
@ -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
|
|
@ -0,0 +1 @@
|
|||
uid://mts5xfg7vhp1
|
|
@ -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
|
|
@ -0,0 +1 @@
|
|||
extends "dialog_menu_option.gd"
|
|
@ -0,0 +1 @@
|
|||
uid://ng1tegikh23s
|
Loading…
Add table
Add a link
Reference in a new issue