Files
SpineViewer/Spine/Implementations/SpineWrappers/V40/Attachments/PointAttachment40.cs
2025-05-27 15:55:10 +08:00

30 lines
1.0 KiB
C#

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Spine.SpineWrappers.Attachments;
using SpineRuntime40;
namespace Spine.Implementations.SpineWrappers.V40.Attachments
{
internal sealed class PointAttachment40(PointAttachment innerObject) :
Attachment40(innerObject),
IPointAttachment
{
private readonly PointAttachment _o = innerObject;
public override PointAttachment InnerObject => _o;
public override int ComputeWorldVertices(Spine.SpineWrappers.ISlot slot, ref float[] worldVertices)
{
if (slot is Slot40 st)
{
if (worldVertices.Length < 2) worldVertices = new float[2];
_o.ComputeWorldPosition(st.InnerObject.Bone, out worldVertices[0], out worldVertices[1]);
return 2;
}
throw new ArgumentException($"Invalid slot type. Expected {nameof(Slot40)}, but received {slot.GetType().Name}", nameof(slot));
}
}
}