重构并增加HitTest
This commit is contained in:
33
Spine/Implementations/V42/Attachments/PathAttachment42.cs
Normal file
33
Spine/Implementations/V42/Attachments/PathAttachment42.cs
Normal file
@@ -0,0 +1,33 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Spine.Implementations.V42;
|
||||
using Spine.Interfaces;
|
||||
using Spine.Interfaces.Attachments;
|
||||
using SpineRuntime42;
|
||||
|
||||
namespace Spine.Implementations.V42.Attachments
|
||||
{
|
||||
internal sealed class PathAttachment42(PathAttachment innerObject) :
|
||||
Attachment42(innerObject),
|
||||
IPathAttachment
|
||||
{
|
||||
private readonly PathAttachment _o = innerObject;
|
||||
|
||||
public override PathAttachment InnerObject => _o;
|
||||
|
||||
public override int ComputeWorldVertices(ISlot slot, ref float[] worldVertices)
|
||||
{
|
||||
if (slot is Slot42 st)
|
||||
{
|
||||
var length = _o.WorldVerticesLength;
|
||||
if (worldVertices.Length < length) worldVertices = new float[length];
|
||||
_o.ComputeWorldVertices(st.InnerObject, worldVertices);
|
||||
return length;
|
||||
}
|
||||
throw new ArgumentException($"Invalid slot type. Expected {nameof(Slot42)}, but received {slot.GetType().Name}", nameof(slot));
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user