using System;
namespace Misaki.GraphView
{
public static class SlotExtension
{
///
/// Unlink all slots from this slot.
///
public static void UnlinkAll(this Slot slot)
{
var slotCount = slot.LinkedSlotData.Count;
for (var i = 0; i < slotCount; i++)
{
var other = slot.LinkedSlotData[i];
var otherNode = slot.owner.GraphObject.GetNode(other.nodeID);
if (otherNode is ISlotContainer slotContainer)
{
slotContainer.GetSlot(other.slotIndex, other.direction)?.Unlink(slot);
}
}
}
///
/// Get the value type of the slot data.
///
/// The type of the slot value
public static Type GetValueType(this SlotData slotData)
{
return Type.GetType(slotData.valueType);
}
}
}