示例#1
0
 public static Graph FromJson(string json, IGraphListener listener)
 {
     Graph g = JsonUtility.FromJson<Graph>(json);
     listener.OnCreate(g);
     g.RegisterListener(listener);
     return g;
 }
示例#2
0
 public void RegisterListener(IGraphListener listener)
 {
     this.listener = listener;
     foreach (var node in nodes)
     {
         node.RegisterListener(listener);
     }
 }
示例#3
0
        public static Graph FromJson(string json, IGraphListener listener)
        {
            Graph g = JsonUtility.FromJson <Graph>(json);

            listener.OnCreate(g);
            g.RegisterListener(listener);
            return(g);
        }
示例#4
0
 public static Graph Load(string fileName, IGraphListener listener)
 {
     if (File.Exists(fileName))
     {
         var file = File.OpenText(fileName);
         var json = file.ReadToEnd();
         file.Close();
         return(FromJson(json, listener));
     }
     else
     {
         Debug.Log("Could not Open the file: " + fileName);
         return(null);
     }
 }
示例#5
0
 public static Graph Load(string fileName, IGraphListener listener)
 {
     if(File.Exists(fileName)){
         var file = File.OpenText(fileName);
         var json = file.ReadToEnd();
         file.Close();
         Graph deserializedGraph = FromJson(json, listener);
         if (deserializedGraph.Version != BonConfig.Version)
         {
             Debug.LogWarning("You loading a graph with a different version number: " + deserializedGraph.Version +
                 " the current version is " + BonConfig.Version);
         }
         return deserializedGraph;
     } else {
         Debug.Log("Could not Open the file: " + fileName);
         return null;
     }
 }
示例#6
0
 public void RegisterListener(IGraphListener listener)
 {
     this.listener = listener;
 }
示例#7
0
 public void RegisterListener(IGraphListener listener)
 {
     this._listener = listener;
     foreach (var node in _nodes)
     {
         node.RegisterListener(listener);
     }
 }
 public BonLauncher()
 {
     _controller = new StandardGraphController();
     _graphs = new List<Graph>();
 }