59 lines
1.2 KiB
C#
59 lines
1.2 KiB
C#
using Godot;
|
|
using System;
|
|
|
|
namespace BITKit.UX;
|
|
|
|
public partial class UXPanel : Control, IUXPanel
|
|
{
|
|
[Export] private bool isAnimate;
|
|
[Export] private bool allowCursor;
|
|
[Export] private bool allowInput;
|
|
[Export] private bool isStartPanel;
|
|
public bool IsAnimate => isAnimate;
|
|
public bool IsValid { get; set; }
|
|
public string Index => _index;
|
|
public bool AllowCursor => allowCursor;
|
|
|
|
public bool AllowInput => allowInput;
|
|
|
|
private string _index;
|
|
public virtual void Entry()
|
|
{
|
|
Show();
|
|
//OnEntry();
|
|
}
|
|
public virtual void Exit()
|
|
{
|
|
Hide();
|
|
//OnExit();
|
|
}
|
|
|
|
public event Action OnEntry;
|
|
public event Action OnExit;
|
|
|
|
|
|
//public virtual void OnExit(){}
|
|
|
|
public override void _Ready()
|
|
{
|
|
IsValid = true;
|
|
_index = GetType().FullName == typeof(UXPanel).FullName ? Name : GetType().FullName;
|
|
UXService.Register(this);
|
|
|
|
if (isStartPanel)
|
|
{
|
|
UXService.Open(this as IUXPanel);
|
|
}
|
|
}
|
|
private void Open()
|
|
{
|
|
UXService.Open(this as IUXPanel);
|
|
}
|
|
|
|
public override void _ExitTree()
|
|
{
|
|
UXService.UnRegister(this);
|
|
IsValid = false;
|
|
}
|
|
}
|