Added C# UIWidget API

This commit is contained in:
antopilo
2024-09-11 22:58:06 -04:00
parent a5bf5d99c7
commit 596e4a484c
2 changed files with 121 additions and 27 deletions

View File

@@ -0,0 +1,93 @@
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Nuake.Net
{
[AttributeUsage(AttributeTargets.Field)]
public sealed class UIWidgetInput : Attribute
{
private bool HasDefaultValue = false;
private int DefaultValueInternalInt;
private float DefaultValueInternalFloat;
private bool DefaultValueInternalBool;
private string DefaultValueInternalString;
public UIWidgetInput(int DefaultValue)
{
DefaultValueInternalInt = DefaultValue;
HasDefaultValue = true;
}
public UIWidgetInput(float DefaultValue)
{
this.DefaultValueInternalFloat = DefaultValue;
HasDefaultValue = true;
}
public UIWidgetInput(string DefaultValue)
{
this.DefaultValueInternalString = DefaultValue;
HasDefaultValue = true;
}
public UIWidgetInput(bool DefaultValue)
{
this.DefaultValueInternalBool = DefaultValue;
HasDefaultValue = true;
}
public UIWidgetInput() { }
}
public class Style
{
protected ulong ID;
public Style(ulong id)
{
ID = id;
}
}
[AttributeUsage(AttributeTargets.Class)]
public sealed class ExternalHTML : Attribute
{
private string HTMLPath;
public ExternalHTML(string path)
{
HTMLPath = path;
}
}
public class UIWidget
{
public Style Style { get; set; }
private string HTML;
protected ulong ID { get; set; }
public UIWidget()
{ }
protected UIWidget(ulong id)
{
ID = id;
Style = new Style(id);
HTML = "";
}
public virtual void OnInit() { }
public virtual void OnTick(float dt) { }
// Events
public virtual void OnClick()
{
}
}
}