您最多选择25个主题
主题必须以中文或者字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符
60 行
1.5 KiB
60 行
1.5 KiB
using System;
|
|
using UnityEngine;
|
|
|
|
namespace UnityEditor.Graphing
|
|
{
|
|
[Serializable]
|
|
public class Edge : IEdge
|
|
{
|
|
[SerializeField]
|
|
private SlotReference m_OutputSlot;
|
|
[SerializeField]
|
|
private SlotReference m_InputSlot;
|
|
|
|
public Edge()
|
|
{}
|
|
|
|
public Edge(SlotReference outputSlot, SlotReference inputSlot)
|
|
{
|
|
m_OutputSlot = outputSlot;
|
|
m_InputSlot = inputSlot;
|
|
}
|
|
|
|
public SlotReference outputSlot
|
|
{
|
|
get { return m_OutputSlot; }
|
|
}
|
|
|
|
public SlotReference inputSlot
|
|
{
|
|
get { return m_InputSlot; }
|
|
}
|
|
|
|
protected bool Equals(Edge other)
|
|
{
|
|
return Equals(m_OutputSlot, other.m_OutputSlot) && Equals(m_InputSlot, other.m_InputSlot);
|
|
}
|
|
|
|
public bool Equals(IEdge other)
|
|
{
|
|
return Equals(other as object);
|
|
}
|
|
|
|
public override bool Equals(object obj)
|
|
{
|
|
if (ReferenceEquals(null, obj)) return false;
|
|
if (ReferenceEquals(this, obj)) return true;
|
|
if (obj.GetType() != this.GetType()) return false;
|
|
return Equals((Edge)obj);
|
|
}
|
|
|
|
public override int GetHashCode()
|
|
{
|
|
unchecked
|
|
{
|
|
// Can't make fields readonly due to Unity serialization
|
|
return (m_OutputSlot.GetHashCode() * 397) ^ m_InputSlot.GetHashCode();
|
|
}
|
|
}
|
|
}
|
|
}
|