Beispiel #1
0
        public override Asset LoadAsset(string assetName, Type type)
        {
            Object rawasset = AssetDatabase.LoadAssetAtPath(assetName, type);

            if (rawasset == null)
            {
                return(null);
            }

            string         bundleName = ResourceUtils.ConvertToABName(assetName) + ".ab";
            SimulateBundle bundle     = LoadBundle(bundleName) as SimulateBundle;

            return(new SimulateAsset(rawasset, assetName, bundle));
        }
Beispiel #2
0
        public override Asset[] LoadAssetWithSubAssets(string assetName, Type type)
        {
            Object[]       rawassets  = AssetDatabase.LoadAllAssetsAtPath(assetName);
            string         bundleName = ResourceUtils.ConvertToABName(assetName) + ".ab";
            SimulateBundle bundle     = LoadBundle(bundleName) as SimulateBundle;
            List <Asset>   rli        = new List <Asset>();

            foreach (var rawasset in rawassets)
            {
                rli.Add(new SimulateAsset(rawasset, assetName, bundle));
            }

            return(rli.ToArray());
        }
Beispiel #3
0
        public override Bundle LoadBundle(string bundleName, bool hold = false)
        {
#if DEBUG
            if (System.Text.RegularExpressions.Regex.IsMatch(bundleName, "[A-Z]"))
            {
                Debug.LogError("AssertBundle name must be lowercase letters");
            }
#endif

            SimulateBundle bundle;
            if (!bundles.TryGetValue(bundleName, out bundle))
            {
                bundle = new SimulateBundle(bundleName);
                bundles.Add(bundleName, bundle);
            }
            return(bundle);
        }
Beispiel #4
0
        public AssetLoadRequest LoadAssetAsyncImpl(string assetName, Type type, int mode)
        {
            Object rawasset = null;;

            Object[] rawassets = null;
            if (mode == 0)
            {
                rawasset = AssetDatabase.LoadAssetAtPath(assetName, type);
                if (rawasset == null)
                {
                    return(new SimulateAssetLoadRequest((SimulateAsset)null));
                }
            }
            else if (mode == 1)
            {
                rawassets = AssetDatabase.LoadAllAssetsAtPath(assetName);
                if (rawassets == null)
                {
                    return(new SimulateAssetLoadRequest((SimulateAsset)null));
                }
            }

            string         bundleName = ResourceUtils.ConvertToABName(assetName) + ".ab";
            SimulateBundle bundle     = LoadBundle(bundleName) as SimulateBundle;

            if (mode == 0)
            {
                var asset = new SimulateAsset(rawasset, assetName, bundle);
                return(new SimulateAssetLoadRequest(asset));
            }
            else if (mode == 1)
            {
                List <SimulateAsset> li = new List <SimulateAsset>();
                foreach (var raw in rawassets)
                {
                    li.Add(new SimulateAsset(raw, assetName, bundle));
                }
                return(new SimulateAssetLoadRequest(li.ToArray()));
            }
            else
            {
                return(new SimulateAssetLoadRequest((SimulateAsset)null));
            }
        }
Beispiel #5
0
 public SimulateAsset(Object asset, string assetName, SimulateBundle bundle)
 {
     this.asset  = asset;
     this.bundle = bundle;
     AssetName   = assetName;
 }