void androidPlatformLoader() { ZRAndroidFilePicker.PickFile( //ZRFilePicker.Creat ( (filepath) => { TrackMap ZRTrackFile; if (!string.IsNullOrEmpty(filepath)) { string json = File.ReadAllText(filepath); try{ ZRTrackFile = TrackMap.FromJson(json); }catch (Exception e) { editor.debugLog.LogWarning(ExceptionList.openFileError.Value); return; } manager.cacheFilePath = filepath; editor.getTrackMap = ZRTrackFile; //TODO:Load its AudioClip and Background Image StartCoroutine(LoadContent(editor.getTrackMap.header)); } else { editor.debugLog.LogWarning(ExceptionList.openFileError.Value); } }); }
IEnumerator _Init() { string path = null; path = ConfigUtility.fileLoadPath( Path.Combine( temp.folderPath, temp.chunkHeader.trackMapFileCode ) ); WWW trackmap = new WWW(path); WWW texture = null; path = Path.Combine( temp.folderPath, temp.chunkHeader.backgroundFileCode ); bool hasTexture = File.Exists(path); path = ConfigUtility.fileLoadPath(path); if (hasTexture) { texture = new WWW(path); } yield return(trackmap); if (hasTexture) { yield return(texture); } trackMap = TrackMap.FromJson(trackmap.text); if (hasTexture) { m_Texture.mainTexture = texture.texture; } m_Label.text = trackMap.header.Title + " - " + trackMap.header.Artist; isInit = true; }
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); } } }
IEnumerator LoadTrackMap(GameMapTempFolder temp) { string path = ConfigUtility.fileLoadPath( Path.Combine( temp.folderPath, temp.chunkHeader.trackMapFileCode ) ); WWW trackmap = new WWW(path); //yield return trackmap; while (!trackmap.isDone) { GameLoadingDialog.getInstance.ReportProgress(trackmap.progress / 3f); yield return(null); } currentTrackMap = TrackMap.FromJson(trackmap.text); }