Initialize() статический публичный Метод

static public Initialize ( string manifestAssetBundleName ) : AssetBundleLoadManifestOperation
manifestAssetBundleName string
Результат AssetBundleLoadManifestOperation
    // Initialize the downloading url and AssetBundleManifest object.
    protected IEnumerator Initialize()
    {
        // Don't destroy this gameObject as we depend on it to run the loading script.
        DontDestroyOnLoad(gameObject);

        // With this code, when in-editor or using a development builds: Always use the AssetBundle Server
        // (This is very dependent on the production workflow of the project.
        //  Another approach would be to make this configurable in the standalone player.)

        /*#if DEVELOPMENT_BUILD || UNITY_EDITOR
         * AssetBundleManager.SetDevelopmentAssetBundleServer ();
         #else
         * // Use the following code if AssetBundles are side-by-side with web deployment:
         * AssetBundleManager.SetSourceAssetBundleURL(Application.dataPath + "/");
         * // Or customize the URL based on your deployment or configuration
         * //AssetBundleManager.SetSourceAssetBundleURL("http://www.MyWebsite/MyAssetBundles");
         #endif*/

        AssetBundleManager.SetSourceAssetBundleURL(Constants.urlEndpointAB);

        // Initialize AssetBundleManifest which loads the AssetBundleManifest object.
        var request = AssetBundleManager.Initialize();

        if (request != null)
        {
            yield return(StartCoroutine(request));
        }
    }
Пример #2
0
    // Initialize the downloading url and AssetBundleManifest object.
    protected IEnumerator Initialize()
    {
        // Don't destroy the game object as we base on it to run the loading script.
        DontDestroyOnLoad(gameObject);

// #if UNITY_EDITOR
//      Debug.Log ("We are " + (AssetBundleManager.SimulateAssetBundleInEditor ? "in Editor simulation mode" : "in normal mode") );
// #endif

        string platformFolderForAssetBundles = GetPlatformFolderForAssetBundles(RuntimePlatform.Android);          //Application.platform
// #if UNITY_EDITOR
//          GetPlatformFolderForAssetBundles(EditorUserBuildSettings.activeBuildTarget);
// #else
//          GetPlatformFolderForAssetBundles(Application.platform);
// #endif

        // Set base downloading url.
        string relativePath = GetRelativePath();

        AssetBundleManager.BaseDownloadingURL = relativePath + kAssetBundlesPath + platformFolderForAssetBundles + "/";

        // Initialize AssetBundleManifest which loads the AssetBundleManifest object.
        var request = AssetBundleManager.Initialize(platformFolderForAssetBundles);

        if (request != null)
        {
            yield return(StartCoroutine(request));
        }
    }
Пример #3
0
    // Initialize the downloading url and AssetBundleManifest object.
    protected IEnumerator Initialize()
    {
        // Don't destroy the game object as we base on it to run the loading script.
        DontDestroyOnLoad(gameObject);

#if UNITY_EDITOR
        Debug.Log("We are " + (AssetBundleManager.SimulateAssetBundleInEditor ? "in Editor simulation mode" : "in normal mode"));
#endif

        string platformFolderForAssetBundles =
#if UNITY_EDITOR
            GetPlatformFolderForAssetBundles(EditorUserBuildSettings.activeBuildTarget);
#else
            GetPlatformFolderForAssetBundles(Application.platform);
#endif

        // Set base downloading url.
//		string relativePath = GetRelativePath();
        EditPlayerSettingsData data = ConfigManager.instance.GetEditPlayerSettingsData();
        string path = data.m_strS3Url.Replace("Assets/StreamingAssets/", "");
        AssetBundleManager.BaseDownloadingURL = path + kAssetBundlesPath + platformFolderForAssetBundles + "/";

        // Initialize AssetBundleManifest which loads the AssetBundleManifest object.
        var request = AssetBundleManager.Initialize(platformFolderForAssetBundles);
        if (request != null)
        {
            yield return(StartCoroutine(request));
        }
    }
