コード例 #1
0
 static public int LoadAssetAsync(IntPtr l)
 {
     try {
         int argc = LuaDLL.lua_gettop(l);
         if (argc == 2)
         {
             LBoot.AssetBundleRef self = (LBoot.AssetBundleRef)checkSelf(l);
             System.String        a1;
             checkType(l, 2, out a1);
             var ret = self.LoadAssetAsync(a1);
             pushValue(l, ret);
             return(1);
         }
         else if (argc == 3)
         {
             LBoot.AssetBundleRef self = (LBoot.AssetBundleRef)checkSelf(l);
             System.String        a1;
             checkType(l, 2, out a1);
             System.Type a2;
             checkType(l, 3, out a2);
             var ret = self.LoadAssetAsync(a1, a2);
             pushValue(l, ret);
             return(1);
         }
         return(error(l, "No matched override function to call"));
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
コード例 #2
0
 static public int UpdateEndTime(IntPtr l)
 {
     try {
         LBoot.AssetBundleRef self = (LBoot.AssetBundleRef)checkSelf(l);
         self.UpdateEndTime();
         return(0);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
コード例 #3
0
 static public int get_Dead(IntPtr l)
 {
     try {
         LBoot.AssetBundleRef self = (LBoot.AssetBundleRef)checkSelf(l);
         pushValue(l, self.Dead);
         return(1);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
コード例 #4
0
ファイル: BundleHelper.cs プロジェクト: swordlegend/army_ru
        /// <summary>
        /// Loads the asset bundle with all its dependencies.
        /// </summary>
        /// <returns>The with dependencies.</returns>
        /// <param name="uri">URI.</param>
        public static AssetBundleRef LoadWithDependencies(string uri, int ttl)
        {
#if PROFILE_FILE
            Profiler.BeginSample("BundleHelper.LoadWithDependencies");
#endif
            uri = fixBundleUri(uri);
            AssetBundleRef bundle = BundleManager.LoadWithDependencies(uri, ttl);
#if PROFILE_FILE
            Profiler.EndSample();
#endif
            return(bundle);
        }
コード例 #5
0
 static public int CanUnload(IntPtr l)
 {
     try {
         LBoot.AssetBundleRef self = (LBoot.AssetBundleRef)checkSelf(l);
         var ret = self.CanUnload();
         pushValue(l, ret);
         return(1);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
コード例 #6
0
 static public int set_uri(IntPtr l)
 {
     try {
         LBoot.AssetBundleRef self = (LBoot.AssetBundleRef)checkSelf(l);
         System.String        v;
         checkType(l, 2, out v);
         self.uri = v;
         return(0);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
コード例 #7
0
 static public int UnloadAsset(IntPtr l)
 {
     try {
         LBoot.AssetBundleRef self = (LBoot.AssetBundleRef)checkSelf(l);
         System.String        a1;
         checkType(l, 2, out a1);
         self.UnloadAsset(a1);
         return(0);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
コード例 #8
0
 static public int set_SecondsToLive(IntPtr l)
 {
     try {
         LBoot.AssetBundleRef self = (LBoot.AssetBundleRef)checkSelf(l);
         int v;
         checkType(l, 2, out v);
         self.SecondsToLive = v;
         return(0);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
コード例 #9
0
 static public int set_AssetBundle(IntPtr l)
 {
     try {
         LBoot.AssetBundleRef    self = (LBoot.AssetBundleRef)checkSelf(l);
         UnityEngine.AssetBundle v;
         checkType(l, 2, out v);
         self.AssetBundle = v;
         return(0);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
コード例 #10
0
ファイル: BundleManager.cs プロジェクト: swordlegend/army_ru
        // Load an AssetBundle, without loading its dependencies
        public static AssetBundleRef Load(string uri, int ttl)
        {
            string         keyName = GetBundleKey(uri);
            AssetBundleRef abRef;

            GetTTLSettings(uri, ref ttl);

            if (TryGetRefreshedBundleRef(keyName, ttl, out abRef))
            {
                loadingBundles.Remove(keyName);
                return(abRef);
            }
            else
            {
                LogUtil.Trace("BundleManager: Load " + uri);
                AssetBundle bundle = null;

                if (loadWithWWW)
                {
                    bundle = BundleEncoder.CreateBundleFromWWW(uri, wwwVersion, wwwCrc);
                }
                else
                {
                    bundle = BundleEncoder.CreateBundleFromFile(uri);
                }

                if (bundle != null)
                {
                    abRef             = new AssetBundleRef(uri, ttl);
                    abRef.AssetBundle = bundle;
                    dictAssetBundleRefs.Add(keyName, abRef);
                    listAssetBundleUris.Add(uri);
                    loadingBundles.Remove(keyName);
                    AddLoadHistory(uri, true);
                    return(abRef);
                }
                else
                {
                    if (TryGetRefreshedBundleRef(keyName, ttl, out abRef))
                    {
                        loadingBundles.Remove(keyName);
                        return(abRef);
                    }

                    LogUtil.Error("BundleManager: creating bundle from uri failed! " + uri);
                }
            }

            return(null);
        }
コード例 #11
0
 static public int Contains(IntPtr l)
 {
     try {
         LBoot.AssetBundleRef self = (LBoot.AssetBundleRef)checkSelf(l);
         System.String        a1;
         checkType(l, 2, out a1);
         var ret = self.Contains(a1);
         pushValue(l, ret);
         return(1);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
コード例 #12
0
 static public int constructor(IntPtr l)
 {
     try {
         LBoot.AssetBundleRef o;
         System.String        a1;
         checkType(l, 2, out a1);
         System.Int32 a2;
         checkType(l, 3, out a2);
         o = new LBoot.AssetBundleRef(a1, a2);
         pushValue(l, o);
         return(1);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
コード例 #13
0
ファイル: BundleManager.cs プロジェクト: swordlegend/army_ru
        public static bool TryGetRefreshedBundleRef(string keyName, int ttl, out AssetBundleRef abRef)
        {
            if (dictAssetBundleRefs.TryGetValue(keyName, out abRef))
            {
                if (ttl < 0)
                {
                    abRef.SecondsToLive = ttl;
                }
                else
                {
                    abRef.UpdateEndTime();
                }
                return(true);
            }

            return(false);
        }
コード例 #14
0
ファイル: BundleHelper.cs プロジェクト: swordlegend/army_ru
        private static IEnumerator _LoadWithDependenciesAsync(string uri, int ttl, Action <AssetBundleRef> onComplete)
        {
#if PROFILE_FILE
            // Profiler.BeginSample("BundleHelper._LoadWithDependenciesAsync");
#endif
            var            fixedUri    = fixBundleUri(uri);
            AssetBundleRef assetBundle = null;
            var            iter        = BundleManager.LoadWithDependenciesAsync(fixedUri, ttl);
            while (iter.MoveNext())
            {
                yield return(null);
            }
            assetBundle = BundleManager.GetBundleRef(fixedUri);
            onComplete(assetBundle);
#if PROFILE_FILE
            // Profiler.EndSample();
#endif
        }
コード例 #15
0
ファイル: BundleHelper.cs プロジェクト: swordlegend/army_ru
        private static IEnumerator _LoadLevelAdditiveAsync(string uri, int ttl, Action onComplete, Action <AsyncLoadingType, float> onProgress = null)
        {
#if PROFILE_FILE
            // Profiler.BeginSample("BundleHelper.LoadLevelAdditiveAsync");
#endif
            var fixedUri = fixBundleUri(uri);
#if !UNITY_EDITOR || !LOAD_FROM_EDITOR
            AssetBundleRef assetBundle = null;
            var            iter        = BundleManager.LoadWithDependenciesAsync(fixedUri, ttl, bundle => assetBundle = bundle);
            while (iter.MoveNext())
            {
                if (onProgress != null)
                {
                    onProgress(AsyncLoadingType.AssetBundle, (float)iter.Current);
                }
                yield return(null);
            }
#endif
            var asyncOp2 = Application.LoadLevelAdditiveAsync(getAssetName(uri));
            while (!asyncOp2.isDone)
            {
                if (onProgress != null)
                {
                    onProgress(AsyncLoadingType.Scene, asyncOp2.progress);
                }
                yield return(null);
            }

            yield return(new WaitForEndOfFrame());

            onComplete();

#if PROFILE_FILE
            // Profiler.EndSample();
#endif
        }
コード例 #16
0
ファイル: BundleHelper.cs プロジェクト: swordlegend/army_ru
        private static IEnumerator _LoadWithDependenciesAsync(string uri, int ttl, LuaTable lua)
        {
#if PROFILE_FILE
            // Profiler.BeginSample("BundleHelper._LoadWithDependenciesAsync");
#endif
            var            fixedUri    = fixBundleUri(uri);
            AssetBundleRef assetBundle = null;
            var            iter        = BundleManager.LoadWithDependenciesAsync(fixedUri, ttl);
            int            count       = 0;
            while (iter.MoveNext())
            {
                count++;
                yield return(null);
            }

            assetBundle = BundleManager.GetBundleRef(fixedUri);
            if (lua != null)
            {
                lua.setOneLevelField("bundle", assetBundle);
            }
#if PROFILE_FILE
            // Profiler.EndSample();
#endif
        }
コード例 #17
0
ファイル: BundleManager.cs プロジェクト: swordlegend/army_ru
        internal static IEnumerator LoadAsync(string parentBundlePath, string uri, int ttl)
        {
            string keyName = GetBundleKey(uri);

            GetTTLSettings(uri, ref ttl);

            AssetBundleRef abRef;

            while (loadingBundles.Contains(keyName))
            {
                LogUtil.Trace("BundleManager: is already Loading " + keyName);
                yield return(null);
            }

            if (TryGetRefreshedBundleRef(keyName, ttl, out abRef))
            {
                loadingBundles.Remove(keyName);
                abRef.AddParentBundle(parentBundlePath);
                yield break;
            }
            else
            {
                loadingBundles.Add(keyName);

                LogUtil.Trace("BundleManager: LoadAsyncWithNoCallback " + uri);
                AssetBundle bundle = null;

                if (loadWithWWW)
                {
                    var www = BundleEncoder.CreateBundleFromWWWAsync(uri, wwwVersion, wwwCrc);
                    while (!www.isDone)
                    {
                        yield return(null);
                    }
                    if (www.error == null || www.error == "")
                    {
                        bundle = www.assetBundle;
                    }
                    else
                    {
                        LogUtil.Error("BundleManager: creating bundle from WWW failed: " + www.error);
                    }
                }
                else
                {
                    var req = BundleEncoder.CreateBundleFromFileAsync(uri);
                    while (!req.isDone && !TryGetRefreshedBundleRef(keyName, ttl, out abRef))
                    {
                        yield return(null);
                    }

                    if (req.isDone)
                    {
                        bundle = req.assetBundle;
                    }
                }

                if (bundle != null)
                {
                    abRef             = new AssetBundleRef(uri, ttl);
                    abRef.AssetBundle = bundle;
                    dictAssetBundleRefs.Add(keyName, abRef);
                    listAssetBundleUris.Add(uri);
                    AddLoadHistory(uri, true);
                    loadingBundles.Remove(keyName);
                    abRef.AddParentBundle(parentBundlePath);
                }
                else
                {
                    if (TryGetRefreshedBundleRef(keyName, ttl, out abRef))
                    {
                        loadingBundles.Remove(keyName);
                        abRef.AddParentBundle(parentBundlePath);
                    }
                    else
                    {
                        LogUtil.Error("BundleManager: creating bundle from uri failed! " + uri);
                    }
                }

                loadingBundles.Remove(keyName);
            }
        }
コード例 #18
0
ファイル: BundleHelper.cs プロジェクト: swordlegend/army_ru
 public void Clear()
 {
     done      = false;
     bundleRef = null;
 }