示例#1
0
    void WriteToData()
    {
        Debug.Log("try write... " + (data != null) + " / " + isDirty);
        if(data != null && isDirty)
        {
            int counter=0;
            data.nodes = nodes.Select((EditorNode n) => {
                var node = new graphNode();
                node.ID  = counter++;
                node.position = n.position;
                return node;
            }).ToList();
            data.edges = edges.Select((EditorConnection c)=> {
                var gc = new graphConnection();
                gc.A   = c.nodeA.ID;
                gc.B   = c.nodeB.ID;
                gc.dir = c.dir;
                gc.forced = c.forceConnection;
                gc.supressed = c.supressConnection;
                return gc;
            }).ToList();

            dataObj.Update();

            EditorUtility.SetDirty(data);
            AssetDatabase.SaveAssets();

            isDirty = false;
        }
    }
示例#2
0
 public graphNode toGraphNode()
 {
     var gn = new graphNode();
     gn.position = obj.transform.position;
     gn.ID = ID;
     return gn;
 }