Пример #4
0
    protected IEnumerator Initialize()
    {
        AssetBundleManager.IsLoadFromStream = true;
#if DEVELOPMENT_BUILD || UNITY_EDITOR
        AssetBundleManager.SetDevelopmentAssetBundleServer();
#else
        // Use the following code if AssetBundles are embedded in the project for example via StreamingAssets folder etc:
        if (AssetBundleManager.IsLoadFromStream)
        {
            AssetBundleManager.SetSourceAssetBundleDirectory();
        }
        else
        {
            AssetBundleManager.SetSourceAssetBundleURL(Application.dataPath + "/");
        }
#endif


        Debug.LogError("----zys----   StartCoroutine");
        var request = AssetBundleManager.Initialize();
        if (request != null)
        {
            yield return(StartCoroutine(request));
        }

        Debug.LogError("----zys----  end load mainfalst");
    }
Пример #5
0
        public void Initialize(string localAssetBundlePath, string remoteAssetBundlePath, OnLoadComplete callback, AssetBundleManager.LoadMode loadMode = AssetBundleManager.LoadMode.Internal, AssetBundleManager.LogMode logMode = AssetBundleManager.LogMode.JustErrors)
        {
            if (!AssetBundleManager.IsInited)
            {
                //1.场景的加载/卸载管理
                SceneManager.sceneLoaded   += OnSceneLoaded;
                SceneManager.sceneUnloaded += OnSceneUnloaded;

                //bundle的加载/卸载管理
                AssetBundleManager.loadMode = loadMode;
                AssetBundleManager.logMode  = logMode;

                //设置本地资源加载路径,和远端资源加载路径
                AssetBundleManager.SetLocalAssetBundleDirectory(localAssetBundlePath);
                AssetBundleManager.SetRemoteAssetBundleURL(remoteAssetBundlePath);

                //todo 需要和热更逻辑配合
                // string file = Path.Combine(AssetBundleManager.BaseLocalURL, Utility.GetPlatformName());
                // if (File.Exists(file))
                // {
                //     File.Delete(file);
                // }

                AssetBundleManager.ActiveVariants = new string[] { "bundle" };

                RegistCallback(Utility.GetPlatformName(), callback); //资源初始化完成的回调
                m_AssetBundleLoadManifestOperation = AssetBundleManager.Initialize();
            }
            else
            {
                StartCoroutine(_YieldCallback(callback));
            }
        }
Пример #6
0
        private IEnumerator Start()
        {
            AssetBundleManager.SetDevelopmentAssetBundleServer();

            var request = AssetBundleManager.Initialize();

            if (request != null)
            {
                yield return(StartCoroutine(request));
            }

            //AssetBundleLoadAssetOperation loadRequest = AssetBundleManager.LoadAssetAsync("prefab", "Cube", typeof(GameObject));
            //if (loadRequest == null)
            //    yield break;

            //yield return StartCoroutine(loadRequest);

            //GameObject prefab = loadRequest.GetAsset();
            ////如果讀取成功, 則創建實體
            //if (prefab != null)
            //    GameObject.Instantiate(prefab);

            //yield return new WaitForSeconds(5f);
            ////釋放"prefab"這個bundle
            //AssetBundleManager.UnloadAssetBundle("prefab");
        }
Пример #7
0
    public IEnumerator InitializeAssetBunder(string assetBundleName)
    {
        if (this.assetBundleName != null)
        {
            getInstance().unLoadAssetBundleManager();
        }

        // Don't destroy this gameObject as we depend on it to run the loading script.
        //DontDestroyOnLoad(context.gameObject);
        // With this code, when in-editor or using a development builds: Always use the AssetBundle Server
        // (This is very dependent on the production workflow of the project.
        //  Another approach would be to make this configurable in the standalone player.)
//        #if DEVELOPMENT_BUILD
//                        AssetBundleManager.SetDevelopmentAssetBundleServer();
//        #else
//                // Use the following code if AssetBundles are embedded in the project for example via StreamingAssets folder etc:
//                //AssetBundleManager.SetSourceAssetBundleURL("http://192.168.0.201/unity3d/3dbook_test/");
//                AssetBundleManager.SetSourceAssetBundleURL("file://" + GlobalVar.DATA_PATH + "/" + assetBundleName + "/");
//                // Or customize the URL based on your deployment or configuration
//                //AssetBundleManager.SetSourceAssetBundleURL("http://www.MyWebsite/MyAssetBundles");
//        #endif

        AssetBundleManager.SetSourceAssetBundleURL("file://" + GlobalVar.DATA_PATH + "/" + assetBundleName + "/");

        this.assetBundleName = assetBundleName;
        // Initialize AssetBundleManifest which loads the AssetBundleManifest object.
        var request = AssetBundleManager.Initialize();

        if (request != null)
        {
            yield return(context.StartCoroutine(request));
        }
    }
