Create() private méthode

private Create ( string desc, AssetBundle res, string mainAssetName ) : void
desc string
res UnityEngine.AssetBundle
mainAssetName string
Résultat void
Exemple #1
0
		public static UIPackage AddPackage(string assetPath, UIPackage.LoadResource loadFunc)
		{
			if (_packageInstById.ContainsKey(assetPath))
				return _packageInstById[assetPath];

			TextAsset asset = (TextAsset)loadFunc(assetPath, ".bytes", typeof(TextAsset));
			if (asset == null)
			{
				if (Application.isPlaying)
					throw new Exception("FairyGUI: Cannot load ui package in '" + assetPath + "'");
				else
					Debug.LogWarning("FairyGUI: Cannot load ui package in '" + assetPath + "'");
			}

			UIPackage pkg = new UIPackage();
			pkg._loadFunc = loadFunc;
			pkg.Create(asset.text, null, assetPath);
			if (_packageInstById.ContainsKey(pkg.id))
				Debug.LogWarning("FairyGUI: Package id conflicts, '" + pkg.name + "' and '" + _packageInstById[pkg.id].name + "'");
			_packageInstById[pkg.id] = pkg;
			_packageInstByName[pkg.name] = pkg;
			_packageInstById[assetPath] = pkg;
			_packageList.Add(pkg);
			pkg.assetPath = assetPath;

			return pkg;
		}
Exemple #2
0
		/// <summary>
		/// Add a UI package from a description text and a assetbundle, with a optional main asset name.
		/// </summary>
		/// <param name="desc">Description text.</param>
		/// <param name="res">A assetbundle contains resources.</param>
		/// <param name="mainAssetName">Main asset name.</param>
		/// <returns>UIPackage</returns>
		public static UIPackage AddPackage(string desc, AssetBundle res, string mainAssetName)
		{
			UIPackage pkg = new UIPackage();
			pkg.Create(desc, res, mainAssetName);
			_packageInstById[pkg.id] = pkg;
			_packageInstByName[pkg.name] = pkg;
			_packageList.Add(pkg);
			return pkg;
		}
        public static UIPackage AddPackage(byte[] desc, AssetBundle res, string resourceNamePrefix)
        {
            UIPackage pkg = new UIPackage();

            pkg.Create(desc, res, resourceNamePrefix);
            _packageInstById[pkg.id]     = pkg;
            _packageInstByName[pkg.name] = pkg;
            return(pkg);
        }
        public static UIPackage AddPackage(string descFilePath)
        {
            UIPackage pkg = new UIPackage();

            pkg.Create(descFilePath);
            _packageInstById[pkg.id]     = pkg;
            _packageInstByName[pkg.name] = pkg;
            pkg.customId = descFilePath;

            return(pkg);
        }
Exemple #5
0
        public static UIPackage AddPackage(string assetPath, UIPackage.LoadResource loadFunc)
        {
            if (_packageInstById.ContainsKey(assetPath))
                return _packageInstById[assetPath];

            TextAsset asset = (TextAsset)loadFunc(assetPath, ".bytes", typeof(TextAsset));
            if (asset == null)
            {
                if (Application.isPlaying)
                    throw new Exception("FairyGUI: Cannot load ui package in '" + assetPath + "'");
                else
                    Debug.LogWarning("FairyGUI: Cannot load ui package in '" + assetPath + "'");
            }

            UIPackage pkg = new UIPackage();
            pkg._loadFunc = loadFunc;
            pkg.Create(asset.text, null, assetPath);
            _packageInstById[pkg.id] = pkg;
            _packageInstByName[pkg.name] = pkg;
            _packageInstById[assetPath] = pkg;
            _packageList.Add(pkg);
            pkg.assetPath = assetPath;

            return pkg;
        }
Exemple #6
0
 /// <summary>
 /// Add a UI package from a description text and a assetbundle, with a optional main asset name.
 /// </summary>
 /// <param name="desc">Description text.</param>
 /// <param name="res">A assetbundle contains resources.</param>
 /// <param name="mainAssetName">Main asset name.</param>
 /// <returns>UIPackage</returns>
 public static UIPackage AddPackage(string desc, AssetBundle res, string mainAssetName)
 {
     UIPackage pkg = new UIPackage();
     pkg.Create(desc, res, mainAssetName);
     _packageInstById[pkg.id] = pkg;
     _packageInstByName[pkg.name] = pkg;
     _packageList.Add(pkg);
     return pkg;
 }
Exemple #7
0
        public static UIPackage AddPackage(string descFilePath)
        {
            UIPackage pkg = new UIPackage();
            pkg.Create(descFilePath);
            _packageInstById[pkg.id] = pkg;
            _packageInstByName[pkg.name] = pkg;
            pkg.customId = descFilePath;

            return pkg;
        }
Exemple #8
0
 public static UIPackage AddPackage(byte[] desc, AssetBundle res, string resourceNamePrefix)
 {
     UIPackage pkg = new UIPackage();
     pkg.Create(desc, res, resourceNamePrefix);
     _packageInstById[pkg.id] = pkg;
     _packageInstByName[pkg.name] = pkg;
     return pkg;
 }