zhaoyang 2 years ago
parent
commit
41da4efa7a

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

@@ -55,13 +55,13 @@ namespace GFGGame
             string value = typeof(ItemCfg).GetField(layerName).GetValue(itemCfg).ToString();
             string value = typeof(ItemCfg).GetField(layerName).GetValue(itemCfg).ToString();
             // string res = value == "n" ? itemCfg.res : string.Format("{0}_{1}", itemCfg.res, value);
             // string res = value == "n" ? itemCfg.res : string.Format("{0}_{1}", itemCfg.res, value);
 
 
-            string res = DressUpUtil.GetDressUpItemLayerRes(itemCfg, layer);
-            string resPath = ResPathUtil.GetDressUpPath(res);
-            var effPath = ResPathUtil.GetDressUpEffectPath(itemCfg.res);
-            if (!VEngine.Versions.Contains(resPath) && VEngine.Versions.Contains(effPath))
-            {
-                AddOnlyEffItemToScene(sceneObject, parentGameObj, itemCfg.id, layer);
-            }
+            // string res = DressUpUtil.GetDressUpItemLayerRes(itemCfg, layer);
+            // string resPath = ResPathUtil.GetDressUpPath(res);
+            // var effPath = ResPathUtil.GetDressUpEffectPath(itemCfg.res);
+            // if (!VEngine.Versions.Contains(resPath) && VEngine.Versions.Contains(effPath))
+            // {
+            //     AddOnlyEffItemToScene(sceneObject, parentGameObj, itemCfg.id, layer);
+            // }
 
 
             AddItemGameObjectToList(parentGameObj, setLayer);
             AddItemGameObjectToList(parentGameObj, setLayer);
         }
         }
@@ -85,7 +85,7 @@ namespace GFGGame
             {
             {
                 gameObject.GetComponent<SpriteRenderer>().enabled = false;
                 gameObject.GetComponent<SpriteRenderer>().enabled = false;
                 DressUpUtil.AddItem(itemId, sceneObj, false, true, gameObject, resLayer);
                 DressUpUtil.AddItem(itemId, sceneObj, false, true, gameObject, resLayer);
-                gameObject.transform.GetChild(0).localPosition = gameObject.transform.GetChild(0).localPosition - gameObject.transform.localPosition;
+                gameObject.transform.localPosition = Vector3.zero;
             }
             }
             PhotographUtil.Instance.SetGameObjectCenter(parentGameObj);
             PhotographUtil.Instance.SetGameObjectCenter(parentGameObj);
         }
         }

+ 6 - 3
GameClient/Assets/Game/HotUpdate/Data/PhotographUtil.cs

@@ -173,13 +173,15 @@ namespace GFGGame
             int count = 0;
             int count = 0;
             if (state == "up" || state == "top")
             if (state == "up" || state == "top")
             {
             {
-                count = layer - GetMinLayer(parentObj);
+                int curMinLayer = GetMinLayer(parentObj);
+                count = layer - curMinLayer;
             }
             }
             else if (state == "down")
             else if (state == "down")
             {
             {
-                count = layer - GetMaxLayer(parentObj);
+                int curMaxLayer = GetMaxLayer(parentObj);
+                count = layer - curMaxLayer;
             }
             }
-            int changeLayer = layer + count;
+            int changeLayer = count;
 
 
             int maxLayer = int.MinValue;
             int maxLayer = int.MinValue;
             SpriteRenderer[] sps = parentObj.GetComponentsInChildren<SpriteRenderer>();//选中道具可能含有静态图
             SpriteRenderer[] sps = parentObj.GetComponentsInChildren<SpriteRenderer>();//选中道具可能含有静态图
