Changed Slot in RelayNode to ProxySlot;

Changed PullData and PushData from SlotExtension to ISlot;

Added BackTraceExecutableNode;

Removed IExecutable from RelayNode;
This commit is contained in:
Misaki
2024-11-10 12:28:12 +09:00
parent 994297a3f2
commit d3c5968a80
21 changed files with 398 additions and 281 deletions

View File

@@ -8,37 +8,76 @@ namespace Misaki.GraphView
public class ProxySlot : ISlot
{
[SerializeReference]
private ISlot _slot;
private ISlot _masterSlot;
public SlotData SlotData => _slot == null ? default : _slot.SlotData;
public List<SlotData> LinkedSlotDatas => _slot?.LinkedSlotDatas;
public bool IsLinked => LinkedSlotDatas?.Count > 0;
public DataNode Owner => _slot?.Owner;
public object Data => _slot?.Data;
[SerializeField]
private SlotData _slotData;
[SerializeField]
private List<SlotData> _linkedSlotDatas = new();
[SerializeReference]
private DataNode _owner;
public SlotData SlotData => _slotData;
public List<SlotData> LinkedSlotDatas => _linkedSlotDatas;
public bool IsLinked => _linkedSlotDatas.Count > 0;
public DataNode Owner => _owner;
public ISlot MasterSlot => _masterSlot;
public object Data => _masterSlot?.Data;
public ProxySlot(DataNode owner, SlotData slotData)
{
_owner = owner;
_slotData = slotData;
}
public void Bind(ISlot slot)
{
_slot = slot;
_masterSlot = slot;
_slotData.direction = slot.SlotData.direction;
_slotData.valueType = slot.SlotData.valueType;
}
public void Unbind()
{
_masterSlot = null;
}
public bool Link(ISlot other, out SlotConnection connection)
{
if (_slot == null)
connection = new(_slotData, other.SlotData);
if (other.SlotData.direction == _slotData.direction ||
_linkedSlotDatas.Contains(other.SlotData) ||
_masterSlot == null)
{
connection = default;
return false;
}
return _slot.Link(other, out connection);
_linkedSlotDatas.Add(other.SlotData);
return _masterSlot.Link(other, out _);
}
public void Unlink(ISlot other)
{
_slot?.Unlink(other);
_linkedSlotDatas.Remove(other.SlotData);
_masterSlot?.Unlink(other);
}
public void PullData(Action<ISlot> OnPullData)
{
_masterSlot.PullData(OnPullData);
}
public void PushData(Action<ISlot> OnPushData)
{
_masterSlot.PushData(OnPushData);
}
public void ReceiveData(object data)
{
_slot?.ReceiveData(data);
_masterSlot?.ReceiveData(data);
}
}
}