MVVM rebuild complete
This commit is contained in:
@@ -43,12 +43,16 @@ namespace StgSharp.Controls
|
||||
{
|
||||
public class BattleField : ControllingItem
|
||||
{
|
||||
public override ReadOnlySpan<vec4d> TextureBox
|
||||
public ReadOnlySpan<vec4d> TextureBox
|
||||
{
|
||||
get => throw new NotImplementedException() ;
|
||||
}
|
||||
public vec2d Position { get; set; }
|
||||
public Rectangle BoundingBox { get; set; }
|
||||
|
||||
public override IEnumerator<PlainGeometryMesh> GetEnumerator()
|
||||
public bool IsEntity => true;
|
||||
|
||||
public IEnumerator<PlainGeometryMesh> GetEnumerator()
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
@@ -53,7 +53,7 @@ namespace StgSharp.Controls
|
||||
buttonList = new List<TriggerButton>();
|
||||
}
|
||||
|
||||
public override ReadOnlySpan<vec4d> TextureBox
|
||||
public ReadOnlySpan<vec4d> TextureBox
|
||||
{
|
||||
get => throw new NotSupportedException();
|
||||
}
|
||||
@@ -63,6 +63,12 @@ namespace StgSharp.Controls
|
||||
get => current;
|
||||
}
|
||||
|
||||
public vec2d Position { get; set; }
|
||||
|
||||
public Rectangle BoundingBox { get; set; }
|
||||
|
||||
public bool IsEntity { get => false; }
|
||||
|
||||
protected List<TriggerButton> AllButton
|
||||
{
|
||||
get => buttonList;
|
||||
@@ -75,7 +81,7 @@ namespace StgSharp.Controls
|
||||
|
||||
public abstract void Confirm();
|
||||
|
||||
public override IEnumerator<PlainGeometryMesh> GetEnumerator()
|
||||
public IEnumerator<PlainGeometryMesh> GetEnumerator()
|
||||
{
|
||||
foreach (TriggerButton item in buttonList)
|
||||
{
|
||||
|
||||
@@ -20,10 +20,17 @@ namespace StgSharp.Controls
|
||||
Dictionary<char, PlainGeometryMesh> texIndex;
|
||||
PlainGeometryMesh _tittleMesh;
|
||||
|
||||
public override ReadOnlySpan<vec4d> TextureBox
|
||||
public bool IsEntity
|
||||
{
|
||||
get => true;
|
||||
}
|
||||
|
||||
public ReadOnlySpan<vec4d> TextureBox
|
||||
{
|
||||
get => throw new NotSupportedException();
|
||||
}
|
||||
public vec2d Position { get => throw new NotImplementedException(); set => throw new NotImplementedException(); }
|
||||
public Rectangle BoundingBox { get => throw new NotImplementedException(); set => throw new NotImplementedException(); }
|
||||
|
||||
public void Display(string message)
|
||||
{
|
||||
@@ -39,7 +46,7 @@ namespace StgSharp.Controls
|
||||
displayIndex = result.ToCharArray();
|
||||
}
|
||||
|
||||
public override IEnumerator<PlainGeometryMesh> GetEnumerator()
|
||||
public IEnumerator<PlainGeometryMesh> GetEnumerator()
|
||||
{
|
||||
yield return _tittleMesh;
|
||||
foreach (char item in displayIndex)
|
||||
|
||||
@@ -9,16 +9,15 @@ using System.Text;
|
||||
|
||||
namespace StgSharp.Controls
|
||||
{
|
||||
public abstract partial class ControllingItem: IEnumerable<PlainGeometryMesh>
|
||||
public interface ControllingItem: IEnumerable<PlainGeometryMesh>
|
||||
{
|
||||
public vec2d Position { get; set; }
|
||||
public abstract vec2d Position { get; set; }
|
||||
public abstract Rectangle BoundingBox { get; set; }
|
||||
|
||||
public Rectangle BoundingBox { get; set; }
|
||||
public abstract ReadOnlySpan<vec4d> TextureBox { get; }
|
||||
public abstract bool IsEntity { get; }
|
||||
|
||||
|
||||
public abstract IEnumerator<PlainGeometryMesh> GetEnumerator();
|
||||
|
||||
IEnumerator IEnumerable.GetEnumerator()
|
||||
{
|
||||
return GetEnumerator();
|
||||
|
||||
@@ -13,12 +13,17 @@ namespace StgSharp.Controls
|
||||
{
|
||||
private PlainGeometryMesh renderMesh;
|
||||
|
||||
public override ReadOnlySpan<vec4d> TextureBox
|
||||
public ReadOnlySpan<vec4d> TextureBox
|
||||
{
|
||||
get => renderMesh.TextureCoord;
|
||||
}
|
||||
|
||||
public override IEnumerator<PlainGeometryMesh> GetEnumerator()
|
||||
public vec2d Position { get ; set ; }
|
||||
public Rectangle BoundingBox { get ; set ; }
|
||||
|
||||
public bool IsEntity => true;
|
||||
|
||||
public IEnumerator<PlainGeometryMesh> GetEnumerator()
|
||||
{
|
||||
yield return renderMesh;
|
||||
}
|
||||
|
||||
@@ -12,10 +12,14 @@ namespace StgSharp.Controls
|
||||
{
|
||||
public class MarkingLabel : ControllingItem
|
||||
{
|
||||
public override ReadOnlySpan<vec4d> TextureBox
|
||||
public ReadOnlySpan<vec4d> TextureBox
|
||||
{
|
||||
get => marker.TextureCoord;
|
||||
}
|
||||
public vec2d Position { get; set; }
|
||||
public Rectangle BoundingBox { get; set; }
|
||||
|
||||
public bool IsEntity => true;
|
||||
|
||||
private vec2d _currentPosition, _movementVec;
|
||||
|
||||
@@ -41,7 +45,7 @@ namespace StgSharp.Controls
|
||||
_movement = movement;
|
||||
}
|
||||
|
||||
public override IEnumerator<PlainGeometryMesh> GetEnumerator()
|
||||
public IEnumerator<PlainGeometryMesh> GetEnumerator()
|
||||
{
|
||||
yield return marker;
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user