Пример #8
0
    private void Start()
    {
        if (clearAssetBundlesInCache)
        {
            Caching.ClearCache();
        }

        string manifestURL = "";

        if (isLocal)
        {
            manifestURL = "file://" + Application.streamingAssetsPath + "/" + localManifestPath;
        }
        else
        {
            manifestURL = remoteManifestURL;
        }

        //remoteManifestURL = manifestURL;

        // AssetBundleManager初期化
        remoteManifestURL = "http://keycert.site/test/Unknown/Unknown";
        AssetBundleManager.Initialize(remoteManifestURL, (bool isComplete) =>
        {
            // ダウンロード対象のAssetBundleのファイルサイズ
            AssetBundleManager.GetDownloadFileSize(downloadAssetBundles, (ulong b, string e) =>
            {
                output = "Downloadable AssetBundles file size = " + b + " Bytes.";
            });
        });
    }
Пример #9
0
//	protected IEnumerator LoadMap()
//	{
//		//"map_"+ mapID, "SceneMdID_"+ mapID
//		//		AssetBundleLoadAssetOperation request1 = AssetBundleManager.LoadAssetAsync("map_materials", "Addons", typeof(Material) );
//		AssetBundleLoadAssetOperation request1 = AssetBundleManager.LoadAssetAsync("map_1", "SceneMdID_1", typeof(GameObject) );
//		if (request1 == null)
//			yield break;
//		yield return StartCoroutine(request1);
//	}
    /// <summary>
    /// Initialize this instance.
    /// 官方的方式加载 mainfaset 文件;
    /// </summary>
    protected IEnumerator Initialize()
    {
        // Don't destroy this gameObject as we depend on it to run the loading script.
        //		DontDestroyOnLoad(gameObject);
#if DEVELOPMENT_BUILD || UNITY_EDITOR
        AssetBundleManager.SetDevelopmentAssetBundleServer();
#else
        // Use the following code if AssetBundles are embedded in the project for example via StreamingAssets folder etc:
        if (AssetBundleManager.IsLoadFromStream)
        {
            AssetBundleManager.SetSourceAssetBundleDirectory();
        }
        else
        {
            AssetBundleManager.SetSourceAssetBundleURL(Application.dataPath + "/");
        }
#endif

        Debug.LogError("----zys----   StartCoroutine");
        // Initialize AssetBundleManifest which loads the AssetBundleManifest object.
        var request = AssetBundleManager.Initialize();
        if (request != null)
        {
            yield return(StartCoroutine(request));
        }


        Debug.LogError("----zys----  end load mainfalst");
    }
