daily update on 20240610 by nitload youmu

This commit is contained in:
Nitload
2024-06-10 15:11:01 +08:00
parent c0093f7b5c
commit f6963b8e00
96 changed files with 2927 additions and 2290 deletions
@@ -43,6 +43,11 @@ namespace StgSharp.Controls
{
public class BattleField : ControllingItem
{
public override vec4d[] TextureBox
{
get ;
}
public override IEnumerator<PlainGeometryMesh> GetEnumerator()
{
throw new NotImplementedException();
@@ -0,0 +1,71 @@
using StgSharp.Geometries;
using StgSharp.Graphics;
using StgSharp.Math;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
namespace StgSharp.Controls
{
public class KeyboardButtonGroup : ControllingItem
{
private List<TriggerButton> buttonList;
private TriggerButton current;
public KeyboardButtonGroup()
{
buttonList = new List<TriggerButton>();
}
public void AddButton(TriggerButton button)
{
buttonList.Add(button);
}
public TriggerButton CurrentButton
{
get => current;
}
public override vec4d[] TextureBox
{
get => throw new NotSupportedException();
}
public void MoveLeft()
{
}
public void MoveRight()
{
}
public void MoveUp()
{
}
public void MoveDown()
{
}
public void Confirm()
{
}
public override IEnumerator<PlainGeometryMesh> GetEnumerator()
{
foreach (var item in buttonList)
{
yield return item.Single();
}
}
}
}
@@ -18,9 +18,13 @@ namespace StgSharp.Controls
private char defaultChar;
Dictionary<char, PlainGeometryMesh> texIndex;
PlainGeometryMesh _tittleMesh;
public override vec4d[] TextureBox
{
get => throw new NotSupportedException();
}
public void Display(string message)
{
if (string.IsNullOrEmpty(message))
@@ -35,7 +39,6 @@ namespace StgSharp.Controls
displayIndex = result.ToCharArray();
}
public override IEnumerator<PlainGeometryMesh> GetEnumerator()
{
yield return _tittleMesh;
@@ -14,6 +14,8 @@ namespace StgSharp.Controls
public vec2d Position { get; set; }
public Rectangle BoundingBox { get; set; }
public abstract vec4d[] TextureBox { get; }
public abstract IEnumerator<PlainGeometryMesh> GetEnumerator();
@@ -13,12 +13,17 @@ namespace StgSharp.Controls
{
private PlainGeometryMesh renderMesh;
public override vec4d[] TextureBox
{
get => renderMesh.TextureCoord;
}
public override IEnumerator<PlainGeometryMesh> GetEnumerator()
{
yield return renderMesh;
}
public DecorationBox(Rectangle bound, Image texture, vec2d[] texCoord)
public DecorationBox(Rectangle bound, Image texture, vec4d[] texCoord)
{
renderMesh = new PlainGeometryMesh(BoundingBox, texture, texCoord);
}
@@ -8,11 +8,14 @@ using System.Collections.Generic;
using System.ComponentModel;
using System.Text;
namespace StgSharp.Controlling.Controls
namespace StgSharp.Controls
{
public class MarkingLabel : ControllingItem
{
public vec2d Position { get; set; }
public override vec4d[] TextureBox
{
get => marker.TextureCoord;
}
private vec2d _currentPosition, _movementVec;
@@ -40,7 +43,7 @@ namespace StgSharp.Controlling.Controls
public override IEnumerator<PlainGeometryMesh> GetEnumerator()
{
throw new NotImplementedException();
yield return marker;
}
}
@@ -0,0 +1,116 @@
//-----------------------------------------------------------------------
//-----------------------------------------------------------------------
// file="TriggerButton.cs"
// 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:
//
// 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.Math;
using System;
using System.Collections.Generic;
using System.Text;
namespace StgSharp.Controls
{
public class TriggerButton : ControllingItem
{
private AnimationBuilder switchAnimationBuilder;
#nullable enable
private Action? enableAction;
private Action? disableAction;
private Action? confirmAction;
#nullable restore
public override vec4d[] TextureBox
{
get { return switchAnimationBuilder.TextureFrame.VertexStream; }
}
public bool IsHighLighted { get; internal set; }
public bool IsDisabled { get; internal set; }
public event Action EnableEvent
{
add { enableAction += value; }
remove { enableAction -= value; }
}
public event Action DisableEvent
{
add { disableAction += value; }
remove { disableAction -= value; }
}
public event Action ConfirmEvent
{
add { confirmAction += value; }
remove { confirmAction -= value; }
}
public void Enable(AnimationBuilder animation)
{
if (!IsDisabled)
{
return;
}
if (switchAnimationBuilder == null || switchAnimationBuilder.IsComplete)
{
switchAnimationBuilder = animation;
}
if( enableAction != null)enableAction();
}
public void Disable(AnimationBuilder animation)
{
if (switchAnimationBuilder == null || switchAnimationBuilder.IsComplete)
{
switchAnimationBuilder = animation;
}
if (disableAction != null) disableAction();
}
public void Highlight(AnimationBuilder animation)
{
if (switchAnimationBuilder == null || switchAnimationBuilder.IsComplete)
{
switchAnimationBuilder = animation;
}
if (confirmAction != null) confirmAction();
}
public override IEnumerator<PlainGeometryMesh> GetEnumerator()
{
yield return new PlainGeometryMesh(this.BoundingBox, switchAnimationBuilder.GetAnimationFrame(),
this.TextureBox);
}
}//----------------------------------- End of class --------------------------------------------
}