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
return;
}
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);
audio_helper.GetComponent<audio_helper>().play(path, Program.I().setting.soundValue());
Program.I().destroy(audio_helper,5f);
......
......@@ -17,23 +17,25 @@ public class audio_helper : MonoBehaviour {
}
}
bool played = false;
public void play(string u,float vol)
private IEnumerator playSound(string u,float vol)
{
played = false;
WWW www = new WWW(u);
AudioClip ac = www.GetAudioClip(true, true);
audioMgr.clip = ac;
using (WWW www = new WWW(u))
{
yield return www;
AudioClip ac = www.GetAudioClip(true, true);
audioMgr.clip = ac;
}
audioMgr.volume = vol;
}
public void play(string u,float vol)
{
StartCoroutine(playSound(u, vol));
}
public void change_bgm(string str)
{
played = false;
WWW www = new WWW(str);
AudioClip ac = www.GetAudioClip(true, true);
audioMgr.clip = ac;
StartCoroutine(playSound(str, 100f));
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