dialogue bug fixes
This commit is contained in:
@@ -1,17 +1,18 @@
|
|||||||
[gd_scene load_steps=4 format=3 uid="uid://bkm7365u1mm3o"]
|
[gd_scene load_steps=4 format=3 uid="uid://bkm7365u1mm3o"]
|
||||||
|
|
||||||
[ext_resource type="Script" path="res://src/scene-scripts/dialogue-system/dialog_bubble.cs" id="1_5xn2c"]
|
[ext_resource type="Script" path="res://src/scene-scripts/dialogue-system/dialog_bubble.cs" id="1_xtj1q"]
|
||||||
[ext_resource type="FontFile" uid="uid://cx6bvqk0ghmjv" path="res://assets/fonts/urbane-rounded-medium.otf" id="2_qrihj"]
|
[ext_resource type="FontFile" uid="uid://cx6bvqk0ghmjv" path="res://assets/fonts/urbane-rounded-medium.otf" id="2_qrihj"]
|
||||||
|
|
||||||
[sub_resource type="StyleBoxEmpty" id="StyleBoxEmpty_5w2xu"]
|
[sub_resource type="StyleBoxEmpty" id="StyleBoxEmpty_5w2xu"]
|
||||||
|
|
||||||
[node name="dialog_bubble" type="CanvasLayer"]
|
[node name="dialog_bubble" type="CanvasLayer"]
|
||||||
script = ExtResource("1_5xn2c")
|
script = ExtResource("1_xtj1q")
|
||||||
metadata/_edit_use_anchors_ = true
|
metadata/_edit_use_anchors_ = true
|
||||||
|
|
||||||
[node name="typewriter_timer" type="Timer" parent="."]
|
[node name="typewriter_timer" type="Timer" parent="."]
|
||||||
wait_time = 0.05
|
wait_time = 0.05
|
||||||
one_shot = true
|
one_shot = true
|
||||||
|
metadata/charsAtOnce = 60
|
||||||
|
|
||||||
[node name="box" type="ColorRect" parent="."]
|
[node name="box" type="ColorRect" parent="."]
|
||||||
anchors_preset = -1
|
anchors_preset = -1
|
||||||
|
@@ -1,6 +1,7 @@
|
|||||||
using Godot;
|
using Godot;
|
||||||
using System.Collections;
|
|
||||||
using System;
|
using System;
|
||||||
|
using System.Collections;
|
||||||
|
using System.Text.RegularExpressions;
|
||||||
|
|
||||||
public partial class dialog_bubble : CanvasLayer
|
public partial class dialog_bubble : CanvasLayer
|
||||||
{
|
{
|
||||||
@@ -12,8 +13,8 @@ public partial class dialog_bubble : CanvasLayer
|
|||||||
public override void _Ready()
|
public override void _Ready()
|
||||||
{
|
{
|
||||||
richText = GetNode<RichTextLabel>("box/rich_text_label");
|
richText = GetNode<RichTextLabel>("box/rich_text_label");
|
||||||
dlgLines.Add("Hello! I'm a debug character and...");
|
dlgLines.Add("Hello! I'm a [color=purple]debug character[/color] and...");
|
||||||
dlgLines.Add("[center][b][wave amp=50 freq=15][rainbow]This is cool test text"); //bbcode gets counted to so typewrite effect takes decades //make a seperate variable without bbcode and count that instead
|
dlgLines.Add("[center][b][wave amp=50 freq=15][rainbow]This is cool test text[/rainbow][/wave][/b][/center]"); //bbcode gets counted to so typewrite effect takes decades //make a seperate variable without bbcode and count that instead
|
||||||
}
|
}
|
||||||
public void GetDialog(string file, string title, Variant actor)
|
public void GetDialog(string file, string title, Variant actor)
|
||||||
{
|
{
|
||||||
@@ -34,12 +35,12 @@ public partial class dialog_bubble : CanvasLayer
|
|||||||
}
|
}
|
||||||
public override void _Process(double delta)
|
public override void _Process(double delta)
|
||||||
{
|
{
|
||||||
if (richText.VisibleCharacters < richText.Text.Length && GetNode<Timer>("typewriter_timer").IsStopped())
|
if (richText.VisibleCharacters < Regex.Replace(richText.Text, @"\[[^]]+\]", "").Length && GetNode<Timer>("typewriter_timer").IsStopped())
|
||||||
{
|
{
|
||||||
richText.VisibleCharacters++;
|
richText.VisibleCharacters++;
|
||||||
GetNode<Timer>("typewriter_timer").Start();
|
GetNode<Timer>("typewriter_timer").Start();
|
||||||
}
|
}
|
||||||
if (Input.IsActionJustPressed("ui_accept") && richText.VisibleCharacters == -1 | richText.Text.Length == richText.VisibleCharacters)
|
if (Input.IsActionJustPressed("ui_accept") && Visible == true && richText.VisibleCharacters == -1 | Regex.Replace(richText.Text, @"\[[^]]+\]", "").Length == richText.VisibleCharacters)
|
||||||
{
|
{
|
||||||
if (dlgPointer < dlgLines.Count && dlgLines[dlgPointer] is string)
|
if (dlgPointer < dlgLines.Count && dlgLines[dlgPointer] is string)
|
||||||
{
|
{
|
||||||
|
Reference in New Issue
Block a user