diff options
author | chai <chaifix@163.com> | 2019-08-14 22:50:43 +0800 |
---|---|---|
committer | chai <chaifix@163.com> | 2019-08-14 22:50:43 +0800 |
commit | 15740faf9fe9fe4be08965098bbf2947e096aeeb (patch) | |
tree | a730ec236656cc8cab5b13f088adfaed6bb218fb /Runtime/Graphs/UnityEngine.Graphs/Attributes.cs |
Diffstat (limited to 'Runtime/Graphs/UnityEngine.Graphs/Attributes.cs')
-rw-r--r-- | Runtime/Graphs/UnityEngine.Graphs/Attributes.cs | 96 |
1 files changed, 96 insertions, 0 deletions
diff --git a/Runtime/Graphs/UnityEngine.Graphs/Attributes.cs b/Runtime/Graphs/UnityEngine.Graphs/Attributes.cs new file mode 100644 index 0000000..1e6bca9 --- /dev/null +++ b/Runtime/Graphs/UnityEngine.Graphs/Attributes.cs @@ -0,0 +1,96 @@ +using System; + +namespace UnityEngine.Graphs.LogicGraph +{ + [AttributeUsage(AttributeTargets.Field | AttributeTargets.Property | AttributeTargets.Parameter)] + public class SettingAttribute : Attribute { } + + // TODO : should be abstract + // for almost everything logic graph related (classes, functions, variables, ...) + [AttributeUsage(AttributeTargets.Class | AttributeTargets.Method | AttributeTargets.Event | AttributeTargets.Field | AttributeTargets.Property)] + public class CodeGeneratingLogicAttribute : Attribute + { + public Type type; + public Type inputsType; + public Type stateType; + } + + // for almost everything logic graph related (classes, functions, variables, ...) + public class LogicAttribute : CodeGeneratingLogicAttribute + { + public LogicAttribute() { type = null; } + public LogicAttribute(Type type) { this.type = type; } + public LogicAttribute(Type type, Type inputsType) + { + base.type = type; + base.inputsType = inputsType; + } + public LogicAttribute(Type type, Type inputsType, Type stateType) + { + base.type = type; + base.inputsType = inputsType; + base.stateType = stateType; + } + } + + // for evaluator nodes + [AttributeUsage(AttributeTargets.Method | AttributeTargets.Class)] + public class LogicEvalAttribute : Attribute + { + public Type type; + public Type stateType; + + public LogicEvalAttribute() { type = null; } + public LogicEvalAttribute(Type type) { this.type = type; } + public LogicEvalAttribute(Type type, Type stateType) + { + this.type = type; + this.stateType = stateType; + } + } + + [AttributeUsage(AttributeTargets.Method | AttributeTargets.Property | AttributeTargets.Field)] + public class LogicExpressionAttribute: Attribute + { + public string name; + public LogicExpressionAttribute() { name = string.Empty;} + public LogicExpressionAttribute(string name) { this.name = name; } + } + + [AttributeUsage(AttributeTargets.Field | AttributeTargets.Property)] + public class LogicTargetAttribute : Attribute { } + + [AttributeUsage(AttributeTargets.Field | AttributeTargets.Property | AttributeTargets.Method | AttributeTargets.Class | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue)] + public class TitleAttribute : Attribute + { + public string title; + public TitleAttribute(string title) { this.title = title; } + } + + [AttributeUsage(AttributeTargets.Class | AttributeTargets.Method | AttributeTargets.Event | AttributeTargets.Field | AttributeTargets.Property)] + public class ValidateAttribute : Attribute + { + public string validateFunction; + public ValidateAttribute(string validateFunction) { this.validateFunction = validateFunction; } + } + + #if UNITY_ANIMATION_GRAPH + // for almost everything logic graph related (classes, functions, variables, ...) + public class AnimationLogicAttribute : CodeGeneratingLogicAttribute + { + public AnimationLogicAttribute() { type = null; } + public AnimationLogicAttribute(Type type) { base.type = type; } + public AnimationLogicAttribute(Type type, Type inputsType) + { + base.type = type; + base.inputsType = inputsType; + } + public AnimationLogicAttribute(Type type, Type inputsType, Type stateType) + { + base.type = type; + base.inputsType = inputsType; + base.stateType = stateType; + } + } + #endif +} |