void Start() { foreach (Node node in graph.nodes.Where(res => res.GetId.Equals("Start"))) { NodeStack.Run(node); } }
void Work() { var t = NodeStack.getProperty("Transform", BindingFlags.Public | BindingFlags.Static | BindingFlags.Instance, T => T.PropertyType == typeof(Vector3)); t[type.index].SetValue(target.value, setting, null); }
Vector3 Evaluate() { var t = NodeStack.getProperty("Transform", BindingFlags.Public | BindingFlags.Static | BindingFlags.Instance, T => T.PropertyType == typeof(Vector3)); return((Vector3)t[type.index].GetValue(target.value, null)); }
void Update() { foreach (Node node in graph.nodes.Where(res => res.GetId.Equals("Update"))) { NodeStack.Run(node); } foreach (Node node in graph.nodes.Where(res => res.Clan.Equals("Event"))) { NodeStack.SingleRun(node); } }
protected virtual void Init(Vector2 pos, Node protoType) { NodeSkin = EffectUtility.GetGUISkinStyle("NormalSkin"); var data = NodeStack.nodes[protoType]; rect = new Rect(pos, data.Size); Title = data.Name; GetId = data.Name; Clan = protoType.Clan; NodeStack.NodeInit(this); }
public static void MapInit() { IsInit = false; NodeStack.FetchCube(); NodeInputSystem.Fetch(); ConnectionType.Fetch(); #if UNITY_EDITOR #endif IsInit = true; if (TrigInit != null) { TrigInit(); } }
void Work() { if (inputType == InputType.Down && Input.GetKeyDown(keyCode)) { NodeStack.RunNext(this); } else if (inputType == InputType.Up && Input.GetKeyUp(keyCode)) { NodeStack.RunNext(this); } else if (inputType == InputType.Press && Input.GetKey(keyCode)) { NodeStack.RunNext(this); } }
public static void Init() { IsInit = false; EditorDataMgr.Init(); NodeStack.FetchNode(); NodeInputSystem.Fetch(); ConnectionType.Fetch(); #if UNITY_EDITOR #endif IsInit = true; if (TrigInit != null) { TrigInit(); } }
void Init() { var t = NodeStack.getProperty("Transform", BindingFlags.Public | BindingFlags.Static | BindingFlags.Instance, T => T.PropertyType == typeof(Vector3)); string[] name = new string[t.Count]; int index = 0; foreach (PropertyInfo info in t) { name[index] = info.Name; index++; } index = 0; type = new EffectLPopup(index, name); }
public static Node CreateNode(Vector2 pos, string nodeId, NodeGraph graph) { #if UNITY_EDITOR Node node = NodeStack.getDefaultNode(nodeId); if (node == null) { Debug.Log("node editor running is warning!"); } var npos = EffectUtility.RectReConverting(pos, graph.curNodeState); var nodeObject = node.Create(); AssetDatabase.AddObjectToAsset(nodeObject, graph); Undo.RecordObject(nodeObject, "Add"); nodeObject.curGraph = graph; nodeObject.Init(npos, node); return(nodeObject); #else return(null); #endif }
static void DrawNodeHandle(Node node, GUISkin skin) { #if UNITY_EDITOR if (node != target) { fields = NodeStack.NodeGetAsset(NodeStack.getDefaultNode(node.GetId)); target = node; return; } EffectUtility.FormatLabel(node.Title, skin.GetStyle("HandleLabel1")); EffectUtility.FormatLabel("节点名:", skin.GetStyle("HandleLabel2")); EffectUtility.FormatTextfield(ref node.Title); foreach (FieldInfo field in fields) { var value = field.GetValue(node); EffectUtility.FormatLabel(field.Name, skin.GetStyle("HandleLabel2")); EffectUtility.FormatAssetField(ref value, field.FieldType); field.SetValue(node, value); } #endif }
static void DrawCubeHandle(Cube cube, GUISkin skin) { #if UNITY_EDITOR if (cube != target) { fields = NodeStack.NodeGetAsset(NodeStack.getDefaultNode(cube.GetId)); target = cube; return; } EffectUtility.FormatLabel(cube.Title, skin.GetStyle("HandleLabel1")); EffectUtility.FormatLabel("节点名:", skin.GetStyle("HandleLabel2")); EffectUtility.FormatTextfield(ref cube.Title); EffectUtility.FormatButton("添加组件", () => { cube.Component.Add(0); }); for (int i = 0; i < cube.Component.Count; i++) { GUILayout.BeginHorizontal(); cube.Component[i] = EffectUtility.FormatPopup(cube.Component[i], 140f, NodeStack.MonoComponentsName.ToArray()); int j = i; EffectUtility.FormatButton("除去", () => { cube.Component.RemoveAt(j); }); GUILayout.EndHorizontal(); } foreach (FieldInfo field in fields) { var value = field.GetValue(cube); EffectUtility.FormatLabel(field.Name, skin.GetStyle("HandleLabel2")); EffectUtility.FormatAssetField(ref value, field.FieldType); field.SetValue(cube, value); } #endif }