void windowsPlatformLoader() { string path = ConfigUtility.persistentDataPath + "/" + editor.getTrackMap.header.Title + TrackMap.extension; OpenFileName ofn = new OpenFileName(); ofn.structSize = Marshal.SizeOf(ofn); ofn.filter = "All Files\0*.*\0\0"; //ofn.filter = "Image (*.jpg) | *.png"; ofn.file = new string (new char[256]); ofn.maxFile = ofn.file.Length; ofn.fileTitle = new string (new char[64]); ofn.maxFileTitle = ofn.fileTitle.Length; ofn.initialDir = ConfigUtility.persistentDataPath; ofn.title = "請選擇一個圖案"; ofn.defExt = "PNG"; //ofn.flags = 0x00080000 | 0x00001000 | 0x00000800 | 0x00000200 | 0x00000008;//OFN_EXPLORER|OFN_FILEMUSTEXIST|OFN_PATHMUSTEXIST| OFN_ALLOWMULTISELECT|OFN_NOCHANGEDIR ofn.flags = 0x00080000 | 0x00001000 | 0x00000800 | 0x00000008; //OFN_EXPLORER|OFN_FILEMUSTEXIST|OFN_PATHMUSTEXIST| OFN_NOCHANGEDIR if (DllOpebFile.GetOpenFileName(ofn)) { if (!string.IsNullOrEmpty(ofn.file)) { StartCoroutine(this.LoadImage(ofn.file)); } else { editor.debugLog.LogWarning(ExceptionList.openFileError.Value); } } }
void windowsPlatformLoader() { string path = ConfigUtility.persistentDataPath + "/" + editor.getTrackMap.header.Title + TrackMap.extension; TrackMap ZRTrackFile; OpenFileName ofn = new OpenFileName(); ofn.structSize = Marshal.SizeOf(ofn); ofn.filter = "All Files\0*.*\0\0"; //ofn.filter = "MP3 audio (*.mp3) | *.mp3"; ofn.file = new string (new char[256]); ofn.maxFile = ofn.file.Length; ofn.fileTitle = new string (new char[64]); ofn.maxFileTitle = ofn.fileTitle.Length; ofn.initialDir = ConfigUtility.persistentDataPath; ofn.title = "請選擇一個" + TrackMap.extension + "檔案"; ofn.defExt = TrackMap.extension.ToUpper(); //ofn.flags = 0x00080000 | 0x00001000 | 0x00000800 | 0x00000200 | 0x00000008;//OFN_EXPLORER|OFN_FILEMUSTEXIST|OFN_PATHMUSTEXIST| OFN_ALLOWMULTISELECT|OFN_NOCHANGEDIR ofn.flags = 0x00080000 | 0x00001000 | 0x00000800 | 0x00000008; //OFN_EXPLORER|OFN_FILEMUSTEXIST|OFN_PATHMUSTEXIST| OFN_NOCHANGEDIR if (DllOpebFile.GetOpenFileName(ofn)) { if (!string.IsNullOrEmpty(ofn.file)) { string json = File.ReadAllText(ofn.file); try{ ZRTrackFile = TrackMap.FromJson(json); }catch (Exception e) { editor.debugLog.LogWarning(ExceptionList.openFileError.Value); return; } manager.cacheFilePath = ofn.file; editor.getTrackMap = ZRTrackFile; //TODO:Load its AudioClip and Background Image StartCoroutine(LoadContent(editor.getTrackMap.header)); } else { editor.debugLog.LogWarning(ExceptionList.openFileError.Value); } } }
public void openPickFile() { if (UnityEngine.Application.platform == RuntimePlatform.Android) { AndroidFilePicker.PickFile(callback); } else { var openFile = OpenFile.Open( "請選擇一個資料夾", ConfigUtility.persistentDataPath, "All Files\0*.*\0\0", "" ); if (DllOpebFile.GetOpenFileName(openFile)) { if (!string.IsNullOrEmpty(openFile.file)) { print(openFile.file); } } } }