コード例 #1
0
    IEnumerator DownloadAudioFromSoundList(string displayName, string labelName, string path, string id)
    {
        using (UnityWebRequest req = UnityWebRequestMultimedia.GetAudioClip(path, AudioType.WAV))
        {
            yield return(req.SendWebRequest());

            if (req.isNetworkError || req.isHttpError)
            {
                Debug.LogError(req.error);
                yield break;
            }
            DownLoadPack newClip = new DownLoadPack();
            newClip.downloadclips = DownloadHandlerAudioClip.GetContent(req);
            newClip.labelnames    = labelName;
            ClipDownLoaded.Add(newClip);

            notdownloading = true;
            //Debug.Log(ClipDownLoaded.Count);

            //clips.Add(DownloadHandlerAudioClip.GetContent(req));
            //labelnames.Add(labelName);
            //clips_labels.Add(DownloadHandlerAudioClip.GetContent(req), labelName);
            //dictionaries.Add(clips_labels);
        }
    }
コード例 #2
0
    void UpdateAudio()
    {
        CompareTag();
        StopAudio();

        DownLoadPack downLoadPackToDelete = crossAudioList.ClipDownLoaded[0];

        //AudioClip clipToDelete = crossAudioList.clips[audioindex];
        //string lableToDelete = crossAudioList.labelnames[audioindex];
        //crossAudioList.clips.Remove(clipToDelete);
        //crossAudioList.labelnames.Remove(lableToDelete);

        crossAudioList.ClipDownLoaded.Remove(downLoadPackToDelete);
        ClipAmountsDid++;


        Debug.Log(crossAudioList.sounds.Count);
        if (ClipAmountsDid <= crossAudioList.sounds.Count)
        {
            //completepage.SetActive(false);
            loadTagList(crossAudioList.ClipDownLoaded[0].labelnames);
            UpdateTime(crossAudioList.ClipDownLoaded[0].downloadclips.length - Camera.main.GetComponent <AudioSource>().time);
        }
        else
        {
            completepage.SetActive(true);
            Debug.Log("finished");
        }
    }
コード例 #3
0
    public void SkipAudio()
    {
        StopAudio();

        DownLoadPack downLoadPackToDelete = crossAudioList.ClipDownLoaded[0];

        crossAudioList.ClipDownLoaded.Remove(downLoadPackToDelete);
        //Debug.Log(" YI gong duoshao ge"+ crossAudioList.sounds.Count + " zuole duoshao ge  " + ClipAmountsDid + " haishng duoshao ge " + crossAudioList.ClipDownLoaded.Count);
        ClipAmountsDid++;


        if (ClipAmountsDid <= crossAudioList.sounds.Count)
        {
            loadTagList(crossAudioList.ClipDownLoaded[0].labelnames);
            //StartCoroutine("DownloadAudioFromServer");
            UpdateTime(crossAudioList.ClipDownLoaded[0].downloadclips.length - Camera.main.GetComponent <AudioSource>().time);
        }
        else
        {
            completepage.SetActive(true);
            Debug.Log("finished");
        }
    }
コード例 #4
0
        public IEnumerator Load(string strFileName)
        {
            byte[] gtBytes = null;
            if (WWWDownLoaderConfig.CheckResNeedUpdate(strFileName))
            {
                DownLoadPack downloadPack = WWWDownLoader.InsertDownLoad(strFileName, CommonValue.NetStaDataDir + strFileName, DownLoadAssetType.Text, null, null, DownLoadOrderType.AfterRunning);
                if (downloadPack != null)
                {
                    while (!downloadPack.AssetReady)
                    {
                        yield return(null);
                    }
                    gtBytes = downloadPack.DataBytes;
                }
                WWWDownLoader.RemoveDownLoad(strFileName, null);
            }
            else
            {
                if (!string.IsNullOrEmpty(strFileName))
                {
                    string assetWWWPath = CommonValue.StaDataWWWDir + strFileName;
                    string assetPath    = CommonValue.StaDataDir + strFileName;
                    if (!File.Exists(assetPath))
                    {
                        assetWWWPath = CommonValue.InStaDataWWWDir + strFileName;
                        assetPath    = CommonValue.InStaDataDir + strFileName;
                    }

                    WWW www = null;
                    using (www = new WWW(assetWWWPath))
                    {
                        while (!www.isDone)
                        {
                            yield return(null);
                        }

                        if (www.error != null)
                        {
                            Debug.LogError(www.error);
                            Debug.LogError("StaticData Load Error! AssetName : " + strFileName);
                        }
                        else
                        {
                            gtBytes = www.bytes;
                        }

                        www.Dispose();
                        www = null;
                    }
                }
                else
                {
                    Debug.LogError("StaticData load error, FileName can not be null.");
                }
            }

            if (gtBytes != null)
            {
                LoadDataFromBuffer(gtBytes);
            }
            gtBytes = null;
            //Messenger.Broadcast(MessangerEventDef.LOAD_ONEASSET_FINISH, MessengerMode.DONT_REQUIRE_LISTENER);
        }