Пример #10
0
    IEnumerator DownloadAsync()
    {
        var prefabObject = this.fallbackPrefab;
        var succeeded    = false;

#if !UNITY_EDITOR
        if (this.isActive &&
            !string.IsNullOrEmpty(this.downloadUrl) &&
            !string.IsNullOrEmpty(this.bundleName) &&
            !string.IsNullOrEmpty(this.prefabName))
        {
            AssetBundleManager.SetSourceAssetBundleURL(this.downloadUrl);

            var initializeOperation = AssetBundleManager.Initialize();

            if (initializeOperation != null)
            {
                yield return(StartCoroutine(initializeOperation));

                AssetBundleLoadAssetOperation loadOperation = null;

                try
                {
                    loadOperation = AssetBundleManager.LoadAssetAsync(
                        this.bundleName, this.prefabName, typeof(GameObject));
                }
                catch
                {
                }
                if (loadOperation != null)
                {
                    yield return(StartCoroutine(loadOperation));

                    var loadedPrefab = loadOperation.GetAsset <GameObject>();

                    if (loadedPrefab != null)
                    {
                        prefabObject = loadedPrefab;
                        succeeded    = true;
                    }
                }
            }
        }
#else
        succeeded = true;
#endif

        this.LoadedPrefab = prefabObject;

        if (this.Downloaded != null)
        {
            this.Downloaded(
                this, new global::BundleDownloadedEventArgs()
            {
                DownloadSucceeded = succeeded
            }
                );
        }
        yield break;
    }
        IEnumerator <YieldInstruction> InitializeAndThenLoadSceneIntoLevel(string assetBundleName, string sceneName)
        {
#if DLK_AssetBundleIntegrationEnabled
            initialized = true;

            if (variantPossibilities != null && variantPossibilities.Length > 0)
            {
                SetVariant(activeVariant);
            }
            else
            {
                variantPossibilities = null;
                activeVariant        = null;
            }

            AssetBundleManager.logMode = logMode == AssetBundleManagerLogMode.All ? AssetBundleManager.LogMode.All : AssetBundleManager.LogMode.JustErrors;

            if (streamingType == StreamingType.SimulationModeOrLocalAssetServer)
            {
                AssetBundleManager.SetDevelopmentAssetBundleServer();
            }
            else if (streamingType == StreamingType.StreamingAssetsFolder)
            {
                AssetBundleManager.SetSourceAssetBundleURL("file:///" + Application.streamingAssetsPath + "/");
            }
            else
            {
                AssetBundleManager.SetSourceAssetBundleURL(serverURL);
            }

            // Initialize AssetBundleManifest which loads the AssetBundleManifest object.
            var initializeRequest = AssetBundleManager.Initialize();

            if (initializeRequest != null)
            {
                while (initializeRequest.MoveNext())
                {
                    yield return(null);
                }
            }

            AssetBundleLoadOperation levelLoadRequest = AssetBundleManager.LoadLevelAsync(assetBundleName, sceneName, true);

            if (levelLoadRequest != null)
            {
                while (levelLoadRequest.MoveNext())
                {
                    yield return(null);//request.Current just returns null, so we can do that instead
                }
                AssetBundleManager.UnloadAssetBundle(assetBundleName);
            }
            else
            {
                Debug.Log("Could not load level " + assetBundleName + " Asset Bundle.");
                yield break;
            }
#else
            throw new NotImplementedException("You must enable Asset Bundle Integration to utilize the Asset Bundle Loader.");
#endif
        }
Пример #12
0
 public void Initialize()
 {
     AssetBundles.AssetBundleManager.SetSourceAssetBundleDirectory(
         "/AssetBundles/" + Utility.GetPlatformName() + "/");
     loadOperation = AssetBundleManager.Initialize();
     tickableManager.AddLate(this);
 }
Пример #13
0
    // Initialize the downloading url and AssetBundleManifest object.
    protected IEnumerator Initialize(string assetbundleType = "")
    {
        // Don't destroy the game object as we base on it to run the loading script.
        DontDestroyOnLoad(gameObject);

#if UNITY_EDITOR
        Debug.Log("We are " + (AssetBundleManager.SimulateAssetBundleInEditor ? "in Editor simulation mode" : "in normal mode"));
#endif

        string platformFolderForAssetBundles =
#if UNITY_EDITOR
            GetPlatformFolderForAssetBundles(EditorUserBuildSettings.activeBuildTarget);
#else
            GetPlatformFolderForAssetBundles(Application.platform);
#endif

        assetbundleType = string.IsNullOrEmpty(assetbundleType) ? "" : (assetbundleType + "/");
        string AssetBundlesPath = GetAssetBundles();
        // Set base downloading url.
        string relativePath = GetRelativePath();
        AssetBundleManager.BaseDownloadingURL = relativePath + AssetBundlesPath + assetbundleType + platformFolderForAssetBundles + "/";
#if dev
        Debug.Log("load " + assetbundleType + " downUrl:" + AssetBundleManager.BaseDownloadingURL);
#endif
        // Initialize AssetBundleManifest which loads the AssetBundleManifest object.
        var request = AssetBundleManager.Initialize(platformFolderForAssetBundles);
        if (request != null)
        {
            yield return(StartCoroutine(request));
        }
    }
    protected IEnumerator InitializeCroutine(AssetBundleManagerEvent <bool, AssetBundleManifest> onFinish = null)
    {
        DontDestroyOnLoad(gameObject);

#if UNITY_EDITOR
        Debug.Log("EventDrivenBaseLoader Mode:" + (AssetBundleManager.SimulateAssetBundleInEditor ?
                                                   "Editor Simulation" : "Normal"));
#endif

        AssetBundleManager.BaseDownloadingURL = new StringBuilder()
                                                .Append(GetRelativePath())
                                                .Append(kAssetBundlesPath)
                                                .Append(PlatformfolderForAssetBundles)
                                                .Append("/")
                                                .ToString();

        var request = AssetBundleManager.Initialize(PlatformfolderForAssetBundles);

        if (request != null)
        {
            yield return(GetDriver().StartCoroutine(request));
        }

        if (onFinish != null)
        {
            var manifest = request.GetAsset <AssetBundleManifest> ();
            onFinish(manifest != null, manifest);
        }
    }
