//回上一層 public void GoBack() { myNativeFolderBrowser = GameObject.FindGameObjectWithTag("PathControl").GetComponentInParent <MyNativeFolderBrowser>(); if (Path.GetDirectoryName(myNativeFolderBrowser.FolderPath) != null) { myNativeFolderBrowser.FolderPath = Path.GetDirectoryName(myNativeFolderBrowser.FolderPath); } myNativeFolderBrowser.ShowFolder_Window(); }
//點擊時呼叫 public void OnPahtclick() { //傳回路徑 並打開資料夾 myNativeFolderBrowser.FolderPath = transform.name; //如果不是音樂檔案=> 進入資料夾 if (!Path.HasExtension(myNativeFolderBrowser.FolderPath)) { myNativeFolderBrowser.ShowFolder_Window(); } else if (Path.GetExtension(myNativeFolderBrowser.FolderPath) == ".mp3" || Path.GetExtension(myNativeFolderBrowser.FolderPath) == ".aif" || Path.GetExtension(myNativeFolderBrowser.FolderPath) == ".wav" || Path.GetExtension(myNativeFolderBrowser.FolderPath) == ".ogg" ) { //"file://" + string link = "file://" + myNativeFolderBrowser.FolderPath; WWW www = new WWW(link); Debug.Log("www:" + www.url); if (GM.instance.GetComponent <AudioSource>() == null) { GM.instance.gameObject.AddComponent <AudioSource>(); } GM.instance.audioSource = GM.instance.GetComponent <AudioSource>(); //讀取=>產生進度條 Instantiate(LoadBarPrefab, new Vector3(0, 0, 0), Quaternion.identity); StartCoroutine(LoadingProcess(www)); while (!www.isDone) { } GM.instance.audioSource.clip = www.GetAudioClip(); //開啟info頁面 ShowclipInfo(www); } Debug.Log(myNativeFolderBrowser.FolderPath); }