public void AddNode(NodeVisual n) { GameObject tmp = new GameObject("tmp"); WaitAndDo t = tmp.AddComponent <WaitAndDo>(); t.arg = n; t.act = (object arg) => { NodeVisual node = (NodeVisual)arg; serializer.Add(node.node, new Position2(node.transform.position)); serializer.PrepareForSerialization(); if (node.GetType() == typeof(GroupInputNodeVisual)) { //group input GroupInputNodeVisual nn = (GroupInputNodeVisual)node; ((GroupInputNode)nn.node).host = this; AddSortedIn(nn); UpdateInputs(); } else if (node.GetType() == typeof(GroupOutputNodeVisual)) { //group output GroupOutputNodeVisual nn = (GroupOutputNodeVisual)node; ((GroupOutputNode)nn.node).host = this; AddSortedOut(nn); UpdateOutputs(); } }; //if it's an input/output add it to the list }
public void Save() { Debug.Log("save"); InputManagerSerializer dick = new InputManagerSerializer(); for (int i = 0; i < allNodes.Count; i++) { dick.Add(allNodes[i].GetComponent <NodeVisual>().node, new Position2(allNodes[i].position)); } dick.PrepareForSerialization(); if (forceOverrideSave) { DoSave(null, dick); } else { if (File.Exists(Application.dataPath + "/Spells/" + saveName + ".SpellDic")) { //ask player if he wants to override //if not return; MsgBox.Make("A spell with this name: \"" + saveName + "\" already exists !\nDo you want to overwrite it ?\n(the old one will be lost)", new string[] { "JUST DO IT!", "Don't do it bro" }, new MsgBox.OnButtonClick[] { DoSave, DontDoSave }, new object[] { dick }); } else { DoSave(null, dick); } } }