Пример #1
0
 /**
  * Serialized constructor.
  */
 public pb_MetaData(SerializationInfo info, StreamingContext context)
 {
     _fileId          = (string)info.GetValue("_fileId", typeof(string));
     _assetBundlePath = (pb_AssetBundlePath)info.GetValue("_assetBundlePath", typeof(pb_AssetBundlePath));
     _assetType       = (AssetType)info.GetValue("_assetType", typeof(AssetType));
     componentDiff    = (pb_ComponentDiff)info.GetValue("componentDiff", typeof(pb_ComponentDiff));
 }
Пример #2
0
        private bool _GetAssetPath <T>(T asset, out pb_AssetBundlePath path) where T : UnityEngine.Object
        {
            foreach (string bundle_path in availableAssetBundles)
            {
                try
                {
                    AssetBundle bundle = _LoadAssetBundle(bundle_path);

                    foreach (KeyValuePair <string, UnityEngine.Object> kvp in LoadBundleAssetsWithPaths(bundle))
                    {
                        if (kvp.Value.GetType() == typeof(T))
                        {
                            path = new pb_AssetBundlePath(bundle_path, kvp.Key);

                            return(true);
                        }
                    }
                }

                catch (System.Exception e)
                {
                    Debug.LogWarning("Failed loading AssetBundle: " + bundle_path + "\n" + e.ToString());
                }
            }

            path = null;

            return(false);
        }
Пример #3
0
		/**
		 * Serialized constructor.
		 */
		public pb_MetaData(SerializationInfo info, StreamingContext context)
		{
			_fileId				= (string) info.GetValue("_fileId", typeof(string));
			_assetBundlePath	= (pb_AssetBundlePath) info.GetValue("_assetBundlePath", typeof(pb_AssetBundlePath));
			_assetType			= (AssetType) info.GetValue("_assetType", typeof(AssetType));
			componentDiff		= (pb_ComponentDiff) info.GetValue(	"componentDiff", typeof(pb_ComponentDiff));
		}
Пример #4
0
        /**
         * Basic constructor (used on instance assets).
         */
        public pb_MetaData()
        {
            _assetType       = AssetType.Instance;
            _fileId          = GUID_NOT_FOUND;
            _assetBundlePath = null;

            componentDiff = new pb_ComponentDiff();
        }
Пример #5
0
		/**
		 * Basic constructor (used on instance assets).
		 */
		public pb_MetaData()
		{
			_assetType = AssetType.Instance;
			_fileId = GUID_NOT_FOUND;
			_assetBundlePath = null;

			componentDiff = new pb_ComponentDiff();
		}
Пример #6
0
        private T _LoadAsset <T>(pb_AssetBundlePath path) where T : UnityEngine.Object
        {
            AssetBundle bundle = _LoadAssetBundleWithName(path.assetBundleName);

            if (bundle == null)
            {
                return((T)null);
            }

            if (bundle.Contains(path.filePath))
            {
                T obj = bundle.LoadAsset <T>(path.filePath);

                return(obj);
            }

            return((T)null);
        }
Пример #7
0
 /**
  * Load an asset from a pb_AssetBundlePath.
  */
 public static T LoadAsset <T>(pb_AssetBundlePath path) where T : UnityEngine.Object
 {
     return(pb_AssetBundles.instance._LoadAsset <T>(path));
 }
Пример #8
0
 /**
  * Return the AssetBundle and path within that bundle to an object.
  * May return a null or emptry string.
  */
 public static bool GetAssetPath <T>(T asset, out pb_AssetBundlePath path) where T : UnityEngine.Object
 {
     return(pb_AssetBundles.instance._GetAssetPath <T>(asset, out path));
 }
Пример #9
0
 /**
  * Set the asset bundle information.
  */
 public void SetAssetBundleData(string bundleName, string assetPath)
 {
     _fileId          = ASSET_BUNDLE;
     _assetType       = AssetType.Bundle;
     _assetBundlePath = new pb_AssetBundlePath(bundleName, assetPath);
 }
Пример #10
0
 /**
  * Set the fileID field if this asset is in the resources folder.
  */
 public void SetFileId(string id)
 {
     _assetType       = AssetType.Resource;
     _assetBundlePath = null;
     _fileId          = id;
 }
Пример #11
0
		/**
		 * Set the fileID field if this asset is in the resources folder.
		 */
		public void SetFileId(string id)
		{
			_assetType = AssetType.Resource;
			_assetBundlePath = null;
			_fileId = id;
		}
Пример #12
0
		/**
		 * Set the asset bundle information.
		 */
		public void SetAssetBundleData(string bundleName, string assetPath)
		{
			_fileId = ASSET_BUNDLE;
			_assetType = AssetType.Bundle;
			_assetBundlePath = new pb_AssetBundlePath(bundleName, assetPath);
		}