Daily update on 20251015-002614 by Nitload Youmu. Additional Message : Organize files of numerial math.

Signed-off-by: Nitload <YoumuLiu_NSI@whv0t.onmicrosoft.com>
This commit is contained in:
Nitload
2025-10-15 00:26:15 +08:00
parent c5eaf250ab
commit e283490525
50 changed files with 1319 additions and 1520 deletions
@@ -32,6 +32,7 @@ using StgSharp.Geometries;
using StgSharp.Graphics;
using StgSharp.Mathematics;
using StgSharp.Mathematics.Graphic;
using System;
using System.Collections.Generic;
@@ -1,36 +1,34 @@
//-----------------------------------------------------------------------
//-----------------------------------------------------------------------
// file="ButtonGroup.cs"
// Project: StgSharp
// AuthorGroup: Nitload Space
// Copyright (c) Nitload Space. All rights reserved.
// -----------------------------------------------------------------------
// file="ButtonGroup"
// Project: StgSharp
// AuthorGroup: Nitload Space
// Copyright (c) Nitload Space. All rights reserved.
//
// Permission is hereby granted, free of charge, to any person
// obtaining a copy of this software and associated documentation
// files (the “Software”), to deal in the Software without restriction,
// including without limitation the rights to use, copy, modify, merge,
// publish, distribute, sublicense, and/or sell copies of the Software,
// and to permit persons to whom the Software is furnished to do so,
// subject to the following conditions:
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in all
// copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// SOFTWARE.
//
// The above copyright notice and
// this permission notice shall be included in all copies
// or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED “AS IS”,
// WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
// ARISING FROM, OUT OF OR IN CONNECTION WITH
// THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
//-----------------------------------------------------------------------
//-----------------------------------------------------------------------
// -----------------------------------------------------------------------
// -----------------------------------------------------------------------
using StgSharp.Geometries;
using StgSharp.Graphics;
using StgSharp.Mathematics;
using StgSharp.Mathematics.Graphic;
using System;
using System.Collections.Generic;
@@ -77,16 +75,16 @@ namespace StgSharp.Controls
get => buttonList;
}
public void AddButton( TriggerButton button )
public void AddButton(TriggerButton button)
{
buttonList.Add( button );
buttonList.Add(button);
}
public abstract void Confirm();
public IEnumerator<PlainGeometryMesh> GetEnumerator()
{
foreach( TriggerButton item in buttonList ) {
foreach (TriggerButton item in buttonList) {
yield return item.Single();
}
}
@@ -94,10 +92,10 @@ namespace StgSharp.Controls
public void MoveDown()
{
TriggerButton button = current;
while( ( button.Down != null ) && button.Down.IsDisabled ) {
while ((button.Down != null) && button.Down.IsDisabled) {
button = button.Right;
}
if( current == button ) {
if (current == button) {
return;
}
current.DeHighlight();
@@ -108,10 +106,10 @@ namespace StgSharp.Controls
public void MoveLeft()
{
TriggerButton button = current;
while( ( button.Left != null ) && button.Left.IsDisabled ) {
while ((button.Left != null) && button.Left.IsDisabled) {
button = button.Left;
}
if( current == button ) {
if (current == button) {
return;
}
current.DeHighlight();
@@ -122,10 +120,10 @@ namespace StgSharp.Controls
public void MoveRight()
{
TriggerButton button = current;
while( ( button.Right != null ) && button.Right.IsDisabled ) {
while ((button.Right != null) && button.Right.IsDisabled) {
button = button.Right;
}
if( current == button ) {
if (current == button) {
return;
}
current.DeHighlight();
@@ -136,10 +134,10 @@ namespace StgSharp.Controls
public void MoveUp()
{
TriggerButton button = current;
while( ( button.Up != null ) && button.Up.IsDisabled ) {
while ((button.Up != null) && button.Up.IsDisabled) {
button = button.Right;
}
if( current == button ) {
if (current == button) {
return;
}
current.DeHighlight();
@@ -1,36 +1,34 @@
//-----------------------------------------------------------------------
//-----------------------------------------------------------------------
// file="CharacterIndexImage.cs"
// Project: StgSharp
// AuthorGroup: Nitload Space
// Copyright (c) Nitload Space. All rights reserved.
// -----------------------------------------------------------------------
// file="CharacterIndexImage"
// Project: StgSharp
// AuthorGroup: Nitload Space
// Copyright (c) Nitload Space. All rights reserved.
//
// Permission is hereby granted, free of charge, to any person
// obtaining a copy of this software and associated documentation
// files (the “Software”), to deal in the Software without restriction,
// including without limitation the rights to use, copy, modify, merge,
// publish, distribute, sublicense, and/or sell copies of the Software,
// and to permit persons to whom the Software is furnished to do so,
// subject to the following conditions:
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in all
// copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// SOFTWARE.
//
// The above copyright notice and
// this permission notice shall be included in all copies
// or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED “AS IS”,
// WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
// ARISING FROM, OUT OF OR IN CONNECTION WITH
// THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
//-----------------------------------------------------------------------
//-----------------------------------------------------------------------
// -----------------------------------------------------------------------
// -----------------------------------------------------------------------
using StgSharp.Geometries;
using StgSharp.Graphics;
using StgSharp.Mathematics;
using StgSharp.Mathematics.Graphic;
using System;
using System.Collections;
@@ -55,12 +53,12 @@ namespace StgSharp.Controls
int length,
char defaultChar,
PlainGeometryMesh tittleMesh,
IEnumerable<(char, PlainGeometryMesh)> indexEnumeration )
IEnumerable<(char, PlainGeometryMesh)> indexEnumeration)
{
this.length = length;
displayIndex = new char[length];
_tittleMesh = tittleMesh;
texIndex = indexEnumeration.ToDictionary( item => item.Item1, item => item.Item2 );
texIndex = indexEnumeration.ToDictionary(item => item.Item1, item => item.Item2);
}
public bool IsEntity
@@ -85,15 +83,16 @@ namespace StgSharp.Controls
set => throw new NotImplementedException();
}
public void Display( string message )
public void Display(string message)
{
if( string.IsNullOrEmpty( message ) ) {
if (string.IsNullOrEmpty(message)) {
message = string.Empty;
}
string result = ( message.Length >= length ) ?
message.Substring( message.Length - displayIndex.Length ) : message.PadLeft(
length, defaultChar );
string result = (message.Length >= length) ?
message.Substring(message.Length - displayIndex.Length) :
message.PadLeft(
length, defaultChar);
displayIndex = result.ToCharArray();
}
@@ -101,8 +100,8 @@ namespace StgSharp.Controls
public IEnumerator<PlainGeometryMesh> GetEnumerator()
{
yield return _tittleMesh;
foreach( char item in displayIndex ) {
yield return texIndex[ item ];
foreach (char item in displayIndex) {
yield return texIndex[item];
}
}
@@ -1,36 +1,33 @@
//-----------------------------------------------------------------------
//-----------------------------------------------------------------------
// file="ControllingIntem.cs"
// Project: StgSharp
// AuthorGroup: Nitload Space
// Copyright (c) Nitload Space. All rights reserved.
// -----------------------------------------------------------------------
// file="ControllingIntem"
// Project: StgSharp
// AuthorGroup: Nitload Space
// Copyright (c) Nitload Space. All rights reserved.
//
// Permission is hereby granted, free of charge, to any person
// obtaining a copy of this software and associated documentation
// files (the “Software”), to deal in the Software without restriction,
// including without limitation the rights to use, copy, modify, merge,
// publish, distribute, sublicense, and/or sell copies of the Software,
// and to permit persons to whom the Software is furnished to do so,
// subject to the following conditions:
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in all
// copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// SOFTWARE.
//
// The above copyright notice and
// this permission notice shall be included in all copies
// or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED “AS IS”,
// WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
// ARISING FROM, OUT OF OR IN CONNECTION WITH
// THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
//-----------------------------------------------------------------------
//-----------------------------------------------------------------------
// -----------------------------------------------------------------------
// -----------------------------------------------------------------------
using StgSharp.Geometries;
using StgSharp.Graphics;
using StgSharp.Mathematics;
using StgSharp.Mathematics.Graphic;
using System;
using System.Collections;
@@ -1,37 +1,35 @@
//-----------------------------------------------------------------------
//-----------------------------------------------------------------------
// file="DecorationBox.cs"
// Project: StgSharp
// AuthorGroup: Nitload Space
// Copyright (c) Nitload Space. All rights reserved.
// -----------------------------------------------------------------------
// file="DecorationBox"
// Project: StgSharp
// AuthorGroup: Nitload Space
// Copyright (c) Nitload Space. All rights reserved.
//
// Permission is hereby granted, free of charge, to any person
// obtaining a copy of this software and associated documentation
// files (the “Software”), to deal in the Software without restriction,
// including without limitation the rights to use, copy, modify, merge,
// publish, distribute, sublicense, and/or sell copies of the Software,
// and to permit persons to whom the Software is furnished to do so,
// subject to the following conditions:
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in all
// copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// SOFTWARE.
//
// The above copyright notice and
// this permission notice shall be included in all copies
// or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED “AS IS”,
// WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
// ARISING FROM, OUT OF OR IN CONNECTION WITH
// THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
//-----------------------------------------------------------------------
//-----------------------------------------------------------------------
// -----------------------------------------------------------------------
// -----------------------------------------------------------------------
using StgSharp.Controls;
using StgSharp.Geometries;
using StgSharp.Graphics;
using StgSharp.Mathematics;
using StgSharp.Mathematics.Graphic;
using System;
using System.Collections.Generic;
@@ -44,10 +42,10 @@ namespace StgSharp.Controls
private PlainGeometryMesh renderMesh;
public DecorationBox( Rectangle bound, Image texture, Vec2[] texCoord )
public DecorationBox(Rectangle bound, Image texture, Vec2[] texCoord)
{
renderMesh = new PlainGeometryMesh(
BoundingBox, new TextureProvider( texture, texCoord ) );
BoundingBox, new TextureProvider(texture, texCoord));
}
public bool IsEntity => true;
@@ -1,37 +1,35 @@
//-----------------------------------------------------------------------
//-----------------------------------------------------------------------
// file="MarkingLable.cs"
// Project: StgSharp
// AuthorGroup: Nitload Space
// Copyright (c) Nitload Space. All rights reserved.
// -----------------------------------------------------------------------
// file="MarkingLable"
// Project: StgSharp
// AuthorGroup: Nitload Space
// Copyright (c) Nitload Space. All rights reserved.
//
// Permission is hereby granted, free of charge, to any person
// obtaining a copy of this software and associated documentation
// files (the “Software”), to deal in the Software without restriction,
// including without limitation the rights to use, copy, modify, merge,
// publish, distribute, sublicense, and/or sell copies of the Software,
// and to permit persons to whom the Software is furnished to do so,
// subject to the following conditions:
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in all
// copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// SOFTWARE.
//
// The above copyright notice and
// this permission notice shall be included in all copies
// or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED “AS IS”,
// WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
// ARISING FROM, OUT OF OR IN CONNECTION WITH
// THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
//-----------------------------------------------------------------------
//-----------------------------------------------------------------------
// -----------------------------------------------------------------------
// -----------------------------------------------------------------------
using StgSharp.Controls;
using StgSharp.Geometries;
using StgSharp.Graphics;
using StgSharp.Mathematics;
using StgSharp.Mathematics.Graphic;
using StgSharp.Timing;
using System;
@@ -50,7 +48,7 @@ namespace StgSharp.Controls
private Vec2 _currentPosition, _movementVec;
public MarkingLabel( PlainGeometryMesh marker, TimeFunction movement )
public MarkingLabel(PlainGeometryMesh marker, TimeFunction movement)
{
this.marker = marker;
_movement = movement;
@@ -72,16 +70,16 @@ namespace StgSharp.Controls
yield return marker;
}
public void Move( Vec2 movement )
public void Move(Vec2 movement)
{
if( !_movement.IsComplete ) {
Position = _currentPosition + ( _movement.Calculate() * _movementVec );
if (!_movement.IsComplete) {
Position = _currentPosition + (_movement.Calculate() * _movementVec);
}
}
public void MoveTo( Vec2 target )
public void MoveTo(Vec2 target)
{
Move( target - Position );
Move(target - Position);
}
}
@@ -1,37 +1,35 @@
//-----------------------------------------------------------------------
//-----------------------------------------------------------------------
// file="TriggerButton.cs"
// Project: StgSharp
// AuthorGroup: Nitload Space
// Copyright (c) Nitload Space. All rights reserved.
// -----------------------------------------------------------------------
// file="TriggerButton"
// Project: StgSharp
// AuthorGroup: Nitload Space
// Copyright (c) Nitload Space. All rights reserved.
//
// Permission is hereby granted, free of charge, to any person
// obtaining a copy of this software and associated documentation
// files (the “Software”), to deal in the Software without restriction,
// including without limitation the rights to use, copy, modify, merge,
// publish, distribute, sublicense, and/or sell copies of the Software,
// and to permit persons to whom the Software is furnished to do so,
// subject to the following conditions:
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in all
// copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// SOFTWARE.
//
// The above copyright notice and
// this permission notice shall be included in all copies
// or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED “AS IS”,
// WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
// ARISING FROM, OUT OF OR IN CONNECTION WITH
// THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
//-----------------------------------------------------------------------
//-----------------------------------------------------------------------
// -----------------------------------------------------------------------
// -----------------------------------------------------------------------
using StgSharp.Controls;
using StgSharp.Geometries;
using StgSharp.Graphics;
using StgSharp.Mathematics;
using StgSharp.Mathematics.Graphic;
using System;
using System.Collections.Generic;
@@ -40,10 +38,7 @@ using System.Text;
namespace StgSharp.Controls
{
public delegate void RenderButtonTextureCallback(
ButtonStatus status,
float beginTime,
in TextureProvider texture );
public delegate void RenderButtonTextureCallback(ButtonStatus status, float beginTime, in TextureProvider texture);
public enum ButtonStatus
{
@@ -55,12 +50,12 @@ namespace StgSharp.Controls
Confirm = 0b1000,
DisableToEnable = Disable | Enable,
EnableToDisable = -( Enable | DisableToEnable ),
EnableToDisable = -(Enable | DisableToEnable),
EnableToHighlight = Enable | Highlight,
HighlightToEnable = -( Enable | Highlight ),
HighlightToEnable = -(Enable | Highlight),
HighlightToDisable = -( Highlight | Disable ),
HighlightToDisable = -(Highlight | Disable),
}
@@ -106,7 +101,7 @@ namespace StgSharp.Controls
{
add
{
if( _renderButton == null )
if (_renderButton == null)
{
_renderButton = value;
} else
@@ -116,7 +111,7 @@ namespace StgSharp.Controls
}
remove
{
if( _renderButton != null ) {
if (_renderButton != null) {
_renderButton -= value;
}
}
@@ -130,7 +125,7 @@ namespace StgSharp.Controls
public ReadOnlySpan<Vec4> TextureBox
{
get => MemoryMarshal.Cast<Vec2, Vec4>( _texture.TextureCoordinate );
get => MemoryMarshal.Cast<Vec2, Vec4>(_texture.TextureCoordinate);
}
public Rectangle BoundingBox { get; set; }
@@ -155,7 +150,7 @@ namespace StgSharp.Controls
public void DeHighlight()
{
if( CurrentStatus == ButtonStatus.Highlight ) {
if (CurrentStatus == ButtonStatus.Highlight) {
CurrentStatus = ButtonStatus.HighlightToEnable;
}
}
@@ -168,48 +163,48 @@ namespace StgSharp.Controls
ButtonStatus.Highlight => ButtonStatus.HighlightToDisable,
_ => CurrentStatus,
};
if( disableCallback != null ) {
if (disableCallback != null) {
disableCallback();
}
}
public void Enable()
{
if( CurrentStatus == ButtonStatus.Disable )
if (CurrentStatus == ButtonStatus.Disable)
{
CurrentStatus = ButtonStatus.DisableToEnable;
} else
{
return;
}
if( enableCallback != null ) {
if (enableCallback != null) {
enableCallback();
}
}
public IEnumerator<PlainGeometryMesh> GetEnumerator()
{
_renderButton( CurrentStatus, _statusBeginTime, in _texture );
yield return new PlainGeometryMesh( this.BoundingBox, _texture );
_renderButton(CurrentStatus, _statusBeginTime, in _texture);
yield return new PlainGeometryMesh(this.BoundingBox, _texture);
}
public void Highlight()
{
if( CurrentStatus == ButtonStatus.Enable )
if (CurrentStatus == ButtonStatus.Enable)
{
CurrentStatus |= ButtonStatus.EnableToHighlight;
} else
{
return;
}
if( confirmCallback != null ) {
if (confirmCallback != null) {
confirmCallback();
}
}
internal void Init( ButtonStatus status )
internal void Init(ButtonStatus status)
{
if( CurrentStatus == ButtonStatus.Error ) {
if (CurrentStatus == ButtonStatus.Error) {
CurrentStatus = status;
}
}