Parcourir la source

UI背景加载优化

guodong il y a 1 an
Parent
commit
b82d16f7cf

+ 3 - 3
GameClient/Assets/Game/Launcher/FairyGUI/GFGGLoader.cs → GameClient/Assets/Game/HotUpdate/FairyGUI/GFGGLoader.cs

@@ -6,18 +6,18 @@ namespace GFGGame
 {
     public class GFGGLoader : GLoader
     {
-        private bool ASYNC = true;
 
         private AssetOperationHandle handle;
 
         protected override void LoadExternal()
         {
-            //LogHelper.LogEditor($"GFGGLoader this.url {this.url}");
+            Debug.Log($"GFGGLoader this.url {this.url}");
             if (!YooAssets.CheckResExist(this.url))
             {
                 return;
             }
-            if(ASYNC)
+            bool isAsync = !this.url.Contains(ResPathUtil.TEXTURE_BGIMG_DIR_PATH);
+            if (isAsync)
             {
                 //异步
                 handle = YooAssets.LoadAssetAsync<Texture2D>(this.url);

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

@@ -1,5 +1,5 @@
 fileFormatVersion: 2
-guid: da997e3b3deb1f1488c389cae59cf859
+guid: ac39d27dbe245e74c852900fd166e3cf
 MonoImporter:
   externalObjects: {}
   serializedVersion: 2

+ 6 - 4
GameClient/Assets/Game/HotUpdate/Utils/ResPathUtil.cs

@@ -18,6 +18,9 @@ namespace GFGGame
         public static readonly string MUSIC_DIR_PATH = $"{RES_ROOT_DIR_PATH}/Music";
         public static readonly string SOUND_DIR_PATH = $"{RES_ROOT_DIR_PATH}/Sound";
         public static readonly string TEXTURE_DIR_PATH = $"{RES_ROOT_DIR_PATH}/Texture";
+        public static readonly string TEXTURE_DRESSUP_DIR_PATH = $"{TEXTURE_DIR_PATH}/DressUp";
+        public static readonly string TEXTURE_SCENEBG_DIR_PATH = $"{TEXTURE_DIR_PATH}/SceneBg";
+        public static readonly string TEXTURE_BGIMG_DIR_PATH = $"{TEXTURE_DIR_PATH}/BgImg";
         public static readonly string ANIMATION_DIR_PATH = $"{RES_ROOT_DIR_PATH}/Animation";
         public static readonly string EFFECT_DIR_PATH = $"{RES_ROOT_DIR_PATH}/Effect";
         public static readonly string Material_DIR_PATH = $"{RES_ROOT_DIR_PATH}/Material";
@@ -54,7 +57,7 @@ namespace GFGGame
         }
         public static string GetBgImgPath(string res, string extName = "png")
         {
-            return $"{TEXTURE_DIR_PATH}/BgImg/{res}.{extName}";
+            return $"{TEXTURE_BGIMG_DIR_PATH}/{res}.{extName}";
         }
         public static string GetFightBgImgPath(string res, string extName = "png")
         {
@@ -62,8 +65,7 @@ namespace GFGGame
         }
         public static string GetSceneBgPath(string res, string extName = "jpg")
         {
-            return $"{TEXTURE_DIR_PATH}/SceneBg/{res}.{extName}";
-            //return $"{TEXTURE_DIR_PATH}/DressUp/{res}.{extName}";
+            return $"{TEXTURE_SCENEBG_DIR_PATH}/{res}.{extName}";
         }
         public static string GetDressUpPath(ItemCfg itemCfg, int layerId)
 {
@@ -76,7 +78,7 @@ namespace GFGGame
         }
         public static string GetDressUpPath(string res, string extName = "png")
         {
-            return $"{TEXTURE_DIR_PATH}/DressUp/{res}.{extName}";
+            return $"{TEXTURE_DRESSUP_DIR_PATH}/{res}.{extName}";
         }
         public static string GetNpcPicSPath(string res, string extName = "png")
         {

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

@@ -35,6 +35,8 @@ namespace GFGGame
 
         public static void Init()
         {
+            //设置CustomLoader
+            UIObjectFactory.SetLoaderExtension(typeof(GFGGLoader));
             //通用资源,单独加,增加一次引用,不会被释放
             GFGUIPackage.AddPackage(ResPathUtil.GetUIPackagePath("Common"));
             GFGUIPackage.AddPackage(ResPathUtil.GetUIPackagePath("CommonGame"));

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

@@ -1,13 +0,0 @@
-using FairyGUI;
-
-namespace GFGGame
-{
-    public class FGUILauncher
-    {
-        public static void Init()
-        {
-            //设置CustomLoader
-            UIObjectFactory.SetLoaderExtension(typeof(GFGGLoader));
-        }
-    }
-}

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

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

+ 0 - 1
GameClient/Assets/Game/Launcher/VersionCheker.cs

@@ -17,7 +17,6 @@ namespace GFGGame
             }
 
             LauncherConfig.InitScriptCompilation();
-            FGUILauncher.Init();
 
             HealthAdviceView.Open();
             int time = LauncherConfig.netType == LauncherConfig.EnumNetType.TISHEN ? 10 : 1;