zhaoyang 2 gadi atpakaļ
vecāks
revīzija
2fa8781377

+ 5 - 2
GameClient/Assets/Game/HotUpdate/Data/PhotographSceneManager.cs

@@ -53,8 +53,9 @@ namespace GFGGame
 
             string layerName = string.Format("resLayer{0}", layer);
             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))
@@ -96,7 +97,8 @@ namespace GFGGame
 
             GameObject gameObject = new GameObject(itemCfg.id.ToString());
             gameObject.transform.SetParent(parentGameObj.transform);
-            string resPath = ResPathUtil.GetDressUpPath(itemCfg.res);
+            string res = DressUpUtil.GetDressUpItemLayerRes(itemCfg, resLayer);
+            string resPath = ResPathUtil.GetDressUpPath(res);
             SetSpriteRendererToTransform(gameObject.transform, resPath);
             SetBoxCollider2DToGameObject(gameObject);
             gameObject.GetComponent<SpriteRenderer>().enabled = false;
@@ -135,6 +137,7 @@ namespace GFGGame
             }
             DressUpUtil.ChangeAssetReleaser(tf.gameObject, resPath);
             Sprite sp = GFGAsset.Load<Sprite>(resPath);
+            if (sp == null) return;
             spr.sprite = sp;
             spr.size = spr.sprite.bounds.size;//将节点设置为原图大小
 

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

@@ -53,7 +53,7 @@ namespace GFGGame
             foreach (Transform t in parent)
             {
                 string[] strs = t.name.Split('_');
-                if (strs.Length > 1 && strs[1] == "eff") continue;//不计算特效大小
+                if (strs.Length > 1 && strs[1].IndexOf("e") >= 0) continue;//不计算特效大小
                 BoxCollider2D render = t.GetComponent<BoxCollider2D>();
                 if (render)
                 {
@@ -61,12 +61,12 @@ namespace GFGGame
                     center += render.bounds.center;
                 }
             }
-            center /= index;
+            if (index > 0) center /= index;
             Bounds bounds = new Bounds(center, Vector3.zero);
             foreach (Transform t in parent)
             {
                 string[] strs = t.name.Split('_');
-                if (strs.Length > 1 && strs[1] == "eff") continue;
+                if (strs.Length > 1 && strs[1].IndexOf("e") >= 0) continue;
                 BoxCollider2D render = t.GetComponent<BoxCollider2D>();
                 if (render) bounds.Encapsulate(render.bounds);
             }
@@ -78,7 +78,7 @@ namespace GFGGame
             foreach (Transform t in parent)
             {
                 string[] strs = t.parent.name.Split('_');
-                if (strs.Length > 1 && strs[1] == "eff") continue;
+                if (strs.Length > 1 && strs[1].IndexOf("e") >= 0) continue;
                 t.position = t.position - bounds.center;
             }
 
@@ -120,6 +120,7 @@ namespace GFGGame
             if (state != "refresh")
             {
                 int index = itemGameObjs.IndexOf(hitGameObj);
+                if (index == itemGameObjs.Count - 1 && state == "top") return;
                 if (state != "top")
                 {
                     if (index < 0)
@@ -208,7 +209,7 @@ namespace GFGGame
             {
                 Transform tf = parentObj.transform.GetChild(i);
                 string[] strs = tf.name.Split('_');
-                if (strs.Length > 1 && strs[1] == "eff")//子物体是特效
+                if (strs.Length > 1 && strs[1].IndexOf("e") >= 0)//子物体是特效
                 {
                     DressUpUtil.SetRenderersOrder(tf.gameObject, changeLayer, true);
                 }