guodong 1 anno fa
parent
commit
6e6c150ae4
32 ha cambiato i file con 226 aggiunte e 328 eliminazioni
  1. 8 3
      GameClient/Assets/GFGAsset/AssetBundleCollector.asset
  2. 10 7
      GameClient/Assets/Game/HotUpdate/Controller/GameController.cs
  3. 2 0
      GameClient/Assets/Game/HotUpdate/Data/Handler/RoleDataHandler.cs
  4. 135 0
      GameClient/Assets/Game/HotUpdate/FairyGUI/GFGUIPackage.cs
  5. 1 1
      GameClient/Assets/Game/HotUpdate/FairyGUI/GFGUIPackage.cs.meta
  6. 40 0
      GameClient/Assets/Game/HotUpdate/Font/FontLoader.cs
  7. 0 0
      GameClient/Assets/Game/HotUpdate/Font/FontLoader.cs.meta
  8. 0 38
      GameClient/Assets/Game/HotUpdate/Font/FontManager.cs
  9. 1 1
      GameClient/Assets/Game/HotUpdate/GFGAsset.meta
  10. 0 0
      GameClient/Assets/Game/HotUpdate/GFGAsset/AssetReleaser.cs
  11. 0 0
      GameClient/Assets/Game/HotUpdate/GFGAsset/AssetReleaser.cs.meta
  12. 1 3
      GameClient/Assets/Game/HotUpdate/GFGAsset/PrefabManager.cs
  13. 0 0
      GameClient/Assets/Game/HotUpdate/GFGAsset/PrefabManager.cs.meta
  14. 1 1
      GameClient/Assets/Game/HotUpdate/Sound.meta
  15. 1 0
      GameClient/Assets/Game/HotUpdate/Sound/MusicManager.cs
  16. 0 0
      GameClient/Assets/Game/HotUpdate/Sound/MusicManager.cs.meta
  17. 1 0
      GameClient/Assets/Game/HotUpdate/Sound/SoundManager.cs
  18. 0 0
      GameClient/Assets/Game/HotUpdate/Sound/SoundManager.cs.meta
  19. 1 1
      GameClient/Assets/Game/HotUpdate/Views/UIView.cs
  20. 2 1
      GameClient/Assets/Game/HotUpdate/Views/ViewManager.cs
  21. 0 10
      GameClient/Assets/Game/Launcher/FairyGUI/FGUILauncher.cs
  22. 4 6
      GameClient/Assets/Game/Launcher/FairyGUI/GFGGLoader.cs
  23. 0 88
      GameClient/Assets/Game/Launcher/FairyGUI/GFGUIPackage.cs
  24. 0 5
      GameClient/Assets/Game/Launcher/LocalCache/LocalCache.cs
  25. 0 114
      GameClient/Assets/Game/Launcher/Version/VersionController.cs
  26. 0 8
      GameClient/Assets/Game/Launcher/YooAsset.meta
  27. 0 18
      GameClient/Assets/Game/Launcher/YooAsset/YooAssetGfg.cs
  28. 0 11
      GameClient/Assets/Game/Launcher/YooAsset/YooAssetGfg.cs.meta
  29. 1 1
      GameClient/Assets/Scenes/GameLauncher.unity
  30. 3 3
      GameClient/Assets/ThirdParty/FairyGUI/Scripts/UI/UIPackage.cs
  31. 6 0
      GameClient/Assets/UniFramework/UniPooling/Runtime/Spawner.cs
  32. 8 8
      GameClient/Assets/YooAsset/Runtime/PackageSystem/Operations/Internal/DeserializeManifestOperation.cs

+ 8 - 3
GameClient/Assets/GFGAsset/AssetBundleCollector.asset

@@ -17269,7 +17269,7 @@ MonoBehaviour:
       - Assets/Res/model/quan_niuqu.FBX
   - dir: Assets/Res/Material
     status: 0
-    bytes: 928686
+    bytes: 931523
     list:
     - key: Assets/Res/Material/Effect/glow/Fxcaihongglow
       bytes: 2899
@@ -18663,6 +18663,10 @@ MonoBehaviour:
       bytes: 2844
       list:
       - Assets/Res/Material/Effect/yz.mat
+    - key: Assets/Res/Material/Effect/xulie_099
+      bytes: 2837
+      list:
+      - Assets/Res/Material/Effect/xulie_099.mat
   - dir: Assets/Res/Effect/UI
     status: 1
     bytes: 14332665
@@ -19913,10 +19917,10 @@ MonoBehaviour:
       - Assets/Res/Effect/UI/ui_gcdh/5/5/5.1024/texture_02.png
   - dir: Assets/Res/Effect/UI
     status: 1
-    bytes: 8836401
+    bytes: 8837864
     list:
     - key: Assets/Res/Effect/UI/ui_league
-      bytes: 8836401
+      bytes: 8837864
       list:
       - Assets/Res/Effect/UI/ui_league/Answer_bgtx.prefab
       - Assets/Res/Effect/UI/ui_league/Answer_Succeed.prefab