@@ -256,6 +258,7 @@ namespace GFGGame
             {
             {
                 GameObject gameObject = parentObj.transform.GetChild(i).gameObject;
                 GameObject gameObject = parentObj.transform.GetChild(i).gameObject;
                 Transform tf = gameObject.transform;
                 Transform tf = gameObject.transform;
+                if (tf.gameObject.activeSelf == false) continue;
                 SpriteRenderer sp = tf.GetComponent<SpriteRenderer>();
                 SpriteRenderer sp = tf.GetComponent<SpriteRenderer>();
                 if (sp && sp.sortingOrder < layer)
                 if (sp && sp.sortingOrder < layer)
                 {
                 {

+ 5 - 6
GameClient/Assets/Game/HotUpdate/DressUp/DressUpUtil.cs

@@ -155,7 +155,7 @@ namespace GFGGame
             }
             }
             else
             else
             {
             {
-                if(transform_t == null)
+                if (transform_t == null)
                 {
                 {
                     return;
                     return;
                 }
                 }
@@ -247,11 +247,11 @@ namespace GFGGame
 
 
             string res = GetDressUpItemLayerRes(itemCfg, layerId);
             string res = GetDressUpItemLayerRes(itemCfg, layerId);
             int sortingOrder = typeCfg.defaultLayer;
             int sortingOrder = typeCfg.defaultLayer;
-            if(layerId == 2)
+            if (layerId == 2)
             {
             {
                 sortingOrder = typeCfg.specialLayer;
                 sortingOrder = typeCfg.specialLayer;
             }
             }
-            else if(layerId == 3)
+            else if (layerId == 3)
             {
             {
                 sortingOrder = typeCfg.thirdlLayer;
                 sortingOrder = typeCfg.thirdlLayer;
             }
             }
@@ -272,7 +272,7 @@ namespace GFGGame
                 if (addAniObj != null && spriteObj != null)
                 if (addAniObj != null && spriteObj != null)
                 {
                 {
                     var dressUpPart = addAniObj.GetComponent<DressUpPart>();
                     var dressUpPart = addAniObj.GetComponent<DressUpPart>();
-                    if(dressUpPart == null)
+                    if (dressUpPart == null)
                     {
                     {
                         dressUpPart = addAniObj.AddComponent<DressUpPart>();
                         dressUpPart = addAniObj.AddComponent<DressUpPart>();
                     }
                     }
@@ -455,7 +455,7 @@ namespace GFGGame
                 GameObject gameObj = transform.gameObject;
                 GameObject gameObj = transform.gameObject;
                 if (gameObj != null)
                 if (gameObj != null)
                 {
                 {
-                     var assetReleaser = gameObj.GetComponent<AssetReleaser>();
+                    var assetReleaser = gameObj.GetComponent<AssetReleaser>();
                     if (assetReleaser != null)
                     if (assetReleaser != null)
                     {
                     {
                         if (assetReleaser.resPath == resPath)
                         if (assetReleaser.resPath == resPath)
@@ -516,7 +516,6 @@ namespace GFGGame
                     }
                     }
                     else
                     else
                     {
                     {
-
                         renderer.sortingOrder = sortingOrder;
                         renderer.sortingOrder = sortingOrder;
                     }
                     }
                 }
                 }

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

@@ -24,6 +24,7 @@ namespace GFGGame
         // private const string BorderResPath = "Border/BorderRes";
         // private const string BorderResPath = "Border/BorderRes";
         // private const string NpcResPath = "Scene/Npc/NpcRes";
         // private const string NpcResPath = "Scene/Npc/NpcRes";
         private const string RolePath = "Scene/Role";
         private const string RolePath = "Scene/Role";
+        private const string RoleName = "Role";
         private const string BodyResName = "Body";
         private const string BodyResName = "Body";
         private const string BodyResName1 = "Body_a";
         private const string BodyResName1 = "Body_a";
         // private const string NpcPath = "Scene/Npc";
         // private const string NpcPath = "Scene/Npc";
@@ -283,7 +284,7 @@ namespace GFGGame
                 hitGameObj = PhotographUtil.Instance.GetFirstHitObj(hit2Ds);
                 hitGameObj = PhotographUtil.Instance.GetFirstHitObj(hit2Ds);
 
 
                 _ui.m_comSelectBox.m_btnDelete.visible = true;
                 _ui.m_comSelectBox.m_btnDelete.visible = true;
-                if (hitGameObj.name == BodyResName || hitGameObj.name == BodyResName1)//主角不可删除
+                if (hitGameObj.transform.parent.name == RoleName)//主角不可删除
                 {
                 {
                     _ui.m_comSelectBox.m_btnDelete.visible = false;
                     _ui.m_comSelectBox.m_btnDelete.visible = false;
                 }
                 }