FairyGUI.UIPackage.Create C# (CSharp) Method

Create() private method

private Create ( string desc, AssetBundle res, string mainAssetName ) : void
desc string
res UnityEngine.AssetBundle
mainAssetName string
return void
        void Create(string desc, AssetBundle res, string mainAssetName)
        {
            _descPack = new Dictionary<string, string>();
            _resBundle = res;

            DecodeDesc(desc);

            if (res != null)
            {
                if (mainAssetName != null && mainAssetName.Length > 0)
                    _assetNamePrefix = mainAssetName + "@";
                else
                    _assetNamePrefix = "";
                _fromBundle = true;
            }
            else
            {
                _assetNamePrefix = mainAssetName + "@";
                _fromBundle = false;
            }

            LoadPackage();
        }

Usage Example

Example #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;
		}
All Usage Examples Of FairyGUI.UIPackage::Create