more weird dialogue code
This commit is contained in:
@@ -66,6 +66,7 @@ theme_override_font_sizes/font_size = 36
|
|||||||
text = "???"
|
text = "???"
|
||||||
|
|
||||||
[node name="panel_container" type="PanelContainer" parent="box"]
|
[node name="panel_container" type="PanelContainer" parent="box"]
|
||||||
|
visible = false
|
||||||
layout_mode = 1
|
layout_mode = 1
|
||||||
anchors_preset = 3
|
anchors_preset = 3
|
||||||
anchor_left = 1.0
|
anchor_left = 1.0
|
||||||
|
@@ -8,4 +8,4 @@
|
|||||||
[node name="first_world" parent="." instance=ExtResource("2_x8nyb")]
|
[node name="first_world" parent="." instance=ExtResource("2_x8nyb")]
|
||||||
|
|
||||||
[node name="player" parent="." instance=ExtResource("1_p5d84")]
|
[node name="player" parent="." instance=ExtResource("1_p5d84")]
|
||||||
playerName = "[rainbow]Yannik[/rainbow]"
|
playerName = "Yannik"
|
||||||
|
@@ -9,7 +9,7 @@ public partial class dialog_bubble : CanvasLayer
|
|||||||
public ArrayList dlgLines = new ArrayList();
|
public ArrayList dlgLines = new ArrayList();
|
||||||
public int dlgPointer = 0;
|
public int dlgPointer = 0;
|
||||||
public RichTextLabel richText;
|
public RichTextLabel richText;
|
||||||
public int dialogOptionsLength;
|
public int dialogOptionsLength = 1;
|
||||||
|
|
||||||
public override void _Ready()
|
public override void _Ready()
|
||||||
{
|
{
|
||||||
@@ -51,7 +51,7 @@ public partial class dialog_bubble : CanvasLayer
|
|||||||
GetNode<Timer>("typewriter_timer").Start();
|
GetNode<Timer>("typewriter_timer").Start();
|
||||||
}
|
}
|
||||||
if (Input.IsActionJustPressed("ui_cancel") && Visible) richText.VisibleCharacters = richText.Text.Length;
|
if (Input.IsActionJustPressed("ui_cancel") && Visible) richText.VisibleCharacters = richText.Text.Length;
|
||||||
if (Input.IsActionJustPressed("ui_accept") && Visible && richText.VisibleCharacters == -1 | Regex.Replace(richText.Text, @"\[[^]]+\]", "").Length <= richText.VisibleCharacters)
|
if (Input.IsActionJustPressed("ui_accept") && GetNode<PanelContainer>("box/panel_container").Visible == false && Visible && 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)
|
||||||
{
|
{
|
||||||
@@ -78,8 +78,6 @@ public partial class dialog_bubble : CanvasLayer
|
|||||||
}
|
}
|
||||||
for (int i = 0; i < dialogOptions.Length; i++)
|
for (int i = 0; i < dialogOptions.Length; i++)
|
||||||
parent.GetChild<Button>(i).Text = dialogOptions[i];
|
parent.GetChild<Button>(i).Text = dialogOptions[i];
|
||||||
|
|
||||||
//parent.GetChild<Button>(0).focus
|
|
||||||
dialogOptionsLength = dialogOptions.Length;
|
dialogOptionsLength = dialogOptions.Length;
|
||||||
}
|
}
|
||||||
}
|
}
|
@@ -1,5 +1,6 @@
|
|||||||
using Godot;
|
using Godot;
|
||||||
using System;
|
using System;
|
||||||
|
using System.Text.RegularExpressions;
|
||||||
|
|
||||||
public partial class player : CharacterBody2D
|
public partial class player : CharacterBody2D
|
||||||
{
|
{
|
||||||
@@ -14,6 +15,10 @@ public partial class player : CharacterBody2D
|
|||||||
|
|
||||||
public override void _Ready()
|
public override void _Ready()
|
||||||
{
|
{
|
||||||
|
playerName = Regex.Replace(playerName, @"\[[^]]+\]", "");
|
||||||
|
if (playerName.Length > 12)
|
||||||
|
playerName = playerName.Substring(0, 12);
|
||||||
|
|
||||||
animatedSprite = GetNode<AnimatedSprite2D>("animated_sprite_2d");
|
animatedSprite = GetNode<AnimatedSprite2D>("animated_sprite_2d");
|
||||||
rotCenter = GetNode<Marker2D>("rotation_center");
|
rotCenter = GetNode<Marker2D>("rotation_center");
|
||||||
dialogRayCast = GetNode<RayCast2D>("rotation_center/ray_cast_2d");
|
dialogRayCast = GetNode<RayCast2D>("rotation_center/ray_cast_2d");
|
||||||
|
Reference in New Issue
Block a user