示例#1
0
    IEnumerator LoadBundles()
    {
        while (!Caching.ready)
        {
            yield return(null);
        }
        using (WWW www = WWW.LoadFromCacheOrDownload(BundleURL, version))
        {
            Debug.Log("Sound Bundle URL => " + BundleURL);
            yield return(www);

            if (www.error != null)
            {
                Debug.Log("WWW 다운로드에 에러가 생겼습니다.:" + www.error);
            }

            AssetBundle bundle = www.assetBundle;

            Object[] SoundLoad = bundle.LoadAllAssets();
            Dictionary <SoundManager.SoundName, AudioClip> Audio = new Dictionary <SoundManager.SoundName, AudioClip>();
            for (int i = 0; i < SoundLoad.Length; i++)
            {
                AudioClip audio = (AudioClip)SoundLoad[i];

                SoundManager.SoundName name = SoundManager.SoundName.MAX;
                if (Utils.IsEnumParseName(typeof(SoundManager.SoundName), audio.name))
                {
                    name = (SoundManager.SoundName)System.Enum.Parse(typeof(SoundManager.SoundName), audio.name);
                }
                else
                {
                    name = SoundManager.SoundName.MAX;
                }

                if (name != SoundManager.SoundName.MAX)
                {
                    Audio.Add(name, audio);
                }
                else
                {
                    Debug.LogError("SoundName Error! => " + audio.name);
                }
            }

            SoundManager.instance.m_AudioClip = Audio;

            bundle.Unload(false);

            www.Dispose();
            GameDefine.IsLoadAssetBundleOK = true;

            Debug.Log("sound sucess");
        }
    }
示例#2
0
    public SoundInfo(SoundSCV csv)
    {
        if (Utils.IsEnumParseName(typeof(SoundMode), csv.Mode))
        {
            Mode = (SoundMode)Enum.Parse(typeof(SoundMode), csv.Mode);
        }
        else
        {
            Mode = SoundMode.None;
        }

        if (Utils.IsEnumParseName(typeof(SoundManager.SoundName), csv.Name))
        {
            Name = (SoundManager.SoundName)Enum.Parse(typeof(SoundManager.SoundName), csv.Name);
        }
        else
        {
            Name = SoundManager.SoundName.MAX;
        }

        Step = csv.Step;
    }