Система диалогов.
This commit is contained in:
parent
3c1619ee9f
commit
2a2399dc2c
8 changed files with 264 additions and 88 deletions
34
scripts/Dialog.cs
Normal file
34
scripts/Dialog.cs
Normal file
|
@ -0,0 +1,34 @@
|
|||
using Godot;
|
||||
using System;
|
||||
|
||||
[Tool]
|
||||
public partial class Dialog : PanelContainer
|
||||
{
|
||||
[Export] public string Text = "Placeholder text";
|
||||
[Export] public string Author = "NPC name";
|
||||
|
||||
private Label _textBox;
|
||||
private Label _authorBox;
|
||||
|
||||
// Called when the node enters the scene tree for the first time.
|
||||
public override void _Ready()
|
||||
{
|
||||
_textBox = (Label)FindChild("TextBox");
|
||||
_authorBox = (Label)FindChild("AuthorBox");
|
||||
if (!Engine.IsEditorHint())
|
||||
{
|
||||
_textBox.Text = Text;
|
||||
_authorBox.Text = Author;
|
||||
}
|
||||
}
|
||||
|
||||
// Called every frame. 'delta' is the elapsed time since the previous frame.
|
||||
public override void _Process(double delta)
|
||||
{
|
||||
if (Engine.IsEditorHint())
|
||||
{
|
||||
if (_textBox.Text != Text) _textBox.Text = Text;
|
||||
if (_authorBox.Text != Author) _authorBox.Text = Author;
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue