feat(mosstank): add VTank-style automation PoC
This commit is contained in:
parent
f6fe0f2a4f
commit
4e6e9bc9d9
212 changed files with 49462 additions and 416 deletions
47
src/AcDream.App/UI/UiMarkupTabButton.cs
Normal file
47
src/AcDream.App/UI/UiMarkupTabButton.cs
Normal file
|
|
@ -0,0 +1,47 @@
|
|||
using System.Numerics;
|
||||
|
||||
namespace AcDream.App.UI;
|
||||
|
||||
/// <summary>
|
||||
/// Compact KSML tab used by plugin windows. It deliberately uses the retained
|
||||
/// input/font path and VTank's text-strip presentation rather than introducing
|
||||
/// a plugin-owned renderer.
|
||||
/// </summary>
|
||||
public sealed class UiMarkupTabButton : UiSimpleButton
|
||||
{
|
||||
private static readonly Vector4 ActiveText =
|
||||
new(0.94f, 0.76f, 0.18f, 1f);
|
||||
private static readonly Vector4 NormalText =
|
||||
new(0.78f, 0.76f, 0.67f, 1f);
|
||||
private static readonly Vector4 DisabledText =
|
||||
new(0.34f, 0.33f, 0.29f, 1f);
|
||||
private static readonly Vector4 Underline =
|
||||
new(0.77f, 0.59f, 0.12f, 1f);
|
||||
|
||||
public Func<bool>? SelectedSource { get; set; }
|
||||
|
||||
public bool IsSelected => SelectedSource?.Invoke() ?? false;
|
||||
|
||||
public UiMarkupTabButton()
|
||||
{
|
||||
BackgroundColor = Vector4.Zero;
|
||||
BorderColor = Vector4.Zero;
|
||||
BorderThickness = 0f;
|
||||
Outline = true;
|
||||
}
|
||||
|
||||
protected override void OnTick(double deltaSeconds)
|
||||
{
|
||||
base.OnTick(deltaSeconds);
|
||||
TextColor = !Enabled
|
||||
? DisabledText
|
||||
: IsSelected ? ActiveText : NormalText;
|
||||
}
|
||||
|
||||
protected override void OnDraw(UiRenderContext ctx)
|
||||
{
|
||||
base.OnDraw(ctx);
|
||||
if (IsSelected)
|
||||
ctx.DrawFill(2f, Height - 2f, MathF.Max(0f, Width - 4f), 1f, Underline);
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue