void OnDestroy() { foreach (var node in Constellation.GetNodes()) { if (node.NodeType as IDestroy != null) { node.OnDestroy(); } } }
public void Update(Constellation.Constellation constellation) { foreach (var node in constellation.GetNodes()) { foreach (var nodeData in NodeEditorNodes.GetNodes()) { if (node.Guid == nodeData.node.Guid) { for (var i = 0; i < node.GetAttributes().Length; i++) { if (!nodeData.IsAttributeValueChanged()) { nodeData.GetData().AttributesData[i].Value.Set(node.GetAttributes() [i].Value.GetString()); if (node.NodeType is IAttributeUpdate) { IAttributeUpdate needAttributeUpdate = node.NodeType as IAttributeUpdate; needAttributeUpdate.OnAttributesUpdate(); } } else { if (isInstance) { constellationScript.IsDifferentThanSource = true; } node.GetAttributes() [i].Value.Set(nodeData.GetData().AttributesData[i].Value); node.NodeType.Receive(nodeData.GetData().AttributesData[i].Value, new Constellation.Input("0000-0000-0000-0000", 999, true, "editor", "none")); } } } } } }
public void SetUnityObject() { foreach (var node in constellation.GetNodes()) { AddUnityObject(node); } }
public void OpenConstellationInstance(Constellation.Constellation constellation, string instanceSourcePath) { var constellationScript = ScriptableObject.CreateInstance <ConstellationScript> (); constellationScript.IsInstance = true; var path = "Assets/Constellation/Editor/EditorData/Temp/" + constellation.Name + "(Instance).asset"; if (path == null || path == "") { Script = null; return; } Script = constellationScript; AssetDatabase.CreateAsset(constellationScript, path); var nodes = constellation.GetNodes(); var links = constellation.GetLinks(); if (EditorData.CurrentInstancePath == null) { EditorData.CurrentInstancePath = new List <ConstellationInstanceObject> (); } currentInstancePath = new List <ConstellationInstanceObject> (EditorData.CurrentInstancePath); var newInstanceObject = new ConstellationInstanceObject(path, instanceSourcePath); currentInstancePath.Add(newInstanceObject); currentPath = new List <string> (EditorData.LastOpenedConstellationPath); if (!currentPath.Contains(path)) { currentPath.Insert(0, path); } else { currentPath.Remove(path); currentPath.Insert(0, path); } foreach (var node in nodes) { Script.AddNode(node); } foreach (var link in links) { Script.AddLink(link); } SaveEditorData(); }
public void SetAwakables() { if (Awakables == null) { Awakables = new List <IAwakable>(); } foreach (var node in Constellation.GetNodes()) { if (node.NodeType as IAwakable != null) { Awakables.Add(node.NodeType as IAwakable); } } }
public void Update(Constellation.Constellation constellation, ConstellationEditorEvents.EditorEvents editorEvents) { foreach (var node in constellation.GetNodes()) { foreach (var nodeData in Nodes) { if (node.Guid == nodeData.NodeData.Guid) { var changedParameters = nodeData.IsParameterValueChanged(); if (changedParameters.Length == 0) { for (var i = 0; i < node.GetParameters().Length; i++) { nodeData.NodeData.ParametersData[i].Value.Set(node.GetParameters()[i].Value.GetString()); } node.XPosition = nodeData.GetPositionX(); node.YPosition = nodeData.GetPositionY(); node.XSize = nodeData.GetSizeX(); node.YSize = nodeData.GetSizeY(); } else { for (var i = 0; i < node.GetParameters().Length; i++) { if (changedParameters.Contains(i)) { if (ConstellationScript.IsInstance) { ConstellationScript.IsDifferentThanSource = true; } node.GetParameters()[i].Value.Set(nodeData.NodeData.ParametersData[i].Value); node.NodeType.Receive(nodeData.NodeData.ParametersData[i].Value, new Constellation.Input("0000-0000-0000-0000", Parameter.ParameterInputID + i, true, "editor", "none")); if (node.NodeType is IParameterUpdate) { IParameterUpdate needAttributeUpdate = node.NodeType as IParameterUpdate; needAttributeUpdate.OnParametersUpdate(); } } } } } } } }
public void OpenConstellationInstance <T> (Constellation.Constellation constellation, string instanceSourcePath) where T : ConstellationScript { var constellationScript = ScriptableObject.CreateInstance <T>(); constellationScript.IsInstance = true; constellationScript.CanChangeType = false; var path = "Assets/Constellation/Editor/EditorData/Temp/" + constellation.Name + "(Instance).asset"; Script = constellationScript; AssetDatabase.CreateAsset(constellationScript, path); var nodes = constellation.GetNodes(); var links = constellation.GetLinks(); var newInstanceObject = new ConstellationScriptInfos(instanceSourcePath, ConstellationScriptInfos.ConstellationScriptTag.NoTag, true, path); OpenedScripts = new List <ConstellationScriptInfos>(EditorData.LastOpenedConstellationPath); if (!OpenedScripts.Contains(newInstanceObject)) { OpenedScripts.Insert(0, newInstanceObject); } else { OpenedScripts.Remove(newInstanceObject); OpenedScripts.Insert(0, newInstanceObject); } foreach (var node in nodes) { Script.AddNode(node); } foreach (var link in links) { Script.AddLink(link); } SaveEditorData(); }
public void Update(Constellation.Constellation constellation) { foreach (var node in constellation.GetNodes()) { foreach (var nodeData in Nodes) { if (node.Guid == nodeData.node.Guid) { for (var i = 0; i < node.GetAttributes().Length; i++) { if (!nodeData.IsAttributeValueChanged()) { nodeData.GetData().AttributesData[i].Value.Set(node.GetAttributes() [i].Value.GetString()); } else { node.GetAttributes() [i].Value.Set(nodeData.GetData().AttributesData[i].Value); node.NodeType.Receive(nodeData.GetData().AttributesData[i].Value, new Constellation.Input("0000-0000-0000-0000", 999, true, "editor", "none")); } } } } } }
public void SetDestroyables() { if (Destroyable == null) { Destroyable = new List <IDestroy>(); } foreach (var node in Constellation.GetNodes()) { if (node.NodeType as IDestroy != null) { Destroyable.Add(node.NodeType as IDestroy); } } }