Exemplo n.º 1
0
        private void completeHandle(SAEventX e)
        {
            isLoaded = true;
            AssetResource resource = e.target as AssetResource;

            AssetsManager.bindEventHandle(resource, completeHandle, false);
            if (e.type == SAEventX.FAILED)
            {
                return;
            }

            if (gameObject.activeSelf == false)
            {
                recycle();
                return;
            }

            AudioClip clip = resource.data as AudioClip;

            if (clip != null)
            {
                _source.clip   = clip;
                _source.loop   = loop;
                _source.volume = _soundValue;
                _source.Play();
                if (loop == false)
                {
                    CallLater.Add(recycle, _source.clip.length);
                }
            }
        }
Exemplo n.º 2
0
        public void load(string url)
        {
            isLoaded = false;

            AssetResource resource = null;

            if (AssetsManager.routerResourceDelegate != null)
            {
                resource = AssetsManager.routerResourceDelegate(url, name, "sound");
            }

            if (resource == null)
            {
                resource = AssetsManager.getResource(url, LoaderXDataType.PREFAB);
            }
            AssetsManager.bindEventHandle(resource, completeHandle);
            resource.load();
        }