Пример #15
0
    // Initialize the downloading url and AssetBundleManifest object.
    public IEnumerator Initialize()
    {
        // Don't destroy the game object as we base on it to run the loading script.
        DontDestroyOnLoad(gameObject);
        //ManagerManager.Instance.CLEAN_TARGET.Add(gameObject);

#if UNITY_EDITOR
        Debug.Log("We are " + (AssetBundleManager.SimulateAssetBundleInEditor ? "in Editor simulation mode" : "in normal mode"));
#endif

        string platformFolderForAssetBundles =
#if UNITY_EDITOR
            GetPlatformFolderForAssetBundles(EditorUserBuildSettings.activeBuildTarget);
#else
            GetPlatformFolderForAssetBundles(Application.platform);
#endif

        //platformFolderForAssetBundles = platformFolderForAssetBundles.ToLower();

        // Set base downloading url.
        // string relativePath = GetRelativePath();
        // AssetBundleManager.BaseDownloadingURL = relativePath + kAssetBundlesPath + platformFolderForAssetBundles + "/";

        // Initialize AssetBundleManifest which loads the AssetBundleManifest object.
        var request = AssetBundleManager.Initialize(platformFolderForAssetBundles);
        if (request != null)
        {
            yield return(StartCoroutine(request));
        }
    }
Пример #16
0
    // Initialize the downloading url and AssetBundleManifest object.
    protected IEnumerator Initialize()
    {
        // Don't destroy this gameObject as we depend on it to run the loading script.
        DontDestroyOnLoad(gameObject);

        // With this code, when in-editor or using a development builds: Always use the AssetBundle Server
        // (This is very dependent on the production workflow of the project.
        //  Another approach would be to make this configurable in the standalone player.)
#if DEVELOPMENT_BUILD || UNITY_EDITOR
        //AssetBundleManager.SetDevelopmentAssetBundleServer ();
        AssetBundleManager.SetSourceAssetBundleURL(AssetBundleURL);
#else
        // Use the following code if AssetBundles are embedded in the project for example via StreamingAssets folder etc:
        AssetBundleManager.SetSourceAssetBundleURL(Application.dataPath + "/");
        // Or customize the URL based on your deployment or configuration
        AssetBundleManager.SetSourceAssetBundleURL(AssetBundleURL);
#endif

        // Initialize AssetBundleManifest which loads the AssetBundleManifest object.
        var request = AssetBundleManager.Initialize();

        if (request != null)
        {
            yield return(StartCoroutine(request));
        }
    }
Пример #17
0
        // Initialize the downloading url and AssetBundleManifest object.
        protected IEnumerator Initialize()
        {
            // Don't destroy this gameObject as we depend on it to run the loading script.
            DontDestroyOnLoad(gameObject);

            //TODO ONLY LOCAL LOAD BANDLES
#if DEVELOPMENT_BUILD || UNITY_EDITOR
            AssetBundleManager.SetSourceAssetBundleURL(Path.Combine(Application.streamingAssetsPath, Utility.AssetBundlesOutputPath) + "/");
            //AssetBundleManager.SetDevelopmentAssetBundleServer();
#else
            AssetBundleManager.SetSourceAssetBundleURL(Path.Combine(Application.streamingAssetsPath, Utility.AssetBundlesOutputPath) + "/");

            // Or customize the URL based on your deployment or configuration
            //AssetBundleManager.SetSourceAssetBundleURL("http://www.MyWebsite/MyAssetBundles");
#endif

            // Initialize AssetBundleManifest which loads the AssetBundleManifest object.
            var request = AssetBundleManager.Initialize();

            if (request != null)
            {
                yield return(StartCoroutine(request));
            }

            IsReady = true;
        }
