添加了标识查询

This commit is contained in:
CortexCore
2023-07-03 02:34:01 +08:00
parent dd10fb59e5
commit 4967df927a
58 changed files with 2653 additions and 804 deletions

View File

@@ -0,0 +1,51 @@
using Godot;
namespace BITKit;
public interface IUXContainer
{
string Text { get; set; }
void SetText(string text);
Texture2D Icon { get; set; }
void SetIcon(Texture2D texture);
}
public partial class UXContainer:Control,IUXContainer
{
[Export] public Label label;
[Export] public RichTextLabel richTextLabel;
[Export] public Label titleLabel;
[Export] public TextureRect icon;
[Export] public Button button;
public string Text
{
get =>label is not null ? label.Text : richTextLabel.Text;
set
{
switch (label, richTextLabel)
{
case (not null, null):
label.Text = value;
break;
case (null, not null):
richTextLabel.Text = value;
break;
}
}
}
public void SetText(string text)
{
Text=text;
}
public Texture2D Icon
{
get => icon.Texture;
set => icon.Texture=value;
}
public void SetIcon(Texture2D texture)
{
Icon = texture;
}
}

View File

@@ -1,5 +1,6 @@
using Godot;
using System.Collections.Generic;
using System.Linq;
using System.Xml;
using Microsoft.Extensions.DependencyInjection;
@@ -128,6 +129,8 @@ public partial class UXService : Control
/// </summary>
private static readonly Stack<IUXPanel> TransitionPanles = new();
private static InitializationState InitializationState;
private void _Entry(IUXPanel panel)
{
@@ -140,21 +143,30 @@ public partial class UXService : Control
{
Panels.Remove(result.Index);
}
while (RegistryQueue.TryDequeue(out var result))
{
Panels.Add(result.Index, result);
result.Exit();
if (InitializationState is InitializationState.Initialized)
result.Exit();
}
if (EnableQueue.TryPop(out var next))
if (!EnableQueue.TryPop(out var next)) return;
if (InitializationState is InitializationState.None)
{
while (EnabledPanels.TryPop(out var enabledPanel))
foreach (var x in Panels)
{
enabledPanel.Exit();
x.Value.Exit();
}
next.Entry();
EnabledPanels.Push(next);
History.Push(next);
return;
InitializationState=InitializationState.Initialized;
}
while (EnabledPanels.TryPop(out var enabledPanel))
{
enabledPanel.Exit();
}
next.Entry();
EnabledPanels.Push(next);
History.Push(next);
}
}