2023-06-19 00:41:44 +08:00
|
|
|
using Godot;
|
|
|
|
using System;
|
|
|
|
|
|
|
|
namespace BITKit;
|
|
|
|
|
|
|
|
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;
|
2023-06-29 01:01:52 +08:00
|
|
|
public string Index => _index;
|
2023-06-19 00:41:44 +08:00
|
|
|
public bool AllowCursor => allowCursor;
|
|
|
|
|
|
|
|
public bool AllowInput => allowInput;
|
2023-06-29 01:01:52 +08:00
|
|
|
|
|
|
|
private string _index;
|
2023-06-19 00:41:44 +08:00
|
|
|
public virtual void OnEntry(){}
|
|
|
|
public virtual void Entry()
|
|
|
|
{
|
|
|
|
Show();
|
|
|
|
OnEntry();
|
|
|
|
}
|
|
|
|
|
|
|
|
public virtual void Exit()
|
|
|
|
{
|
|
|
|
Hide();
|
|
|
|
OnExit();
|
|
|
|
}
|
|
|
|
|
|
|
|
public virtual void OnExit(){}
|
|
|
|
|
|
|
|
public override void _Ready()
|
|
|
|
{
|
2023-06-29 01:01:52 +08:00
|
|
|
_index = GetType().FullName == typeof(UXPanel).FullName ? Name : GetType().FullName;
|
2023-06-19 00:41:44 +08:00
|
|
|
UXService.Register(this);
|
|
|
|
|
|
|
|
if (isStartPanel)
|
|
|
|
{
|
|
|
|
UXService.Open(this as IUXPanel);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
private void Open()
|
|
|
|
{
|
|
|
|
UXService.Open(this as IUXPanel);
|
|
|
|
}
|
2023-06-29 01:01:52 +08:00
|
|
|
|
|
|
|
public override void _ExitTree()
|
2023-06-19 00:41:44 +08:00
|
|
|
{
|
|
|
|
UXService.UnRegister(this);
|
|
|
|
}
|
2023-06-29 01:01:52 +08:00
|
|
|
// protected override void Dispose(bool disposing)
|
|
|
|
// {
|
|
|
|
// UXService.UnRegister(this);
|
|
|
|
// }
|
2023-06-19 00:41:44 +08:00
|
|
|
}
|