iFactory.Godot/Temp/CollectionTest.cs

47 lines
813 B
C#

using Godot;
using System;
using System.ComponentModel;
using Godot.Collections;
namespace BITKit;
[Tool]
public partial class CollectionTest : Node
{
[Export] private Array<Node> nodes;
[Export] private Dictionary<string, Node> Dictionary;
[Export] private ProgressBar progressBar;
[Export(PropertyHint.Range, "0,1")]
private float progress
{
get => _progress;
set
{
if (Engine.IsEditorHint())
{
RequestReady();
}
if (progressBar is null) return;
_progress = value;
var newProgress = Mathf.Lerp(progressBar.MinValue, progressBar.MaxValue, value);
progressBar.Value = newProgress;
}
}
private float _progress;
[Export] private Label label;
[Export]
public string Text
{
get => label?.Text;
set
{
if (label is not null)
label.Text = value;
}
}
}