From 21c20bff1f7e096c0a757b068308e4e27a17d4f9 Mon Sep 17 00:00:00 2001 From: vaporvee Date: Sun, 12 Feb 2023 15:28:05 +0100 Subject: [PATCH] answer button now grabs focus on hover --- scenes/gui/dlg_answer_button.tscn | 10 +++++++++- src/scene-scripts/dialogue-system/dialog_bubble.cs | 3 +-- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/scenes/gui/dlg_answer_button.tscn b/scenes/gui/dlg_answer_button.tscn index 3e9ae3e..99fd9ff 100644 --- a/scenes/gui/dlg_answer_button.tscn +++ b/scenes/gui/dlg_answer_button.tscn @@ -1,4 +1,4 @@ -[gd_scene load_steps=9 format=3 uid="uid://cv87js42t1sty"] +[gd_scene load_steps=10 format=3 uid="uid://cv87js42t1sty"] [ext_resource type="FontFile" uid="uid://cx6bvqk0ghmjv" path="res://assets/fonts/urbane-rounded-medium.otf" id="1_2bkol"] [ext_resource type="Texture2D" uid="uid://boxc677b5i605" path="res://assets/textures/dialogue/circle.png" id="2_tkpfr"] @@ -18,6 +18,13 @@ content_margin_top = 8.0 resource_local_to_scene = false resource_name = "answer_buttons" +[sub_resource type="GDScript" id="GDScript_nhv51"] +resource_name = "button" +script/source = "extends Button +func _process(_delta): + if(is_hovered()): grab_focus() +" + [node name="answer_button" type="Button"] custom_minimum_size = Vector2(100, 32) theme_override_colors/icon_normal_color = Color(0, 0, 0, 0) @@ -36,3 +43,4 @@ theme_override_styles/focus = SubResource("StyleBoxEmpty_trdc6") button_group = SubResource("ButtonGroup_y8j7j") icon = ExtResource("2_tkpfr") alignment = 0 +script = SubResource("GDScript_nhv51") diff --git a/src/scene-scripts/dialogue-system/dialog_bubble.cs b/src/scene-scripts/dialogue-system/dialog_bubble.cs index 5b61f7f..ab42a09 100644 --- a/src/scene-scripts/dialogue-system/dialog_bubble.cs +++ b/src/scene-scripts/dialogue-system/dialog_bubble.cs @@ -14,8 +14,7 @@ public partial class dialog_bubble : CanvasLayer - Dont repeat the same randomized dialogue after you get asked do you need something "else" - add tree support (example: "story" key) - ability to add dialogue begin answers on the fly (special ones are colored) - they will be in a dictionary with event IDs or Dictionary keys it also needs an array wich ones are active - - focus answer button on mouse hover and add focus sounds*/ + they will be in a dictionary with event IDs or Dictionary keys it also needs an array wich ones are active*/ public override void _Ready() { richText = GetNode("box/rich_text_label");