Пример #18
0
    // Initialize the downloading url and AssetBundleManifest object.
    protected IEnumerator InitializeManifest()
    {
        // With this code, when in-editor or using a development builds: Always use the AssetBundle Server
        // (This is very dependent on the production workflow of the project.
        //  Another approach would be to make this configurable in the standalone player.)
#if DEVELOPMENT_BUILD || UNITY_EDITOR
        AssetBundleManager.SetDevelopmentAssetBundleServer();
#else
        // Use the following code if AssetBundles are embedded in the project for example via StreamingAssets folder etc:
        //AssetBundleManager.SetSourceAssetBundleURL(Application.streamingAssetsPath + "/");
        // Or customize the URL based on your deployment or configuration
        //AssetBundleManager.SetSourceAssetBundleURL("http://www.MyWebsite/MyAssetBundles");

        //AssetBundleManager.SetSourceAssetBundleURL("http://1.235.170.142/shared/AssetBundle");
        AssetBundleManager.SetSourceAssetBundleURL(Application.streamingAssetsPath + "/");
#endif

        // Initialize AssetBundleManifest which loads the AssetBundleManifest object.
        m_Request = AssetBundleManager.Initialize();
        if (m_Request != null)
        {
            yield return(StartCoroutine(m_Request));
        }

        m_Initialized = true;
    }
Пример #19
0
    private void Start()
    {
        if (clearAssetBundlesInCache)
        {
            Caching.ClearCache();
        }

        string baseUrl;

        if (isLocal)
        {
            baseUrl = "file://" + Application.streamingAssetsPath + "/" + localLoadPath;
        }
        else
        {
            baseUrl = remoteLoadURL;
        }

        // AssetBundleManager初期化
        AssetBundleManager.Initialize(baseUrl);

        // ダウンロード対象のAssetBundleのファイルサイズ
        #region ASSETBUNDLES_FILESIZE
        AssetBundleManager.GetDownloadFileSize(downloadAssetBundles, (ulong b, string e) =>
        {
            output = "Downloadable AssetBundles file size = " + b + " Bytes.";
        });
        #endregion ASSETBUNDLES_FILESIZE
    }
Пример #20
0
        //----- property -----

        //----- method -----

        private void InitializeAssetBundle()
        {
            assetBundleManager = AssetBundleManager.CreateInstance();
            assetBundleManager.Initialize(MaxDownloadCount, simulateMode);
            assetBundleManager.RegisterYieldCancel(yieldCancel);
            assetBundleManager.OnTimeOutAsObservable().Subscribe(x => OnTimeout(x)).AddTo(Disposable);
            assetBundleManager.OnErrorAsObservable().Subscribe(x => OnError(x)).AddTo(Disposable);
        }
Пример #21
0
    private IEnumerator Initialize()
    {
        AssetBundleLoadAssetOperation request = AssetBundleManager.Initialize();

        yield return(request);

        OzLuaManager.Instance.Init(this.LuaBindProgress);
    }
Пример #22
0
    private IEnumerator Start()
    {
        AssetBundleManager.SetSourceAssetBundleURL();
        yield return(AssetBundleManager.Initialize());

        gameObject.AddComponent <TextureManager>();

        InitDown = true;
    }
    private IEnumerator Initialize()
    {
        var request = AssetBundleManager.Initialize();

        if (request != null)
        {
            yield return(StartCoroutine(request));
        }
    }
Пример #24
0
    private void Awake()
    {
        if (_inited)
        {
            return;
        }

        Instance = this;

#if !UNITY_EDITOR
        AssetBundleManager.Initialize();
#endif

        var spriteMgr = Resources.FindObjectsOfTypeAll <SpriteAtlasMgr>();
        if (spriteMgr.Length == 0)
        {
            gameObject.AddComponent <SpriteAtlasMgr>();
        }

        //读取存档
        SaveDataMgr.PreloadGameData();

        //初始化游戏设置
        GameSetting.InitSetting();

        //初始化sound模块
        SoundListenter.Init();

        //初始化资源管理器
        ResourceMgr.InitInstance();


        CoroutineStart = StartCoroutine;
        DefaultRes     = GetComponent <DefaultRes>();

        //初始化UI
        var uguiRoot = FindObjectOfType <UiRootScript>();
        uguiRoot.Init();
        UiManager.Init(uguiRoot);
        DontDestroyOnLoad(uguiRoot);
        DontDestroyOnLoad(gameObject);

        //清理缓存
        Caching.ClearCache();


        UnityEngine.Random.InitState(DateTime.Now.Second);

#if !UNITY_EDITOR && UNITY_ANDROID
        Screen.sleepTimeout = SleepTimeout.NeverSleep;
#endif
        _inited = true;


        FirstStartGame();
    }
    protected IEnumerator Initialize()
    {
        AssetBundleManager.SetDevelopmentAssetBundleServer();
        var request = AssetBundleManager.Initialize();

        if (request != null)
        {
            yield return(StartCoroutine(request));
        }
    }
