IEnumerator Start() { data = new PictureData(); data.id = id; //yield return StartCoroutine(data.GetModel()); yield return(StartCoroutine(data.GetAudio(1))); yield return(StartCoroutine(data.GetText(1))); yield return(StartCoroutine(data.GetSprites())); StartCoroutine(DataStorage.Instance.Download <Picture>(this, true)); // Nhan su kien EventManager.Instance.AddListener("OnShowTime", OnEvent); EventManager.Instance.AddListener("OnFinishMoveToObject", OnEvent); EventManager.Instance.AddListener("OnEndOfView2D", OnEvent); EventManager.Instance.AddListener("OnEndOfPictureView", OnEvent); EventManager.Instance.AddListener("OnMoveToObject", OnEvent); pointOfView = transform.TransformPoint(pointOfView); //pointToLook = transform.TransformPoint(pointToLook); //Debug.Log(pointOfView); }
public IEnumerator DownLoadContent(bool isSingle = false) { if (data == null) { data = new PictureData(); data.id = id; isDownloading = true; #region Download Island Content yield return StartCoroutine(data.GetAudio(1)); AssetBundleLoadAssetOperation request = BundleManager.LoadAssetAsync(data.audioBundle[0], data.audioBundle[1], typeof(AudioClip)); if (request == null) yield break; yield return StartCoroutine(request); data.introAudio = request.GetAsset<AudioClip>(); request = BundleManager.LoadAssetAsync(data.audioBundle[2], data.audioBundle[3], typeof(AudioClip)); Debug.Log(request); if (request == null) yield break; yield return StartCoroutine(request); data.detailAudio = request.GetAsset<AudioClip>(); // ===================================== //// Download text================ //bundleName = ""; //assetName = ""; //request = null; //DBManager.Instance.GetText(id, ref bundleName, ref assetName); //request = BundleManager.LoadAssetAsync(bundleName, assetName, typeof(TextAsset)); //if (request == null) // yield break; //yield return StartCoroutine(request); ////Debug.Log(request.GetAsset<TextAsset>()); //data.text = request.GetAsset<TextAsset>(); //// ===================================== // Download sprites================ yield return StartCoroutine(data.GetSprites()); int size = data.spriteBundle.Length - 1; for (int i = 0; i < size; i += 2) { request = BundleManager.LoadAssetAsync(data.spriteBundle[i], data.spriteBundle[i + 1], typeof(Sprite)); if (request == null) yield break; yield return StartCoroutine(request); data.sprites.Add(request.GetAsset<Sprite>()); } // ===================================== data.imgTime = time; #endregion isDownloading = false; } isReady = true; if (!isSingle) EventManager.Instance.PostNotification("OnDownloadIsland", this, order + 1); }
IEnumerator Start() { data = new PictureData(); data.id = id; //yield return StartCoroutine(data.GetModel()); yield return StartCoroutine(data.GetAudio(1)); yield return StartCoroutine(data.GetText(1)); yield return StartCoroutine(data.GetSprites()); StartCoroutine(DataStorage.Instance.Download<Picture>(this, true)); // Nhan su kien EventManager.Instance.AddListener("OnShowTime", OnEvent); EventManager.Instance.AddListener("OnFinishMoveToObject", OnEvent); EventManager.Instance.AddListener("OnEndOfView2D", OnEvent); EventManager.Instance.AddListener("OnEndOfPictureView", OnEvent); EventManager.Instance.AddListener("OnMoveToObject", OnEvent); pointOfView = transform.TransformPoint(pointOfView); //pointToLook = transform.TransformPoint(pointToLook); //Debug.Log(pointOfView); }
public IEnumerator DownLoadContent(bool isSingle = false) { if (data == null) { data = new PictureData(); data.id = id; isDownloading = true; #region Download Island Content yield return(StartCoroutine(data.GetAudio(1))); AssetBundleLoadAssetOperation request = BundleManager.LoadAssetAsync(data.audioBundle[0], data.audioBundle[1], typeof(AudioClip)); if (request == null) { yield break; } yield return(StartCoroutine(request)); data.introAudio = request.GetAsset <AudioClip>(); request = BundleManager.LoadAssetAsync(data.audioBundle[2], data.audioBundle[3], typeof(AudioClip)); Debug.Log(request); if (request == null) { yield break; } yield return(StartCoroutine(request)); data.detailAudio = request.GetAsset <AudioClip>(); // ===================================== //// Download text================ //bundleName = ""; //assetName = ""; //request = null; //DBManager.Instance.GetText(id, ref bundleName, ref assetName); //request = BundleManager.LoadAssetAsync(bundleName, assetName, typeof(TextAsset)); //if (request == null) // yield break; //yield return StartCoroutine(request); ////Debug.Log(request.GetAsset<TextAsset>()); //data.text = request.GetAsset<TextAsset>(); //// ===================================== // Download sprites================ yield return(StartCoroutine(data.GetSprites())); int size = data.spriteBundle.Length - 1; for (int i = 0; i < size; i += 2) { request = BundleManager.LoadAssetAsync(data.spriteBundle[i], data.spriteBundle[i + 1], typeof(Sprite)); if (request == null) { yield break; } yield return(StartCoroutine(request)); data.sprites.Add(request.GetAsset <Sprite>()); } // ===================================== data.imgTime = time; #endregion isDownloading = false; } isReady = true; if (!isSingle) { EventManager.Instance.PostNotification("OnDownloadIsland", this, order + 1); } }