示例#1
0
        private void LoadSystem()
        {
            string path = EditorUtility.OpenFilePanel("Load system from c# code", Application.dataPath, "cs");

            if (!File.Exists(path))
            {
                return;
            }

            var fileData = SystemReader.Read(path);

            if (fileData == null)
            {
                EditorUtility.DisplayDialog("Invalid file", "Can not load selected file", "OK");
                return;
            }

            var newNode = SystemNode.FromFile(Target, fileData);

            if (newNode == null)
            {
                EditorUtility.DisplayDialog("Invalid file", "Selected file is already loaded", "OK");
                return;
            }

            SetupNewNode(newNode);
        }