First commit
This commit is contained in:
15
Runtime/Helpers/BaseNodeExtension.cs
Normal file
15
Runtime/Helpers/BaseNodeExtension.cs
Normal file
@@ -0,0 +1,15 @@
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Misaki.GraphView
|
||||
{
|
||||
public static class BaseNodeExtension
|
||||
{
|
||||
public static void ClearAllExecuteFlag(this IList<BaseNode> nodes)
|
||||
{
|
||||
foreach (var node in nodes)
|
||||
{
|
||||
node.ClearExecuteFlag();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
3
Runtime/Helpers/BaseNodeExtension.cs.meta
Normal file
3
Runtime/Helpers/BaseNodeExtension.cs.meta
Normal file
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: fd12e23030834e319b53057fa583d67f
|
||||
timeCreated: 1730427078
|
||||
21
Runtime/Helpers/ReadOnlyCollectionExtension.cs
Normal file
21
Runtime/Helpers/ReadOnlyCollectionExtension.cs
Normal file
@@ -0,0 +1,21 @@
|
||||
using System;
|
||||
using System.Collections.ObjectModel;
|
||||
|
||||
namespace Misaki.GraphView
|
||||
{
|
||||
public static class ReadOnlyCollectionExtension
|
||||
{
|
||||
public static int FindIndex<T>(this ReadOnlyCollection<T> collection, Predicate<T> match)
|
||||
{
|
||||
for (var i = 0; i < collection.Count; i++)
|
||||
{
|
||||
if (match(collection[i]))
|
||||
{
|
||||
return i;
|
||||
}
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
}
|
||||
3
Runtime/Helpers/ReadOnlyCollectionExtension.cs.meta
Normal file
3
Runtime/Helpers/ReadOnlyCollectionExtension.cs.meta
Normal file
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: a28624a4e10047f082bcff09eb2ff9c1
|
||||
timeCreated: 1730492303
|
||||
30
Runtime/Helpers/SlotExtension.cs
Normal file
30
Runtime/Helpers/SlotExtension.cs
Normal file
@@ -0,0 +1,30 @@
|
||||
using System;
|
||||
|
||||
namespace Misaki.GraphView
|
||||
{
|
||||
public static class SlotExtension
|
||||
{
|
||||
/// <summary>
|
||||
/// Unlink all slots from this slot.
|
||||
/// </summary>
|
||||
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 otherSlot = slot.owner.GraphObject.GetNode(other.nodeID).GetSlot(other.slotIndex, other.direction);
|
||||
otherSlot.owner.GetSlot(other.slotIndex, other.direction)?.Unlink(slot);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get the value type of the slot data.
|
||||
/// </summary>
|
||||
/// <returns><see cref="Type"/> The type of the slot value </returns>
|
||||
public static Type GetValueType(this SlotData slotData)
|
||||
{
|
||||
return Type.GetType(slotData.valueType);
|
||||
}
|
||||
}
|
||||
}
|
||||
3
Runtime/Helpers/SlotExtension.cs.meta
Normal file
3
Runtime/Helpers/SlotExtension.cs.meta
Normal file
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 2547cac4a8b34dcc9b6cccdf5e8166a7
|
||||
timeCreated: 1730340835
|
||||
Reference in New Issue
Block a user