mirror of
https://github.com/Siccity/xNode.git
synced 2026-03-26 22:49:02 +08:00
!B(Node Port) Now the conversion judgment will be made, if it can be converted, it is considered to be allowed
This commit is contained in:
parent
e49753c585
commit
d705c8bdd1
@ -1,5 +1,6 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using System.ComponentModel;
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
|
|
||||||
@ -291,12 +292,25 @@ namespace XNode {
|
|||||||
else output = port;
|
else output = port;
|
||||||
// If there isn't one of each, they can't connect
|
// If there isn't one of each, they can't connect
|
||||||
if (input == null || output == null) return false;
|
if (input == null || output == null) return false;
|
||||||
|
// Check input type constraints
|
||||||
|
if (input.typeConstraint == XNode.Node.TypeConstraint.Inherited && !input.ValueType.IsAssignableFrom(output.ValueType)
|
||||||
|
// Judgment conversion
|
||||||
|
&& TypeDescriptor.GetConverter(input.ValueType).CanConvertTo(output.ValueType)) return false;
|
||||||
|
|
||||||
if (input.typeConstraint == XNode.Node.TypeConstraint.Strict && input.ValueType != output.ValueType) return false;
|
if (input.typeConstraint == XNode.Node.TypeConstraint.Strict && input.ValueType != output.ValueType) return false;
|
||||||
if (input.typeConstraint == XNode.Node.TypeConstraint.InheritedInverse && !output.ValueType.IsAssignableFrom(input.ValueType)) return false;
|
if (input.typeConstraint == XNode.Node.TypeConstraint.InheritedInverse && !output.ValueType.IsAssignableFrom(input.ValueType)
|
||||||
|
// Judgment conversion
|
||||||
|
&& TypeDescriptor.GetConverter(output.ValueType).CanConvertTo(input.ValueType)) return false;
|
||||||
|
|
||||||
// Check output type constraints
|
// Check output type constraints
|
||||||
if (output.typeConstraint == XNode.Node.TypeConstraint.Inherited && !input.ValueType.IsAssignableFrom(output.ValueType)) return false;
|
if (output.typeConstraint == XNode.Node.TypeConstraint.Inherited && !input.ValueType.IsAssignableFrom(output.ValueType)
|
||||||
|
// Judgment conversion
|
||||||
|
&& TypeDescriptor.GetConverter(input.ValueType).CanConvertTo(output.ValueType)) return false;
|
||||||
|
|
||||||
if (output.typeConstraint == XNode.Node.TypeConstraint.Strict && input.ValueType != output.ValueType) return false;
|
if (output.typeConstraint == XNode.Node.TypeConstraint.Strict && input.ValueType != output.ValueType) return false;
|
||||||
if (output.typeConstraint == XNode.Node.TypeConstraint.InheritedInverse && !output.ValueType.IsAssignableFrom(input.ValueType)) return false;
|
if (output.typeConstraint == XNode.Node.TypeConstraint.InheritedInverse && !output.ValueType.IsAssignableFrom(input.ValueType)
|
||||||
|
// Judgment conversion
|
||||||
|
&& TypeDescriptor.GetConverter(output.ValueType).CanConvertTo(input.ValueType)) return false;
|
||||||
// Success
|
// Success
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user