Exemple #1
0
    /// <summary>
    /// 데이터를 로드해서 로딩을 하는 함수입니다.
    /// WWW로 웹에서 다운로드 받는 데이터가 완료되면 다음 씬으로 넘어갑니다.
    /// </summary>
    /// <param name="sName"> 씬 </param>
    /// <param name="ABundleList"> 에셋 번들에서 프리펩들의 이름을 가져옵니다. </param>
    /// <returns></returns>
    private IEnumerator LoadingSpriteAnimation(string sName, params string[] ABundleList)
    {
        HLoadingSpriteCtrl SpriteCtrl = ResourcePrefabGame.GetComponent <HLoadingSpriteCtrl>();

        foreach (string sDownLoadName in ABundleList)
        {
            //sDownLoadName = AssetBundleInfoList[i].sKey;
            string sResourceSavePath = string.Empty;

#if UNITY_EDITOR
            sResourceSavePath = Application.dataPath + "/Resources/0_AssetBundles/" + sDownLoadName + ".unity3d";
#else
            sResourceSavePath = Application.persistentDataPath + "/" + sDownLoadName + ".unity3d";
#endif

            WWW downloadwww = new WWW("file:///" + sResourceSavePath);

            if (SpriteCtrl != null)
            {
                SpriteCtrl.UpdateFrame();
            }

            yield return(downloadwww);

            if (SpriteCtrl != null)
            {
                SpriteCtrl.UpdateFrame();
            }

            if (downloadwww.isDone)
            {
                int nIndex = MAssetBundleMng.I.GetAssetBundleListIndex(sDownLoadName);

                if (nIndex == -1)
                {
                    Debug.Log("Error AsssetBundle Index is -1");
                }

                MAssetBundleMng.I.AssetBundleInfoList[nIndex].BundleWWW = downloadwww;
            }
        }

        async = Application.LoadLevelAsync(sName);

        while (!async.isDone)
        {
            yield return(new WaitForEndOfFrame());

            //! 로딩 애니메이션을 Update합니다.
            if (SpriteCtrl != null)
            {
                SpriteCtrl.UpdateFrame();
            }
        }

        SpriteCtrl = null;
        Destroy(ResourcePrefabGame);
    }
Exemple #2
0
    /// <summary>
    /// 애니메이션이 재생 되면서 다음 씬의 데이터들을 로딩합니다.
    /// </summary>
    /// <param name="sName"> 씬 </param>
    /// <returns></returns>
    private IEnumerator LoadingSpriteAnimation(string sName)
    {
        HLoadingSpriteCtrl SpriteCtrl = ResourcePrefabGame.GetComponent <HLoadingSpriteCtrl>();

        async = Application.LoadLevelAsync(sName);

        while (!async.isDone)
        {
            yield return(new WaitForEndOfFrame());

            //! 로딩 애니메이션을 Update합니다.
            if (SpriteCtrl != null)
            {
                SpriteCtrl.UpdateFrame();
            }
        }

        SpriteCtrl = null;
        Destroy(ResourcePrefabGame);
    }