Ver Fonte

场景图单独目录

guodong há 1 ano atrás
pai
commit
faeb40d189

+ 3 - 3
GameClient/Assets/Editor/ArtsRes/ImportArtResTool.cs

@@ -63,15 +63,15 @@ namespace GFGEditor
         public static string BgMd5FileSaveName = "BgMd5";
 
 
-        private static string[] CardBgSrcPaths { get { return new string[] { ResRootPath + "牌/pic/" }; } }
+        private static string[] CardBgSrcPaths { get { return new string[] { ResRootPath + "牌/pic/" }; } }
         public static string CardBgTargetPath = $"{ResPathUtil.TEXTURE_DIR_PATH}/Card/Bg/";
         public static string CardBgMd5FileSaveName = "CardBgMd5";
 
-        private static string[] CardIconSrcPaths { get { return new string[] { ResRootPath + "牌/icon/" }; } }
+        private static string[] CardIconSrcPaths { get { return new string[] { ResRootPath + "牌/icon/" }; } }
         public static string CardIconTargetPath = $"{ResPathUtil.TEXTURE_DIR_PATH}/Card/Card/";
         public static string CardMd5FileSaveName = "CardMd5";
 
-        private static string[] CardSkillSrcPaths { get { return new string[] { ResRootPath + "牌/skill/" }; } }
+        private static string[] CardSkillSrcPaths { get { return new string[] { ResRootPath + "牌/skill/" }; } }
         public static string CardSkillTargetPath = $"{ResPathUtil.TEXTURE_DIR_PATH}/Card/Skill/";
         public static string CardSkillMd5FileSaveName = "CardSkillMd5";
 

+ 3 - 3
GameClient/Assets/Editor/Xasset/Builds/BuildTask.cs