Пример #26
0
 /// <summary>
 /// 初始化 assetbundle 管理器 下载bundle
 /// </summary>
 /// <returns></returns>
 public IEnumerator InitAssetBundleManager()
 {
     while (string.IsNullOrEmpty(absUrl))
     {
         yield return(new WaitForEndOfFrame());
     }
     abm = new AssetBundleManager();
     abm.SetBaseUri(absUrl);
     abm.Initialize(OnAssetBundleManagerInitialized);
 }
Пример #27
0
    public override IEnumerator Initialize()
    {
        yield return(base.Initialize());

        AssetBundleManager.SetSourceAssetBundleURL("file://" + BuildPath.ResourceFolder);
        var req = AssetBundleManager.Initialize();

        while (req != null && !req.IsDone())
        {
            yield return(null);
        }
    }
Пример #28
0
    static IEnumerator AsyncLoad()
    {
        // Android store streams assets in a compressed archive, so different file system.
#if !UNITY_EDITOR
#if UNITY_ANDROID
        AssetBundleManager.BaseDownloadingURL = Application.streamingAssetsPath + "/AssetBundles/" + Utility.GetPlatformName() + "/";
#else
        AssetBundleManager.BaseDownloadingURL = "file://" + Application.streamingAssetsPath + "/AssetBundles/" + Utility.GetPlatformName() + "/";
#endif
#else
        AssetBundleManager.BaseDownloadingURL = "file://" + Application.streamingAssetsPath + "/AssetBundles/" + Utility.GetPlatformName() + "/";
#endif

        var request = AssetBundleManager.Initialize();
        if (request != null)
        {
            yield return(CoroutineHandler.StartStaticCoroutine(request));
        }

        // In editor we can directly get all the bundles but in final build, we need to read them from the manifest.
#if UNITY_EDITOR
        string[] bundles;
        if (AssetBundleManager.SimulateAssetBundleInEditor)
        {
            bundles = AssetDatabase.GetAllAssetBundleNames();
        }
        else
        {
            bundles = AssetBundleManager.AssetBundleManifestObject.GetAllAssetBundles();
        }
#else
        string[] bundles = AssetBundleManager.AssetBundleManifestObject.GetAllAssetBundles();
#endif

        List <string> characterPackage = new List <string>();
        List <string> themePackage     = new List <string>();

        for (int i = 0; i < bundles.Length; ++i)
        {
            if (bundles[i].StartsWith("characters/"))
            {
                characterPackage.Add(bundles[i]);
            }
            else if (bundles[i].StartsWith("themes/"))
            {
                themePackage.Add(bundles[i]);
            }
        }

        yield return(CoroutineHandler.StartStaticCoroutine(CharacterDatabase.LoadDatabase(characterPackage)));

        yield return(CoroutineHandler.StartStaticCoroutine(ThemeDatabase.LoadDatabase(themePackage)));
    }
    // Initialize the downloading url and AssetBundleManifest object.
    protected IEnumerator Initialize()
    {
        // Don't destroy this gameObject as we depend on it to run the loading script.
        DontDestroyOnLoad(gameObject);

        InitializeSourceURL();

        // Initialize AssetBundleManifest which loads the AssetBundleManifest object.
        var request = AssetBundleManager.Initialize();
        if (request != null)
            yield return StartCoroutine(request);
    }
Пример #30
0
    // Initialize the downloading url and AssetBundleManifest object.
    protected IEnumerator Initialize()
    {
#if DEVELOPMENT_BUILD || UNITY_EDITOR
        AssetBundleManager.SetDevelopmentAssetBundleServer();
#else
        AssetBundleManager.SetSourceAssetBundleURL(Common.CO.APP_ASSET_BUNDLE_URL);
#endif
        var request = AssetBundleManager.Initialize();
        if (request != null)
        {
            yield return(StartCoroutine(request));
        }
    }