Ejemplo n.º 1
0
 public static T[] LoadAll <T>(String name) where T : UnityEngine.Object
 {
     if (typeof(T) != typeof(AnimationClip))
     {
         global::Debug.LogWarning("AssetManager::LoadAll<T>::Currently support only AnimationClip.");
         return(null);
     }
     name = AnimationFactory.GetRenameAnimationDirectory(name);
     T[] array = Resources.LoadAll <T>(name);
     if (array != null)
     {
         return(array);
     }
     if (AssetManagerForObb._animationInFolder.ContainsKey(name))
     {
         List <String> list   = AssetManagerForObb._animationInFolder[name];
         T[]           array2 = new T[list.Count];
         for (Int32 i = 0; i < list.Count; i++)
         {
             String renameAnimationPath = AnimationFactory.GetRenameAnimationPath(list[i]);
             array2[i] = AssetManagerForObb.Load <T>(renameAnimationPath, false);
         }
         return(array2);
     }
     global::Debug.LogError("Cannot find " + name + " in bundles!!!");
     return(null);
 }
Ejemplo n.º 2
0
    public static T Load <T>(String name, Boolean suppressError = false) where T : UnityEngine.Object
    {
        //if (!name.EndsWith(".mes"))
        //{
        //    Log.Message(typeof(T).Name + ": " + name);
        //    Log.Message(Environment.StackTrace);
        //}

        if (AssetManagerForObb.IsUseOBB)
        {
            return(AssetManagerForObb.Load <T>(name, suppressError));
        }

        if (!UseBundles || AssetManagerUtil.IsEmbededAssets(name))
        {
            return(Resources.Load <T>(name));
        }

        String  belongingBundleFilename = AssetManagerUtil.GetBelongingBundleFilename(name);
        Boolean flag1 = AssetManagerUtil.CheckModuleBundleFromName(AssetManagerUtil.ModuleBundle.CommonAssets, name);

        if (!String.IsNullOrEmpty(belongingBundleFilename) && DictAssetBundleRefs.ContainsKey(belongingBundleFilename))
        {
            AssetBundleRef assetBundleRef = DictAssetBundleRefs[belongingBundleFilename];
            if (assetBundleRef.assetBundle != null)
            {
                String  name1 = AssetManagerUtil.GetResourcesBasePath() + name + AssetManagerUtil.GetAssetExtension <T>(name);
                Boolean flag2 = name.IndexOf("atlas_a", StringComparison.Ordinal) != -1;
                T       obj   = assetBundleRef.assetBundle.LoadAsset <T>(name1);
                if (obj != null)
                {
                    return(obj);
                }

                if (Application.platform != RuntimePlatform.Android && flag2)
                {
                    return(null);
                }

                if (!flag1 && ForceUseBundles)
                {
                    return(null);
                }
            }
        }

        if (ForceUseBundles)
        {
            return(null);
        }

        T obj1 = Resources.Load <T>(name);

        return(obj1);
    }
Ejemplo n.º 3
0
    public static T Load <T>(String name, Boolean suppressError = false) where T : UnityEngine.Object
    {
        if (AssetManagerForObb.IsUseOBB)
        {
            return(AssetManagerForObb.Load <T>(name, suppressError));
        }
        if (!AssetManager.UseBundles || AssetManagerUtil.IsEmbededAssets(name))
        {
            return(Resources.Load <T>(name));
        }
        String  belongingBundleFilename = AssetManagerUtil.GetBelongingBundleFilename(name);
        Boolean flag = AssetManagerUtil.CheckModuleBundleFromName(AssetManagerUtil.ModuleBundle.CommonAssets, name);

        if (!String.IsNullOrEmpty(belongingBundleFilename) && AssetManager.DictAssetBundleRefs.ContainsKey(belongingBundleFilename))
        {
            AssetManager.AssetBundleRef assetBundleRef = AssetManager.DictAssetBundleRefs[belongingBundleFilename];
            if (assetBundleRef.assetBundle != (UnityEngine.Object)null)
            {
                String text = AssetManagerUtil.GetResourcesBasePath() + name;
                text += AssetManagerUtil.GetAssetExtension <T>(name);
                Boolean flag2 = name.IndexOf("atlas_a") != -1;
                T       t     = assetBundleRef.assetBundle.LoadAsset <T>(text);
                if (t != (UnityEngine.Object)null)
                {
                    return(t);
                }
                if (Application.platform != RuntimePlatform.Android && flag2)
                {
                    return((T)((Object)null));
                }
                if (!flag && AssetManager.ForceUseBundles)
                {
                    return((T)((Object)null));
                }
            }
        }
        if (AssetManager.ForceUseBundles)
        {
            return((T)((Object)null));
        }
        T t2 = Resources.Load <T>(name);

        if (t2 != (UnityEngine.Object)null)
        {
            return(t2);
        }
        return((T)((Object)null));
    }