@@ -20046,6 +20050,7 @@ MonoBehaviour:
       - Assets/Res/Effect/UI/ui_league/tea_unlock/lock02/suipian/66/66.prefab
       - Assets/Res/Effect/UI/ui_league/tea_unlock/lock02/suipian/66/Material1.mat
       - Assets/Res/Effect/UI/ui_league/tea_unlock/lock02/suipian/lizi/lizi.prefab
+      - Assets/Res/Effect/UI/ui_league/tea_nolearn/NewMaterial5.mat
   - dir: Assets/Res/Effect/UI
     status: 1
     bytes: 6323576

+ 10 - 7
GameClient/Assets/Game/HotUpdate/Controller/GameController.cs

@@ -9,20 +9,21 @@ namespace GFGGame
     public class GameController
     {
 
-        public static void Start()
+        public static async void Start()
         {
-            //字体
-            FontLoader.Instance.Init();
             //GameObject对象池
             PrefabManager.Instance.Init();
+            //字体
+            await FontLoader.Instance.Init();
+            //通用资源
+            await GFGUIPackage.AddPackageAsync(ResPathUtil.GetUIPackagePath("Common"));
+            //GFGUIPackage.AddPackage(ResPathUtil.GetUIPackagePath("Common"));
             //界面
             ViewManager.Init();
             //日志
             LogController.Instance.Init();
             //全局
             GameGlobal.Init();
-            //缓存
-            LocalCache.InitLocalData();
             //sqlite
             SqliteController.Instance.Init(false, ResPathUtil.SQLITE_FILE_PATH);
             //全局点击效果
@@ -102,8 +103,10 @@ namespace GFGGame
             QDManager.OnEnterGame();
             RoleDataHandler.StartUpdate();
 
-            GFGUIPackage.AddPackage(ResPathUtil.GetUIPackagePath("CommonGame"));
-            GFGUIPackage.AddPackage(ResPathUtil.GetUIPackagePath("Main"));
+            await GFGUIPackage.AddPackageAsync(ResPathUtil.GetUIPackagePath("CommonGame"));
+            await GFGUIPackage.AddPackageAsync(ResPathUtil.GetUIPackagePath("Main"));
+            //GFGUIPackage.AddPackage(ResPathUtil.GetUIPackagePath("CommonGame"));
+            //GFGUIPackage.AddPackage(ResPathUtil.GetUIPackagePath("Main"));
 
             LeagueSproxy.ReqGetLeagueInfo().Coroutine();
             await ItemProxy.GetItemInfos();

+ 2 - 0
GameClient/Assets/Game/HotUpdate/Data/Handler/RoleDataHandler.cs

@@ -1,5 +1,6 @@
 using ET;
 using FairyGUI;
+using YooAsset;
 
 namespace GFGGame
 {
@@ -45,6 +46,7 @@ namespace GFGGame
             if (seconds >= TimeUtil.SECOND_PER_MUNITE * 1)
             {
                 ViewManager.CheckDispose();
+                YooAssets.GetPackage(VersionController.DefaultPackage)?.UnloadUnusedAssets();
                 seconds = 0;
             }
             seconds++;

+ 135 - 0
GameClient/Assets/Game/HotUpdate/FairyGUI/GFGUIPackage.cs

@@ -0,0 +1,135 @@
+using FairyGUI;
+using System.Collections.Generic;
+using System.Threading.Tasks;
+using UnityEngine;
+using YooAsset;
+
+namespace GFGGame
+{
+    public class GFGUIPackage
+    {
+        private static Dictionary<string, UIPackage> _packages = new Dictionary<string, UIPackage>();
+        private static Dictionary<string, List<AssetOperationHandle>> assetHandleCacheDic = new Dictionary<string, List<AssetOperationHandle>>();
+        private static Dictionary<string, int> _assetCount = new Dictionary<string, int>();
+
+        public static void AddPackage(string descFilePath)
+        {
+            _assetCount.TryGetValue(descFilePath, out var count);
+            if (count > 0)
+            {
+                _assetCount[descFilePath] = count + 1;
+                return;
+            }
+            _assetCount.Add(descFilePath, count + 1);
+            var handle = YooAssets.LoadAssetSync<TextAsset>($"{descFilePath}_fui.bytes");
+            TextAsset textAsset = handle.AssetObject as TextAsset;
+            CacheAssetHandle(descFilePath, handle);
+            var uiPackage = UIPackage.AddPackage(textAsset.bytes, descFilePath, (string name, string extension, System.Type type, out DestroyMethod destroyMethod) =>
+            {
+                string location = name + extension;
+                destroyMethod = DestroyMethod.None; //注意:这里一定要设置为None
+                if(!YooAssets.CheckDressUpResExist(location))
+                {
+                    return null;
+                }
+                var handle = YooAssets.LoadAssetSync(location, type);
+                CacheAssetHandle(descFilePath, handle);
+                return handle.AssetObject;
+            });
+
+            _packages.Add(descFilePath, uiPackage);
+        }
+
+        public static async Task AddPackageAsync(string descFilePath)
+        {
+            _assetCount.TryGetValue(descFilePath, out var count);
+            if (count > 0)
+            {
+                _assetCount[descFilePath] = count + 1;
+                return;
+            }
+            _assetCount.Add(descFilePath, count + 1);
+            var handle = YooAssets.LoadAssetAsync<TextAsset>($"{descFilePath}_fui.bytes");
+            await handle.Task;
+            TextAsset textAsset = handle.AssetObject as TextAsset;
+            CacheAssetHandle(descFilePath, handle);
+            var uiPackage = UIPackage.AddPackage(textAsset.bytes, descFilePath, (string name, string extension, System.Type type, PackageItem item) =>
+            {
+                string location = name + extension;
+                if (!YooAssets.CheckDressUpResExist(location))
+                {
+                    return;
+                }
+                AssetOperationHandle handle = YooAssets.LoadAssetAsync(location, type);
+                CacheAssetHandle(descFilePath, handle);
+                handle.Completed += (handle) =>
+                {
+                    if (handle.AssetObject == null) return;
+                    Texture tex = handle.AssetObject as Texture;
+                    if(tex != null)
+                    {
+                        string location = name + "!a" + extension;
+                        if (YooAssets.CheckDressUpResExist(location))
+                        {
+                            AssetOperationHandle handleAlpha = YooAssets.LoadAssetAsync(location, type);
+                            CacheAssetHandle(descFilePath, handleAlpha);
+                            handleAlpha.Completed += (handle1) =>
+                            {
+                                if (handle1.AssetObject == null) return;
+                                Texture alphaTex = handle1.AssetObject as Texture;
+                                item.owner.SetItemAsset(item, tex, alphaTex, DestroyMethod.None);//注意:这里一定要设置为None
+                            };
+                            return;
+                        }
+                    }
+                    item.owner.SetItemAsset(item, handle.AssetObject, null, DestroyMethod.None);//注意:这里一定要设置为None
+                };
+            });
+            _packages.Add(descFilePath, uiPackage);
+            CheckRemovePackage(descFilePath);
+        }
+
+
+        public static void ReleasePackage(string descFilePath)
+        {
+            _assetCount.TryGetValue(descFilePath, out var count);
+            if (count > 0)
+            {
+                count--;
+                _assetCount[descFilePath] = count;
+                CheckRemovePackage(descFilePath);
+            }
+        }
+
+        private static void CheckRemovePackage(string descFilePath)
+        {
+            _assetCount.TryGetValue(descFilePath, out var count);
+            if (count > 0) return;
+            _packages.TryGetValue(descFilePath, out var package);
+            if (package == null) return;
+            _assetCount.Remove(descFilePath);
+            _packages.Remove(descFilePath);
+            UIPackage.RemovePackage(package.name);
+
+            if (assetHandleCacheDic.TryGetValue(descFilePath, out var list))
+            {
+                foreach (var asset in list)
+                {
+                    asset.Release();
+                }
+                list.Clear();
+            }
+        }
+
+        private static void CacheAssetHandle(string key, AssetOperationHandle handle)
+        {
+            List<AssetOperationHandle> list = null;
+            if (!assetHandleCacheDic.TryGetValue(key, out list))
+            {
+                list = new List<AssetOperationHandle>();
+                assetHandleCacheDic.Add(key, list);
+            }
+            list.Add(handle);
+        }
+    }
+}

+ 1 - 1
GameClient/Assets/Game/Launcher/FairyGUI/GFGUIPackage.cs.meta → GameClient/Assets/Game/HotUpdate/FairyGUI/GFGUIPackage.cs.meta

@@ -1,5 +1,5 @@
 fileFormatVersion: 2
-guid: 1b5b26facf21ce94db3dc794e85945c0
+guid: 25ef7cb021e838d4a8d885f75a9c8849
 MonoImporter:
   externalObjects: {}
   serializedVersion: 2

+ 40 - 0
GameClient/Assets/Game/HotUpdate/Font/FontLoader.cs

@@ -0,0 +1,40 @@
+using FairyGUI;
+using System.Threading.Tasks;
+using UnityEngine;
+using YooAsset;
+
+namespace GFGGame
+{
+    public class FontLoader : SingletonBase<FontLoader>
+    {
+        public async Task Init()
+        {
+
+            Font font0 = await LoadFontAsync(ResPathUtil.GetFontPath("FangZhengHeiTiJianTi-1", "ttf"));
+            FontManager.RegisterFont(new DynamicFont("FangZhengHeiTiJianTi-1", font0));
+            Font font1 = await LoadFontAsync(ResPathUtil.GetFontPath("FZKTJW--GB1-0", "ttf"));
+            FontManager.RegisterFont(new DynamicFont("FZKTJW--GB1-0", font1));
+            Font font2 = await LoadFontAsync(ResPathUtil.GetFontPath("SourceHanSerifCN-Regular-1", "otf"));
+            FontManager.RegisterFont(new DynamicFont("SourceHanSerifCN-Regular-1", font2));
+            Font font3 = await LoadFontAsync(ResPathUtil.GetFontPath("SourceHanSerifCN-Bold-2", "otf"));
+            FontManager.RegisterFont(new DynamicFont("SourceHanSerifCN-Bold-2", font3));
+            Font font4 = await LoadFontAsync(ResPathUtil.GetFontPath("SourceHanSerifCN-ExtraLight-3", "otf"));
+            FontManager.RegisterFont(new DynamicFont("SourceHanSerifCN-ExtraLight-3", font4));
+            Font font5 = await LoadFontAsync(ResPathUtil.GetFontPath("SourceHanSerifCN-Heavy-4", "otf"));
+            FontManager.RegisterFont(new DynamicFont("SourceHanSerifCN-Heavy-4", font5));
+            Font font6 = await LoadFontAsync(ResPathUtil.GetFontPath("SourceHanSerifCN-Light-5", "otf"));
+            FontManager.RegisterFont(new DynamicFont("SourceHanSerifCN-Light-5", font6));
+            Font font7 = await LoadFontAsync(ResPathUtil.GetFontPath("SourceHanSerifCN-Medium-6", "otf"));
+            FontManager.RegisterFont(new DynamicFont("SourceHanSerifCN-Medium-6", font7));
+            Font font8 = await LoadFontAsync(ResPathUtil.GetFontPath("SourceHanSerifCN-SemiBold-7", "otf"));
+            FontManager.RegisterFont(new DynamicFont("SourceHanSerifCN-SemiBold-7", font8));
+        }
+
+        private async Task<Font> LoadFontAsync(string resPath)
+        {
+            AssetOperationHandle handle = YooAssets.LoadAssetAsync<Font>(resPath);
+            await handle.Task;
+            return handle.AssetObject as Font;
+        }
+    }
+}

+ 0 - 0
GameClient/Assets/Game/HotUpdate/Font/FontManager.cs.meta → GameClient/Assets/Game/HotUpdate/Font/FontLoader.cs.meta


+ 0 - 38
GameClient/Assets/Game/HotUpdate/Font/FontManager.cs

@@ -1,38 +0,0 @@
-using FairyGUI;
-using UnityEngine;
-using YooAsset;
-
-namespace GFGGame
-{
-    public class FontLoader : SingletonBase<FontLoader>
-    {
-        public void Init()
-        {
-
-            Font font0 = LoadFont(ResPathUtil.GetFontPath("FangZhengHeiTiJianTi-1", "ttf"));
-            FontManager.RegisterFont(new DynamicFont("FangZhengHeiTiJianTi-1", font0));
-            Font font1 = LoadFont(ResPathUtil.GetFontPath("FZKTJW--GB1-0", "ttf"));
-            FontManager.RegisterFont(new DynamicFont("FZKTJW--GB1-0", font1));
-            Font font2 = LoadFont(ResPathUtil.GetFontPath("SourceHanSerifCN-Regular-1", "otf"));
-            FontManager.RegisterFont(new DynamicFont("SourceHanSerifCN-Regular-1", font2));
-            Font font3 = LoadFont(ResPathUtil.GetFontPath("SourceHanSerifCN-Bold-2", "otf"));
-            FontManager.RegisterFont(new DynamicFont("SourceHanSerifCN-Bold-2", font3));
-            Font font4 = LoadFont(ResPathUtil.GetFontPath("SourceHanSerifCN-ExtraLight-3", "otf"));
-            FontManager.RegisterFont(new DynamicFont("SourceHanSerifCN-ExtraLight-3", font4));
-            Font font5 = LoadFont(ResPathUtil.GetFontPath("SourceHanSerifCN-Heavy-4", "otf"));
-            FontManager.RegisterFont(new DynamicFont("SourceHanSerifCN-Heavy-4", font5));
-            Font font6 = LoadFont(ResPathUtil.GetFontPath("SourceHanSerifCN-Light-5", "otf"));
-            FontManager.RegisterFont(new DynamicFont("SourceHanSerifCN-Light-5", font6));
-            Font font7 = LoadFont(ResPathUtil.GetFontPath("SourceHanSerifCN-Medium-6", "otf"));
-            FontManager.RegisterFont(new DynamicFont("SourceHanSerifCN-Medium-6", font7));
-            Font font8 = LoadFont(ResPathUtil.GetFontPath("SourceHanSerifCN-SemiBold-7", "otf"));
-            FontManager.RegisterFont(new DynamicFont("SourceHanSerifCN-SemiBold-7", font8));
-        }
-
-        private Font LoadFont(string resPath)
-        {
-            AssetOperationHandle handle = YooAssets.LoadAssetSync<Font>(resPath);
-            return handle.AssetObject as Font;
-        }
-    }
-}

+ 1 - 1
GameClient/Assets/Game/Launcher/GFGAsset.meta → GameClient/Assets/Game/HotUpdate/GFGAsset.meta

@@ -1,5 +1,5 @@
 fileFormatVersion: 2
-guid: 4b261e93104c6d24b99bd0d63fd85b2f
+guid: 38c8434e2353df54fb7fae35a06738cb
 folderAsset: yes
 DefaultImporter:
   externalObjects: {}

+ 0 - 0
GameClient/Assets/Game/Launcher/GFGAsset/AssetReleaser.cs → GameClient/Assets/Game/HotUpdate/GFGAsset/AssetReleaser.cs


+ 0 - 0
GameClient/Assets/Game/Launcher/GFGAsset/AssetReleaser.cs.meta → GameClient/Assets/Game/HotUpdate/GFGAsset/AssetReleaser.cs.meta


+ 1 - 3
GameClient/Assets/Game/Launcher/GFGAsset/PrefabManager.cs → GameClient/Assets/Game/HotUpdate/GFGAsset/PrefabManager.cs

@@ -8,7 +8,6 @@ namespace GFGGame
     public class PrefabManager : SingletonBase<PrefabManager>
     {
         private Spawner _entitySpawner;
-        private Dictionary<string, bool> poolCreated = new Dictionary<string, bool>();
 
         public void Init()
         {
@@ -18,8 +17,7 @@ namespace GFGGame
 
         public GameObject SpawnSync(string resPath)
         {
-            this.poolCreated.TryGetValue(resPath, out bool poolCreated);
-            if (!poolCreated)
+            if (!_entitySpawner.IsGameObjectPoolExisted(resPath))
             {
                 // 创建游戏对象池,销毁时间单位为秒
                 _entitySpawner.CreateGameObjectPoolAsync(resPath, false, 0, 1, 60);

+ 0 - 0
GameClient/Assets/Game/Launcher/GFGAsset/PrefabManager.cs.meta → GameClient/Assets/Game/HotUpdate/GFGAsset/PrefabManager.cs.meta


+ 1 - 1
GameClient/Assets/Game/Launcher/Sound.meta → GameClient/Assets/Game/HotUpdate/Sound.meta

@@ -1,5 +1,5 @@
 fileFormatVersion: 2
-guid: 081216cfb7b10b2489559cc1acfd5722
+guid: 9ac5314914dee814eac4321a146bda5a
 folderAsset: yes
 DefaultImporter:
   externalObjects: {}

+ 1 - 0
GameClient/Assets/Game/Launcher/Sound/MusicManager.cs → GameClient/Assets/Game/HotUpdate/Sound/MusicManager.cs

@@ -44,6 +44,7 @@ namespace GFGGame
         {
             player = this.gameObject.AddComponent<AudioSource>();
             player.loop = true;
+            isOn = LocalCache.GetBool(LauncherConfig.MUSIC_KEY, true);
         }
 
         private void Start() 

+ 0 - 0
GameClient/Assets/Game/Launcher/Sound/MusicManager.cs.meta → GameClient/Assets/Game/HotUpdate/Sound/MusicManager.cs.meta


+ 1 - 0
GameClient/Assets/Game/Launcher/Sound/SoundManager.cs → GameClient/Assets/Game/HotUpdate/Sound/SoundManager.cs

@@ -41,6 +41,7 @@ namespace GFGGame
         private void Awake()
         {
             player = this.gameObject.AddComponent<AudioSource>();
+            isOn = LocalCache.GetBool(LauncherConfig.SOUND_KEY, true);
         }
 
         private void Start() 

+ 0 - 0
GameClient/Assets/Game/Launcher/Sound/SoundManager.cs.meta → GameClient/Assets/Game/HotUpdate/Sound/SoundManager.cs.meta


+ 1 - 1
GameClient/Assets/Game/HotUpdate/Views/UIView.cs

@@ -95,7 +95,7 @@ namespace GFGGame
             {
                 if (packageName != ResPathUtil.GetUIPackagePath("CommonGame") && packageName != ResPathUtil.GetUIPackagePath("Common") && packageName != ResPathUtil.GetUIPackagePath("Main"))
                 {
-                    GFGUIPackage.RemovePackage(_descFilePath);
+                    GFGUIPackage.ReleasePackage(_descFilePath);
                 } //这几个包不释放
             }
             _descFilePath = null;

+ 2 - 1
GameClient/Assets/Game/HotUpdate/Views/ViewManager.cs

@@ -5,6 +5,7 @@ using FairyGUI;
 using System.Linq;
 using ET;
 using YooAsset;
+using System.Threading.Tasks;
 
 namespace GFGGame
 {
@@ -27,7 +28,7 @@ namespace GFGGame
 
         public static void Init()
         {
-            GFGUIPackage.AddPackage(ResPathUtil.GetUIPackagePath("Common"));
+            //await GFGUIPackage.AddPackageAsync(ResPathUtil.GetUIPackagePath("Common"));
             UIConfig.buttonSound = (NAudioClip)UIPackage.GetItemAsset("Common", "click");
 
             UIConfig.defaultFont = "FZKTJW--GB1-0";

+ 0 - 10
GameClient/Assets/Game/Launcher/FairyGUI/FGUILauncher.cs

@@ -4,18 +4,8 @@ namespace GFGGame
 {
     public class FGUILauncher
     {
-
         public static void Init()
         {
-#if (UNITY_5 || UNITY_5_3_OR_NEWER)
-            //Use the font names directly
-            UIConfig.defaultFont = "Microsoft YaHei";
-#else
-        //Need to put a ttf file into Resources folder. Here is the file name of the ttf file.
-        // UIExcelConfig.defaultFont = "afont";
-#endif
-            //对于FGUI来说,其内部在执行 `UIPackage.RemovePackage` 时会进行`ab.Unload(true)`操作,应该是个很贴心的设计,但我们xasset需要管理资源的引用计数,所以不需要这个贴心的功能,故:
-            UIPackage.unloadBundleByFGUI = false;
             //设置CustomLoader
             UIObjectFactory.SetLoaderExtension(typeof(GFGGLoader));
         }

+ 4 - 6
GameClient/Assets/Game/Launcher/FairyGUI/GFGGLoader.cs

@@ -10,19 +10,17 @@ namespace GFGGame
 
         protected override void LoadExternal()
         {
-            //Texture2D texture = GFGAsset.Load<Texture2D>(this.url);
+            if (!YooAssets.CheckDressUpResExist(this.url))
+            {
+                return;
+            }
             handle = YooAssets.LoadAssetAsync<Texture2D>(this.url);
             handle.Completed += Handle_Completed;
-            //if (texture != null)
-            //    onExternalLoadSuccess(new NTexture(texture));
-            //else
-            //    onExternalLoadFailed();
         }
 
         protected override void FreeExternal(NTexture texture)
         {
             //释放外部载入的资源
-            //GFGAsset.Release(this.url);
             if(handle != null)
             {
                 handle.Release();

+ 0 - 88
GameClient/Assets/Game/Launcher/FairyGUI/GFGUIPackage.cs

@@ -1,88 +0,0 @@
-using FairyGUI;
-using System.Collections.Generic;
-using UnityEngine;
-using YooAsset;
-
-namespace GFGGame
-{
-    public class GFGUIPackage
-    {
-        private static Dictionary<string, UIPackage> _packages = new Dictionary<string, UIPackage>();
-        private static Dictionary<string, List<AssetOperationHandle>> _assetDic = new Dictionary<string, List<AssetOperationHandle>>();
-        private static Dictionary<string, int> _assetCount = new Dictionary<string, int>();
-
-        public static UIPackage AddPackage(string descFilePath)
-        {
-            int count = _assetCount.ContainsKey(descFilePath) ? _assetCount[descFilePath] : 0;
-            if (_packages.ContainsKey(descFilePath))
-            {
-                _assetCount[descFilePath] = count + 1;
-                return _packages[descFilePath];
-            }
-            //var asset = Asset.Load($"{descFilePath}_fui.bytes", typeof(TextAsset));
-            var handle = YooAssets.LoadAssetSync<TextAsset>($"{descFilePath}_fui.bytes");
-            TextAsset textAsset = handle.AssetObject as TextAsset;
-            AddAsset(descFilePath, handle);
-            var uiPackage = UIPackage.AddPackage(textAsset.bytes, descFilePath, (string name, string extension, System.Type type, out DestroyMethod destroyMethod) =>
-            {
-                //destroyMethod = DestroyMethod.Unload;
-                string path = name + extension;
-                //if (Versions.Contains(path))
-                //{
-                //    var asset = Asset.Load(path, type);
-                //    AddAsset(descFilePath, asset);
-                //    return asset.asset;
-                //}
-                //return null;
-
-
-                destroyMethod = DestroyMethod.None; //注意:这里一定要设置为None
-                string location = path;
-                var handle = YooAssets.LoadAssetSync(location, type);
-                AddAsset(descFilePath, handle);
-                return handle.AssetObject;
-            });
-            _assetCount.Add(descFilePath, count + 1);
-            _packages.Add(descFilePath, uiPackage);
-            return uiPackage;
-        }
-
-        public static void RemovePackage(string descFilePath)
-        {
-            UIPackage package;
-
-            if (_packages.TryGetValue(descFilePath, out package))
-            {
-                int count = _assetCount[descFilePath] - 1;
-                _assetCount[descFilePath] = count;
-                if (count > 0) return;
-
-                _assetCount.Remove(descFilePath);
-                _packages.Remove(descFilePath);
-                UIPackage.RemovePackage(package.name);
-
-                List<AssetOperationHandle> list = null;
-                if (_assetDic.TryGetValue(descFilePath, out list))
-                {
-                    foreach (var asset in list)
-                    {
-                        asset.Release();
-                    }
-                    list.Clear();
-                }
-
-            }
-        }
-
-        private static void AddAsset(string key, AssetOperationHandle asset)
-        {
-            List<AssetOperationHandle> list = null;
-            if (!_assetDic.TryGetValue(key, out list))
-            {
-                list = new List<AssetOperationHandle>();
-                _assetDic.Add(key, list);
-            }
-            list.Add(asset);
-        }
-    }
-}

+ 0 - 5
GameClient/Assets/Game/Launcher/LocalCache/LocalCache.cs

@@ -18,10 +18,5 @@ namespace GFGGame
             return value > 0;
         }
 
-        public static void InitLocalData()
-        {
-            SoundManager.Instance.isOn = GetBool(LauncherConfig.SOUND_KEY, true);
-            MusicManager.Instance.isOn = GetBool(LauncherConfig.MUSIC_KEY, true);
-        }
     }
 }

+ 0 - 114
GameClient/Assets/Game/Launcher/Version/VersionController.cs

@@ -1,18 +1,12 @@
 using GFGGame.Launcher;
-//using VEngine;
 using System.Collections;
-using System.Collections.Generic;
 using UnityEngine;
 using YooAsset;
-//using dnlib.PE;
-//using VEngine;
-//using UnityEngine.Events;
 
 namespace GFGGame
 {
     public class VersionController : SingletonMonoBase<VersionController>
     {
-        //private UpdateVersions updateVersions;
         public const string DefaultPackage = "GameLogic";
 
         /// <summary>
@@ -30,12 +24,6 @@ namespace GFGGame
 
         public IEnumerator InitVersion()
         {
-            //VEngine.Logger.Loggable = false;
-            //EncryptHelper.resKey = LauncherConfig.resKey;
-            //Versions.DownloadURL = LauncherConfig.CDN_ROOT;
-            //var operation = Versions.InitializeAsync(LauncherConfig.CDN_ROOT);
-            //yield return operation;
-
             yield return InitDefaultPackage();
             yield return GetStaticVersion(DefaultPackage);
             yield return UpdateManifest(DefaultPackage);
@@ -228,107 +216,5 @@ namespace GFGGame
                 return $"{_fallbackHostServer}/{fileName}";
             }
         }
-        //private void StartCheckManifestVersion()
-        //{
-        //    StartCoroutine(CheckManifestVersion());
-        //}
-
-        //private IEnumerator CheckManifestVersion()
-        //{
-        //    if (GameLauncher.Instance.PlayMode == EPlayMode.HostPlayMode)
-        //    {
-        //        LogServerHelperHttp.SendNodeLog((int)LogNode.StartCheckVersion);
-        //        // TODO:生产环境这里的清单名字应该使用带 hash 的版本
-        //        updateVersions = Versions.UpdateAsync(nameof(Manifest) + LauncherConfig.manifest_v);
-        //        while (!updateVersions.isDone)
-        //        {
-        //            if (updateVersions.asset != null && updateVersions.asset.assetVersion != null)
-        //            {
-
-        //                var max = updateVersions.asset.assetVersion.size;
-        //                LauncherView.Instance.SetDesc($"正在校验资源版本...", $"{Utility.FormatBytes(max)}");
-        //                LauncherView.Instance.SetProgress((int)(updateVersions.asset.progress * 100));
-        //            }
-        //            yield return updateVersions;
-        //        };
-        //        if (updateVersions.status == OperationStatus.Failed)
-        //        {
-        //            Alert.Show("更新版本信息失败,请检测网络链接后重试。")
-        //                .SetLeftButton(true, "重试", (data) => { StartCheckManifestVersion(); });
-        //        }
-        //        else
-        //        {
-        //            yield return GetDownloadSize();
-        //        }
-
-
-        //    }
-        //    else
-        //    {
-        //        OnComplete();
-        //    }
-
-
-
-        //}
-
-
-        //private IEnumerator GetDownloadSize()
-        //{
-        //    var getDownloadSize = Versions.GetDownloadSizeAsync(updateVersions);
-        //    var totalCount = getDownloadSize.bundles.Count;
-        //    while(!getDownloadSize.isDone)
-        //    {
-        //        var remainCount = getDownloadSize.bundles.Count;
-        //        LauncherView.Instance.SetDesc($"正在计算更新内容大小...", $"{ totalCount - remainCount }/{totalCount}");
-        //        yield return getDownloadSize;
-        //    }
-        //    if (getDownloadSize.totalSize > 0 || updateVersions.changed)
-        //    {
-        //        string message = $"游戏有新的版本,需要更新{Utility.FormatBytes(getDownloadSize.totalSize)}大小的内容";
-        //        yield return Alert.Show(message)
-        //            .SetLeftButton(true, "更新", (data) => {
-        //                StartDownload(getDownloadSize);
-        //            });
-        //        yield break;
-        //    }
-        //    else
-        //    {
-        //        OnComplete();
-        //    }
-        //}
-
-        //private void StartDownload(GetDownloadSize getDownloadSize)
-        //{
-        //    LogServerHelperHttp.SendNodeLog((int)LogNode.StartDownload);
-        //    StartCoroutine(Downloading(getDownloadSize));
-        //}
-
-        //private IEnumerator Downloading(GetDownloadSize getDownloadSize)
-        //{
-        //    LauncherView.Instance.SetProgress((int)(updateVersions.asset.progress * 100));
-        //    var downloadAsync = Versions.DownloadAsync(getDownloadSize.result.ToArray());
-        //    downloadAsync.updated += downloadAsync =>
-        //    {
-        //        var current = downloadAsync.downloadedBytes; 
-        //         var max = downloadAsync.totalSize;
-        //        var speed = Download.TotalBandwidth;
-        //        LauncherView.Instance.SetDesc($"正在下载资源,速度 {Utility.FormatBytes(speed)}/s", $"{Utility.FormatBytes(current)}/{Utility.FormatBytes(max)}", true); 
-        //        LauncherView.Instance.SetProgress((int)(downloadAsync.progress * 100));
-        //    };
-        //    yield return downloadAsync;
-        //    if (downloadAsync.status == OperationStatus.Failed)
-        //    {
-        //        Alert.Show("下载失败!请检查网络状态后重试。")
-        //            .SetLeftButton(true, "重试", (data) => { 
-        //                StartDownload(getDownloadSize); 
-        //            });
-        //    }
-        //    else
-        //    {
-        //        OnComplete();
-        //    }
-        //}
-
     }
 }

+ 0 - 8
GameClient/Assets/Game/Launcher/YooAsset.meta

@@ -1,8 +0,0 @@
-fileFormatVersion: 2
-guid: 11358ec6a04d2604db3c9ea3029a4399
-folderAsset: yes
-DefaultImporter:
-  externalObjects: {}
-  userData: 
-  assetBundleName: 
-  assetBundleVariant: 

+ 0 - 18
GameClient/Assets/Game/Launcher/YooAsset/YooAssetGfg.cs

@@ -1,18 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-
-namespace YooAsset
-{
-    public class YooAssetGfg
-    {
-        public static bool CheckDressUpResExist()
-        {
-            var p = YooAssets.GetPackage("DressUp");
-            //p.PlayModeServices
-            return false;
-        }
-    }
-}

+ 0 - 11
GameClient/Assets/Game/Launcher/YooAsset/YooAssetGfg.cs.meta

@@ -1,11 +0,0 @@
-fileFormatVersion: 2
-guid: b3bda3aada8fb9646a0b621c48530733
-MonoImporter:
-  externalObjects: {}
-  serializedVersion: 2
-  defaultReferences: []
-  executionOrder: 0
-  icon: {instanceID: 0}
-  userData: 
-  assetBundleName: 
-  assetBundleVariant: 

+ 1 - 1
GameClient/Assets/Scenes/GameLauncher.unity

@@ -596,7 +596,7 @@ MonoBehaviour:
   m_Script: {fileID: 11500000, guid: 4b2b7d724105420439593585dd395c41, type: 3}
   m_Name: 
   m_EditorClassIdentifier: 
-  PlayMode: 2
+  PlayMode: 0
 --- !u!1 &1597865575
 GameObject:
   m_ObjectHideFlags: 0

+ 3 - 3
GameClient/Assets/ThirdParty/FairyGUI/Scripts/UI/UIPackage.cs

@@ -1224,19 +1224,19 @@ namespace FairyGUI
         }
 
         /// <summary>
-        /// 
+        /// !!!魔改alphaTex支持异步加载
         /// </summary>
         /// <param name="item"></param>
         /// <param name="asset"></param>
         /// <param name="destroyMethod"></param>
-        public void SetItemAsset(PackageItem item, object asset, DestroyMethod destroyMethod)
+        public void SetItemAsset(PackageItem item, object asset, Texture alphaTex, DestroyMethod destroyMethod)
         {
             switch (item.type)
             {
                 case PackageItemType.Atlas:
                     if (item.texture == null)
                         item.texture = new NTexture(null, new Rect(0, 0, item.width, item.height));
-                    item.texture.Reload((Texture)asset, null);
+                    item.texture.Reload((Texture)asset, alphaTex);
                     item.texture.destroyMethod = destroyMethod;
                     break;
 

+ 6 - 0
GameClient/Assets/UniFramework/UniPooling/Runtime/Spawner.cs

@@ -255,5 +255,11 @@ namespace UniFramework.Pooling
 			}
 			return null;
 		}
+
+		//扩展
+		public bool IsGameObjectPoolExisted(string location)
+        {
+			return TryGetGameObjectPool(location) != null;
+        }
 	}
 }

+ 8 - 8
GameClient/Assets/YooAsset/Runtime/PackageSystem/Operations/Internal/DeserializeManifestOperation.cs

@@ -151,14 +151,14 @@ namespace YooAsset
 								Manifest.AssetPathMapping1.Add(location, packageAsset.AssetPath);
 
 							// 添加无后缀名路径的映射
-							if (Path.HasExtension(location))
-							{
-								string locationWithoutExtension = PathUtility.RemoveExtension(location);
-								if (Manifest.AssetPathMapping1.ContainsKey(locationWithoutExtension))
-									YooLogger.Warning($"AssetPath have existed : {locationWithoutExtension}");
-								else
-									Manifest.AssetPathMapping1.Add(locationWithoutExtension, packageAsset.AssetPath);
-							}
+							//if (Path.HasExtension(location))
+							//{
+							//	string locationWithoutExtension = PathUtility.RemoveExtension(location);
+							//	if (Manifest.AssetPathMapping1.ContainsKey(locationWithoutExtension))
+							//		YooLogger.Warning($"AssetPath have existed : {locationWithoutExtension}");
+							//	else
+							//		Manifest.AssetPathMapping1.Add(locationWithoutExtension, packageAsset.AssetPath);
+							//}
 						}
 
 						// 填充AssetPathMapping2