添加了标识更新
但是只有界面没有功能
This commit is contained in:
28
BITKit/Scripts/UX/UXLineEdit.cs
Normal file
28
BITKit/Scripts/UX/UXLineEdit.cs
Normal file
@@ -0,0 +1,28 @@
|
||||
using Godot;
|
||||
using System;
|
||||
using BITKit;
|
||||
|
||||
namespace BITFactory;
|
||||
|
||||
public partial class UXLineEdit : LineEdit
|
||||
{
|
||||
[Export] private TextValidationResource textValidation;
|
||||
[Export] private RichTextLabel hints;
|
||||
|
||||
public override void _Ready()
|
||||
{
|
||||
TextChanged += OnTextChanged;
|
||||
}
|
||||
|
||||
private void OnTextChanged(string newText)
|
||||
{
|
||||
if (textValidation is not null && textValidation.IsTextValid(newText,out var errorReason) is false)
|
||||
{
|
||||
hints.Text = $"[color=red]{errorReason}[/color]";
|
||||
}
|
||||
else
|
||||
{
|
||||
hints.Text = string.Empty;
|
||||
}
|
||||
}
|
||||
}
|
@@ -22,6 +22,10 @@ public partial class UXWindowService : Control
|
||||
ShowWindow(window);
|
||||
};
|
||||
}
|
||||
if(tabs.Count>0)
|
||||
{
|
||||
ShowWindow(windows[0]);
|
||||
}
|
||||
}
|
||||
private void ShowWindow(CanvasItem window)
|
||||
{
|
||||
@@ -30,6 +34,12 @@ public partial class UXWindowService : Control
|
||||
//if(window.Visible is true && window != x)
|
||||
x.Hide();
|
||||
}
|
||||
|
||||
var index = windows.IndexOf(window as Control);
|
||||
if (index is not -1)
|
||||
{
|
||||
tabs[index].ButtonPressed = true;
|
||||
}
|
||||
window.Show();
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user