@@ -86,7 +86,7 @@ namespace VEngine.Editor.Builds
             var dressUpItemList = ItemCfgArray.Instance.GetCfgsByitemType(ConstItemType.DRESS_UP);
             foreach (var itemCfg in dressUpItemList)
             {
-                if (itemCfg.isHide <= 0)
+                if (itemCfg.isHide <= 0 || itemCfg.subType == ConstDressUpItemType.BEI_JING)
                 {
                     continue;
                 }
@@ -131,9 +131,9 @@ namespace VEngine.Editor.Builds
 
         private void HideItemRes(ItemCfg itemCfg, int layerId, List<string> hideFilePathList, List<string> hideDirPahtList)
         {
-            string res = DressUpUtil.GetDressUpItemLayerRes(itemCfg, layerId);
+            string res = ResPathUtil.GetDressUpItemLayerRes(itemCfg, layerId);
             //部件图
-            var resPath = ResPathUtil.GetDressUpPath(res, ItemUtil.GetItemResExt(itemCfg.itemType, itemCfg.subType));
+            var resPath = ResPathUtil.GetDressUpPath(itemCfg, layerId);
             hideFilePathList.Add(resPath);
             //动画
             resPath = ResPathUtil.GetDressUpAnimationDirPath(res);

+ 1 - 1
GameClient/Assets/Game/HotUpdate/Data/PhotographSceneManager.cs

@@ -11,7 +11,7 @@ namespace GFGGame
         public void AddBgItem(ItemCfg itemCfg)
         {
             Transform tf = sceneObject.transform.Find("Bg/BgRes");
-            string resPath = ResPathUtil.GetDressUpPath(itemCfg.res, ItemUtil.GetItemResExt(itemCfg.itemType, itemCfg.subType));
+            string resPath = ResPathUtil.GetSceneBgPath(itemCfg.res);
             SetSpriteRendererToTransform(tf, resPath);
             SpriteRenderer spr = tf.GetComponent<SpriteRenderer>();
             spr.sortingOrder = -4000;

+ 12 - 30
GameClient/Assets/Game/HotUpdate/DressUp/DressUpUtil.cs

@@ -141,7 +141,7 @@ namespace GFGGame
         {
             var roleTf = sceneObj.transform.Find(ROLE_OBJ_NAME);
             parentObj = parentObj == null ? roleTf.gameObject : parentObj;
-            string res = HEAD_DEFAULT_RES_NAME;
+            string resPath = ResPathUtil.GetDressUpPath(HEAD_DEFAULT_RES_NAME);
 
             Transform transform_t = parentObj.transform.Find(HEAD_SPRITE_NAME);
             if (show)
@@ -151,7 +151,7 @@ namespace GFGGame
                     transform_t.gameObject.SetActive(true);
                     return;
                 }
-                AddSpriteObj(res, "png", HEAD_SPRITE_NAME, parentObj, 1, needSetMask);
+                AddSpriteObj(resPath, "png", HEAD_SPRITE_NAME, parentObj, 1, needSetMask);
             }
             else
             {
@@ -198,7 +198,7 @@ namespace GFGGame
             }
             else
             {
-                AddSpriteObj(BODY_DEFAULT_RES_NAME, extPng, BODY_SPRITE_NAME, parentObj, 0, needSetMask);
+                AddSpriteObj(ResPathUtil.GetDressUpPath(BODY_DEFAULT_RES_NAME), extPng, BODY_SPRITE_NAME, parentObj, 0, needSetMask);
                 if (removeBodyAni)
                 {
                     parentObj.transform.SetPositionAndRotation(new Vector3(), new Quaternion());
@@ -222,30 +222,13 @@ namespace GFGGame
             assetDisposer.resPath = resPath;
         }
 
-        public static string GetDressUpItemLayerRes(ItemCfg itemCfg, int layerId)
-        {
-            string res = itemCfg.res;
-            switch (layerId)
-            {
-                case 1:
-                    res = itemCfg.resLayer1 == "n" ? res : string.Format("{0}_{1}", res, itemCfg.resLayer1);
-                    break;
-                case 2:
-                    res = itemCfg.resLayer2 == "n" ? res : string.Format("{0}_{1}", res, itemCfg.resLayer2);
-                    break;
-                case 3:
-                    res = itemCfg.resLayer3 == "n" ? res : string.Format("{0}_{1}", res, itemCfg.resLayer3);
-                    break;
-            }
-            return res;
-        }
-
         private static void updateLayerRes(ItemCfg itemCfg, GameObject parentObj, int layerId, bool needSetMask, bool showAni = true)
         {
 
             ItemTypeCfg typeCfg = ItemTypeCfgArray.Instance.GetCfg(itemCfg.subType);
 
-            string res = GetDressUpItemLayerRes(itemCfg, layerId);
+            string res = ResPathUtil.GetDressUpItemLayerRes(itemCfg, layerId);
+            string resPath = ResPathUtil.GetDressUpPath(itemCfg, layerId);
             int sortingOrder = typeCfg.defaultLayer;
             if (layerId == 2)
             {
@@ -266,7 +249,7 @@ namespace GFGGame
             if (DressUpMenuItemCfg1Array.Instance.CheckIsDefaultType(itemCfg.subType))
             {
                 //默认类型的部件需要先添加静态图,防止加载动画有延迟,出现光头
-                spriteObj = AddSpriteObj(res, ext, spritObjName, parentObj, sortingOrder, needSetMask);
+                spriteObj = AddSpriteObj(resPath, ext, spritObjName, parentObj, sortingOrder, needSetMask);
             }
 
             GameObject addAniObj = null;
@@ -292,7 +275,7 @@ namespace GFGGame
                                 {
                                     if (!string.IsNullOrEmpty(assetDisposer.resPath))
                                     {
-                                        string resPath = ResPathUtil.GetDressUpPath(res, ext);
+                                        string resPath = ResPathUtil.GetDressUpPath(itemCfg, layerId);
                                         if (assetDisposer.resPath == resPath)
                                         {
                                             TryRemoveObj(parentObj, spritObjName);
@@ -308,16 +291,15 @@ namespace GFGGame
             if (spriteObj == null && addAniObj == null)
             {
                 //如果两个都没有,就添加静态图
-                spriteObj = AddSpriteObj(res, ext, spritObjName, parentObj, sortingOrder, needSetMask);
+                spriteObj = AddSpriteObj(resPath, ext, spritObjName, parentObj, sortingOrder, needSetMask);
             }
             objName = string.Format(FORMAT_EFFECT_OBJ_NAME, itemCfg.subType, layerId);
             TryRemoveObj(parentObj, objName);
             TryAddEffectObj(res, objName, parentObj, sortingOrder, addAniObj != null);
         }
 
-        private static GameObject AddSpriteObj(string res, string ext, string objName, GameObject parentObj, int sortingOrder, bool needSetMask)
+        private static GameObject AddSpriteObj(string resPath, string ext, string objName, GameObject parentObj, int sortingOrder, bool needSetMask)
         {
-            string resPath = ResPathUtil.GetDressUpPath(res, ext);
             if (!VEngine.Versions.Contains(resPath))
             {
                 return null;
@@ -341,7 +323,7 @@ namespace GFGGame
                 spr = gameObj.AddComponent<SpriteRenderer>();
             }
             float tx, ty;
-            LoadSpritePos(res, out tx, out ty);
+            LoadSpritePos(resPath, out tx, out ty);
             gameObj.transform.localPosition = new Vector3(tx, ty, gameObj.transform.localPosition.z);
             Sprite sp = GFGAsset.Load<Sprite>(resPath);
             spr.sprite = sp;
@@ -485,9 +467,9 @@ namespace GFGGame
             return gameObj;
         }
 
-        public static void LoadSpritePos(string res, out float tx, out float ty)
+        public static void LoadSpritePos(string resPath, out float tx, out float ty)
         {
-            string resPath = ResPathUtil.GetDressUpPath(res, "bytes");
+            resPath = resPath.Replace(".png", ".bytes");
             if (VEngine.Versions.Contains(resPath))
             {
                 var asset = GFGAsset.Load<TextAsset>(resPath);

+ 2 - 2
GameClient/Assets/Game/HotUpdate/DressUp/SceneController.cs

@@ -11,7 +11,7 @@ namespace GFGGame
             //背景
             Transform tf = sceneObj.transform.Find("Bg");
             SpriteRenderer spr = tf.GetComponent<SpriteRenderer>();
-            var resPath = ResPathUtil.GetDressUpPath("jhsy_bg", "jpg");
+            var resPath = ResPathUtil.GetSceneBgPath("jhsy_bg");
             Sprite sp = GFGAsset.Load<Sprite>(resPath);
             DressUpUtil.AddAssetReleaser(tf.gameObject, resPath);
             spr.sprite = sp;
@@ -54,7 +54,7 @@ namespace GFGGame
             }
             else
             {
-                var resPath = ResPathUtil.GetDressUpPath(value, "jpg");
+                var resPath = ResPathUtil.GetSceneBgPath(value);
                 Sprite sp = GFGAsset.Load<Sprite>(resPath);
                 DressUpUtil.AddAssetReleaser(bg.gameObject, resPath);
 

+ 34 - 0
GameClient/Assets/Game/HotUpdate/Utils/ResPathUtil.cs

@@ -1,3 +1,5 @@
+using static UnityEditor.Experimental.GraphView.GraphView;
+
 namespace GFGGame
 {
     public class ResPathUtil
@@ -56,6 +58,19 @@ namespace GFGGame
         {
             return $"{TEXTURE_FIGHT_DIR_PATH}/{res}.{extName}";
         }
+        public static string GetSceneBgPath(string res, string extName = "jpg")
+        {
+            return $"{TEXTURE_DIR_PATH}/SceneBg/{res}.{extName}";
+        }
+        public static string GetDressUpPath(ItemCfg itemCfg, int layerId)
+{
+            string res = GetDressUpItemLayerRes(itemCfg, layerId);
+            if(itemCfg.subType == ConstDressUpItemType.BEI_JING)
+            {
+                return GetSceneBgPath(res);
+            }
+            return GetDressUpPath(res);
+        }
         public static string GetDressUpPath(string res, string extName = "png")
         {
             return $"{TEXTURE_DIR_PATH}/DressUp/{res}.{extName}";
@@ -192,5 +207,24 @@ namespace GFGGame
         {
             return $"{TEXTURE_DIR_PATH}/LeagueIcon/{res}.{extName}";
         }
+
+        public static string GetDressUpItemLayerRes(ItemCfg itemCfg, int layerId)
+        {
+            string res = itemCfg.res;
+            switch (layerId)
+            {
+                case 1:
+                    res = itemCfg.resLayer1 == "n" ? res : string.Format("{0}_{1}", res, itemCfg.resLayer1);
+                    break;
+                case 2:
+                    res = itemCfg.resLayer2 == "n" ? res : string.Format("{0}_{1}", res, itemCfg.resLayer2);
+                    break;
+                case 3:
+                    res = itemCfg.resLayer3 == "n" ? res : string.Format("{0}_{1}", res, itemCfg.resLayer3);
+                    break;
+            }
+            return res;
+        }
+
     }
 }