First commit

This commit is contained in:
Misaki
2024-11-02 17:58:52 +09:00
commit e645a5327b
153 changed files with 3729 additions and 0 deletions

View 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();
}
}
}
}

View File

@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: fd12e23030834e319b53057fa583d67f
timeCreated: 1730427078

View 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;
}
}
}

View File

@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: a28624a4e10047f082bcff09eb2ff9c1
timeCreated: 1730492303

View 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);
}
}
}

View File

@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 2547cac4a8b34dcc9b6cccdf5e8166a7
timeCreated: 1730340835