Пример #1
0
    public void SaveGraph(string path)
    {
        if (nodes.Count == 0)
        {
            string log = "Nothing to save";
            uiManager.AddLog(log);
            Debug.LogError(log);
            return;
        }
        Refresh();
        PetriNet petriNet = new PetriNet(nodes, edges);

        petriNet.SetCamParam(Camera.main);
        Debug.Log(petriNet.camPos + " " + petriNet.camSize);
        string jsonString = JsonUtility.ToJson(petriNet);

        Debug.Log(jsonString);
        File.WriteAllText(path, jsonString);
        //LoadGraph(0);
        string logText = "Petri net saved to " + path;

        uiManager.AddLog(logText);
        Debug.Log(logText);
    }