public async ETTask AddPackageAsync(string type)
        {
            if (this.packages.ContainsKey(type))
            {
                return;
            }

            TextAsset desTextAsset =
                await ResourcesComponent.Instance.LoadAssetAsync <TextAsset>(ABPathUtilities.GetFGUIDesPath($"{type}_fui"));

            packages.Add(type, UIPackage.AddPackage(desTextAsset.bytes, type, LoadPackageInternalAsync));
        }
Example #2
0
        public void RemovePackage(string type)
        {
            UIPackage package;

            if (packages.TryGetValue(type, out package))
            {
                var p = UIPackage.GetByName(package.name);

                if (p != null)
                {
                    UIPackage.RemovePackage(package.name);
                }

                packages.Remove(package.name);
            }

            if (!Define.ResModeIsEditor)
            {
                Game.Scene.GetComponent <ResourcesComponent>().UnLoadAsset(ABPathUtilities.GetFGUIDesPath($"{type}_fui"));
                Game.Scene.GetComponent <ResourcesComponent>().UnLoadAsset(ABPathUtilities.GetFGUIResPath($"{type}_atlas0"));
            }
        }