Commit 9e36fb05 authored by Szefo09's avatar Szefo09 Committed by mercury233

Fixed an issue that caused the audio to not play in folders with specific characters.

parent 2a44ac64
...@@ -963,7 +963,7 @@ public static class UIHelper ...@@ -963,7 +963,7 @@ public static class UIHelper
return; return;
} }
path = Environment.CurrentDirectory.Replace("\\", "/") + "/" + path; path = Environment.CurrentDirectory.Replace("\\", "/") + "/" + path;
path = "file:///" + path; path = new Uri(new Uri("file:///"), path).AbsolutePath;
GameObject audio_helper = Program.I().ocgcore.create_s(Program.I().mod_audio_effect); GameObject audio_helper = Program.I().ocgcore.create_s(Program.I().mod_audio_effect);
audio_helper.GetComponent<audio_helper>().play(path, Program.I().setting.soundValue()); audio_helper.GetComponent<audio_helper>().play(path, Program.I().setting.soundValue());
Program.I().destroy(audio_helper,5f); Program.I().destroy(audio_helper,5f);
......
...@@ -17,23 +17,25 @@ public class audio_helper : MonoBehaviour { ...@@ -17,23 +17,25 @@ public class audio_helper : MonoBehaviour {
} }
} }
bool played = false; bool played = false;
public void play(string u,float vol) private IEnumerator playSound(string u,float vol)
{ {
played = false; played = false;
WWW www = new WWW(u); using (WWW www = new WWW(u))
{
AudioClip ac = www.GetAudioClip(true, true); yield return www;
audioMgr.clip = ac; AudioClip ac = www.GetAudioClip(true, true);
audioMgr.clip = ac;
}
audioMgr.volume = vol; audioMgr.volume = vol;
} }
public void play(string u,float vol)
{
StartCoroutine(playSound(u, vol));
}
public void change_bgm(string str) public void change_bgm(string str)
{ {
played = false; StartCoroutine(playSound(str, 100f));
WWW www = new WWW(str);
AudioClip ac = www.GetAudioClip(true, true);
audioMgr.clip = ac;
audioMgr.loop = true; audioMgr.loop = true;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment