예제 #1
0
 // Update is called once per frame
 void Update()
 {
     if (Input.GetKey(KeyCode.LeftControl) && Input.GetKeyDown(KeyCode.S))
     {
         if (currentPath != null)
         {
             Debug.Log("Ctrl + S");
             OutputRootModel = new IsoMetricRootModel();
             OutputRootModel.ConvertAllLayer();
             string jsonContent = JsonUtility.ToJson(OutputRootModel);
             File.WriteAllText(currentPath, jsonContent);
         }
         else
         {
             ExportToJSONDialog();
         }
     }
 }
예제 #2
0
    public void ExportToJSONDialog()
    {
        SaveFileDialog saveDialog = new SaveFileDialog();

        saveDialog.Filter = "JSON Files |*.json";
        if (saveDialog.ShowDialog() == DialogResult.OK)
        {
            try{
                OutputRootModel.ConvertAllLayer();
                string jsonContent = JsonUtility.ToJson(OutputRootModel);
                currentPath = saveDialog.FileName;
                File.WriteAllText(saveDialog.FileName, jsonContent);
                CameraTool._isDragging = false;
                // Reset RootModel.
                OutputRootModel = new IsoMetricRootModel();
            }
            catch (Exception e)
            {
                MessageBox.Show(e.Message);
            }
        }
    }