Beispiel #1
0
        public Callback <AssetBundle[], int> LoadUI(string module)
        {
            string bytesAbPath   = AssetFileBook.GetUIPath(string.Format("{0}_fgui", module));
            string textureAbPath = AssetFileBook.GetUIPath(string.Format("{0}_altas", module));
            var    callback      = Callback <AssetBundle[], int> .GetOrNew();

            AssetLoaderManager.GetInstance().LoadAssetSync <AssetBundle>(bytesAbPath, (bytesAb) =>
            {
                AssetLoaderManager.GetInstance().LoadAssetSync <AssetBundle>(textureAbPath, (altasAb) =>
                {
                    callback?.onSuccess?.Invoke(new AssetBundle[] { bytesAb, altasAb });
                }, (altasBytes) =>
                {
                    if (bytesAb != null)
                    {
                        callback?.onSuccess?.Invoke(new AssetBundle[] { bytesAb, null });
                    }
                    else
                    {
                        callback?.onFailed?.Invoke(altasBytes);
                    }
                });
            }, (reasonBytes) =>
            {
                callback?.onFailed?.Invoke(reasonBytes);
            });
            return(callback);
        }
Beispiel #2
0
        public AssetBundle[] LoadUISync(string module)
        {
            string bytesAbPath   = AssetFileBook.GetUIPath(string.Format("{0}_fgui", module));
            string textureAbPath = AssetFileBook.GetUIPath(string.Format("{0}_altas", module));

            var bytesAb = AssetBundle.LoadFromFile(bytesAbPath);
            var altasAb = AssetBundle.LoadFromFile(textureAbPath);

            return(new AssetBundle[] { bytesAb, altasAb });
        }