public void ShutDown() { //projectorManager.ShutdownSystem(); if (ECFile.FileExists("../Resources/ShutDown.bat")) { System.Diagnostics.Process.Start("cmd", "/C start /min " + ECFile.Path("../Resources/ShutDown.bat")); } Quit(); }
/* ============================== Save Texture ============================== */ public void SaveTexture(string path) { ECFile file = new ECFile(path); if (!file.DirectoryExists()) { file.CreateDirectory(); } byte[] pngFile = texture.EncodeToPNG(); File.WriteAllBytes(file.Path(), pngFile); }
public void LoadWav() { string[] files = ECFile.FileCounts(directory); for (int i = 0; i < files.Length; i++) { audios.Add(gameObject.AddComponent <AudioSource>()); StartCoroutine(ECFile.LoadWAV(audios[i], ECFile.Path(files[i]))); if (i >= names.Count) { nameIndex.Add(ECFile.FileName(files[i]), i); } else { nameIndex.Add(names[i], i); } } }
public override void OnInspectorGUI() { GUILayout.BeginHorizontal(); if (GUILayout.Button("Saving Path")) { string path = EditorUtility.OpenFolderPanel("Please select a folder", directory, ""); if (path.Length > 0) { ECFile store = new ECFile(path); directory = store.directory; fileName = store.file; extension = store.extension; } EditorUtility.SetDirty(editor); } GUILayout.EndHorizontal(); directory = EditorGUILayout.TextField("Path: ", directory); fileName = EditorGUILayout.TextField("Naming: ", fileName); extension = EditorGUILayout.TextField("Extension: ", extension); DrawDefaultInspector(); GUILayout.BeginHorizontal(); if (Application.isPlaying) { if (GUILayout.Button("Background")) { string path = EditorUtility.OpenFilePanel("Please pick a file", directory, extension); editor.bg = ECFile.LoadImage(path); } if (GUILayout.Button("Save")) { editor.Save(ECFile.Path(directory, fileName, extension)); } } GUILayout.EndHorizontal(); //GUILayout.BeginHorizontal(); //data = EditorGUILayout.TextField("Data", data); //EditorGUILayout.LabelField("", value); //GUILayout.EndHorizontal(); if (ECFile.Path(directory, fileName, extension) != editor.path) { editor.path = ECFile.Path(directory, fileName, extension); } }
public override void OnInspectorGUI() { //DrawDefaultInspector(); script = EditorGUILayout.ObjectField("Script", script, typeof(MonoScript), false) as MonoScript; if (script != MonoScript.FromMonoBehaviour(editor)) { script = MonoScript.FromMonoBehaviour(editor); } GUILayout.BeginHorizontal(); if (GUILayout.Button("Select Directory")) { string path = EditorUtility.OpenFolderPanel("Please select a folder", editor.directory, ""); if (path.Length > 0) { editor.directory = path; string[] files = ECFile.FileCounts(editor.directory); foreach (string f in files) { Debug.Log(ECFile.FileName(f) + "." + ECFile.Extension(f)); } Debug.Log(files.Length + " file(s) found."); } EditorUtility.SetDirty(editor); } if (editor.FileExists()) { if (GUILayout.Button("Explorer")) { string path = System.IO.Path.GetFullPath(editor.Path().Replace(@"/", @"\")); System.Diagnostics.Process.Start("explorer.exe", "/select," + path); } } GUILayout.EndHorizontal(); EditorGUILayout.LabelField("Path", EditorStyles.boldLabel); editor.directory = EditorGUILayout.TextField("Current Directory: ", editor.directory); editor.file = EditorGUILayout.TextField("Current File Name: ", editor.file); editor.extension = EditorGUILayout.TextField("Current Extension: ", editor.extension); GUILayout.BeginHorizontal(); if (GUILayout.Button("Load File")) { string path = EditorUtility.OpenFilePanel("Please pick a file", editor.directory, editor.extension); if (path.Length > 0) { editor.directory = ECFile.DirectoryName(path); editor.file = ECFile.FileName(path); editor.extension = ECFile.Extension(path); editor.GetData(); foreach (string d in editor.value) { Debug.Log(d); } } EditorUtility.SetDirty(editor); } if (editor.FileExists()) { if (GUILayout.Button("Save File")) { editor.SetData(); } } GUILayout.EndHorizontal(); EditorGUILayout.Space(); EditorGUILayout.LabelField("Data", EditorStyles.boldLabel); editor.separator = EditorGUILayout.TextField("Separator: ", editor.separator); editor.dataLength = EditorGUILayout.IntField("Number of data: ", editor.dataLength, EditorStyles.boldLabel); if (editor.data.Length != editor.dataLength) { editor.ResizeData(); } for (int i = 0; i < editor.data.Length; i++) { editor.data[i] = EditorGUILayout.TextField(" - Data Name " + (i + 1) + ": ", editor.data[i]); } if (editor.FileExists()) { GUILayout.BeginHorizontal(); if (GUILayout.Button("Clear File")) { editor.ClearFile(); } if (GUILayout.Button("Delete File")) { editor.DeleteFile(); } GUILayout.EndHorizontal(); } else { if (GUILayout.Button("Create File")) { if (!editor.DirectoryExists()) { editor.CreateDirectory(); } editor.CreateFile(); } } //GUILayout.BeginHorizontal(); //data = EditorGUILayout.TextField("Data", data); //EditorGUILayout.LabelField("", value); //GUILayout.EndHorizontal(); }