MVVM rebuild complete

This commit is contained in:
Nitload
2024-07-30 09:37:25 +08:00
parent da75200347
commit d082071f2d
68 changed files with 2690 additions and 762 deletions
@@ -75,6 +75,11 @@ namespace StgSharp.Controls
private Action? confirmCallback;
#nullable restore
public TriggerButton()
{
CurrentStatus = ButtonStatus.Disable;
}
protected ButtonStatus CurrentStatus { get; set; }
private RenderButtonTextureCallback _renderButton;
@@ -101,7 +106,13 @@ namespace StgSharp.Controls
}
}
public override ReadOnlySpan<vec4d> TextureBox
internal TextureProvider Texture
{
get => _texture;
set => _texture = value;
}
public ReadOnlySpan<vec4d> TextureBox
{
get => MemoryMarshal.Cast<vec2d, vec4d>(_texture.TextureCoordinate);
}
@@ -109,7 +120,11 @@ namespace StgSharp.Controls
public bool IsHighLighted { get; internal set; }
public bool IsDisabled { get; internal set; }
public vec2d Position { get; set; }
public Rectangle BoundingBox { get; set; }
public bool IsEntity => true;
public event Action EnableEvent
{
add { enableCallback += value; }
@@ -128,6 +143,14 @@ namespace StgSharp.Controls
remove { confirmCallback -= value; }
}
internal void Init( ButtonStatus status )
{
if (CurrentStatus == ButtonStatus.Error)
{
CurrentStatus = status;
}
}
public void Enable()
{
if (CurrentStatus == ButtonStatus.Disable)
@@ -173,7 +196,7 @@ namespace StgSharp.Controls
}
}
public override IEnumerator<PlainGeometryMesh> GetEnumerator()
public IEnumerator<PlainGeometryMesh> GetEnumerator()
{
_renderButton(CurrentStatus,_statusBeginTime, in _texture);
yield return new PlainGeometryMesh(this.BoundingBox, _texture);