Beispiel #1
0
        protected override void OnCreate(UnityEngine.Object asset)
        {
            if (asset == null)
            {
                return;
            }
            TextAsset desc = asset as TextAsset;

            package = UIPackage.AddPackage(desc.bytes, null, (string name, string extension, Type type, out DestroyMethod destroyMethod) =>
            {
                destroyMethod    = DestroyMethod.None;
                string assetPath = string.Format("{0}/{1}_{2}.fui", uiMrg.windowFolder, package.name, name).ToLower();
                UIPackageDependenceObject depence = null;
                if (!loading.TryGetValue(assetPath, out depence))
                {
                    if (!dependences.TryGetValue(assetPath, out depence))
                    {
                        depence = RenderFactory.CreateInstance <UIPackageDependenceObject>(assetPath, this);
                        loading.Add(assetPath, depence);
                    }
                }

                return(depence.asset);
            });
        }
Beispiel #2
0
        public UIPackageAsset(string packageName, UIManager uiMrg, UIPackageDependenceAsset dependenceAsset)
        {
            this.uiMrg           = uiMrg;
            this.dependenceAsset = dependenceAsset;

            List <string> dpFiles = dependenceAsset.GetDependenceFiles(packageName);

            for (int i = 0; i < dpFiles.Count; i++)
            {
                string[] fileNames = dpFiles[i].Split('.');
                string   assetPath = string.Format("{0}/{1}.fui", uiMrg.windowFolder, fileNames[0]).ToLower();
                UIPackageDependenceObject depence = RenderFactory.CreateInstance <UIPackageDependenceObject>(assetPath, this);
                loading.Add(assetPath, depence);
            }
        }