51 lines
1.0 KiB
C#
51 lines
1.0 KiB
C#
|
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;
|
||
|
public string Index => GetType().FullName == typeof(UXPanel).FullName ? Name : GetType().FullName;
|
||
|
|
||
|
public bool AllowCursor => allowCursor;
|
||
|
|
||
|
public bool AllowInput => allowInput;
|
||
|
public virtual void OnEntry(){}
|
||
|
public virtual void Entry()
|
||
|
{
|
||
|
Show();
|
||
|
OnEntry();
|
||
|
}
|
||
|
|
||
|
public virtual void Exit()
|
||
|
{
|
||
|
Hide();
|
||
|
OnExit();
|
||
|
}
|
||
|
|
||
|
public virtual void OnExit(){}
|
||
|
|
||
|
public override void _Ready()
|
||
|
{
|
||
|
UXService.Register(this);
|
||
|
|
||
|
if (isStartPanel)
|
||
|
{
|
||
|
UXService.Open(this as IUXPanel);
|
||
|
}
|
||
|
}
|
||
|
private void Open()
|
||
|
{
|
||
|
UXService.Open(this as IUXPanel);
|
||
|
}
|
||
|
protected override void Dispose(bool disposing)
|
||
|
{
|
||
|
UXService.UnRegister(this);
|
||
|
}
|
||
|
}
|