Browse Source

拍照特效表格

zhaoyang 2 years ago
parent
commit
c29affa23b

+ 17 - 6
GameClient/Assets/Game/HotUpdate/Data/PhotographSceneManager.cs

@@ -48,14 +48,20 @@ namespace GFGGame
 
 
         public void AddSceneItem(GameObject parentGameObj, ItemCfg itemCfg, int layer, bool setLayer, bool isOnlyEff = false)
         public void AddSceneItem(GameObject parentGameObj, ItemCfg itemCfg, int layer, bool setLayer, bool isOnlyEff = false)
         {
         {
-            if (isOnlyEff)
+
+            AddItemToScene(sceneObject, parentGameObj, itemCfg.id, layer);
+
+            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 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);
                 AddOnlyEffItemToScene(sceneObject, parentGameObj, itemCfg.id, layer);
             }
             }
-            else
-            {
-                AddItemToScene(sceneObject, parentGameObj, itemCfg.id, layer);
-            }
+
             AddItemGameObjectToList(parentGameObj, setLayer);
             AddItemGameObjectToList(parentGameObj, setLayer);
         }
         }
 
 
@@ -69,7 +75,12 @@ namespace GFGGame
             GameObject gameObject = parentGameObj.transform.GetChild(0).gameObject;
             GameObject gameObject = parentGameObj.transform.GetChild(0).gameObject;
             SetBoxCollider2DToGameObject(gameObject);
             SetBoxCollider2DToGameObject(gameObject);
 
 
-            if (itemCfg.isAni > 0)
+            string layerName = string.Format("resLayer{0}", resLayer);
+            string value = typeof(ItemCfg).GetField(layerName).GetValue(itemCfg).ToString();
+            string res = value == "n" ? itemCfg.res : string.Format("{0}_{1}", itemCfg.res, value);
+
+            string resPath = ResPathUtil.GetDressUpAnimationPath(res);
+            if (VEngine.Versions.Contains(resPath))
             {
             {
                 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);

+ 5 - 18
GameClient/Assets/Game/HotUpdate/Views/DressUp/PhotographView.cs

@@ -24,7 +24,8 @@ 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 BodyResName = "BodyRes";
+        private const string BodyResName = "Body";
+        private const string BodyResName1 = "Body_a";
         // private const string NpcPath = "Scene/Npc";
         // private const string NpcPath = "Scene/Npc";
         private const string NpcName = "Npc";
         private const string NpcName = "Npc";
         private const string BgResName = "BgRes";
         private const string BgResName = "BgRes";
@@ -230,11 +231,9 @@ namespace GFGGame
 
 
         private void AddSceneItem(ItemCfg itemCfg, bool setLayer)
         private void AddSceneItem(ItemCfg itemCfg, bool setLayer)
         {
         {
-            bool isOnlyEff = true;
             Vector3 pos = Vector3.zero;
             Vector3 pos = Vector3.zero;
             if (!string.IsNullOrEmpty(itemCfg.resLayer3))
             if (!string.IsNullOrEmpty(itemCfg.resLayer3))
             {
             {
-                isOnlyEff = false;
                 GameObject parentGameObj3 = new GameObject(string.Format("{0}_{1}", itemCfg.id, 3));
                 GameObject parentGameObj3 = new GameObject(string.Format("{0}_{1}", itemCfg.id, 3));
                 PhotographSceneManager.Instance.AddSceneItem(parentGameObj3, itemCfg, 3, setLayer);
                 PhotographSceneManager.Instance.AddSceneItem(parentGameObj3, itemCfg, 3, setLayer);
                 if (setLayer)
                 if (setLayer)
@@ -245,7 +244,6 @@ namespace GFGGame
             }
             }
             if (!string.IsNullOrEmpty(itemCfg.resLayer2))
             if (!string.IsNullOrEmpty(itemCfg.resLayer2))
             {
             {
-                isOnlyEff = false;
                 GameObject parentGameObj2 = new GameObject(string.Format("{0}_{1}", itemCfg.id, 2));
                 GameObject parentGameObj2 = new GameObject(string.Format("{0}_{1}", itemCfg.id, 2));
                 PhotographSceneManager.Instance.AddSceneItem(parentGameObj2, itemCfg, 2, setLayer);
                 PhotographSceneManager.Instance.AddSceneItem(parentGameObj2, itemCfg, 2, setLayer);
                 if (setLayer)
                 if (setLayer)
@@ -256,7 +254,7 @@ namespace GFGGame
             }
             }
             if (!string.IsNullOrEmpty(itemCfg.resLayer1))
             if (!string.IsNullOrEmpty(itemCfg.resLayer1))
             {
             {
-                isOnlyEff = false;
+
                 GameObject parentGameObj1 = new GameObject(string.Format("{0}_{1}", itemCfg.id, 1));
                 GameObject parentGameObj1 = new GameObject(string.Format("{0}_{1}", itemCfg.id, 1));
                 PhotographSceneManager.Instance.AddSceneItem(parentGameObj1, itemCfg, 1, setLayer);
                 PhotographSceneManager.Instance.AddSceneItem(parentGameObj1, itemCfg, 1, setLayer);
 
 
@@ -266,19 +264,8 @@ namespace GFGGame
                     pos = parentGameObj1.transform.localPosition;
                     pos = parentGameObj1.transform.localPosition;
                 }
                 }
             }
             }
-
-            if (isOnlyEff && itemCfg.effLayer > 0)
-            {
-                GameObject parentGameObj1 = new GameObject(string.Format("{0}_{1}", itemCfg.id, "eff"));
-                PhotographSceneManager.Instance.AddSceneItem(parentGameObj1, itemCfg, 0, setLayer, true);
-
-                if (setLayer)
-                {
-                    parentGameObj1.transform.localPosition = pos == Vector3.zero ? -parentGameObj1.transform.GetChild(0).localPosition : pos;
-                }
-            }
-
         }
         }
+
         /************************************************************场景*********************************************************/
         /************************************************************场景*********************************************************/
 
 
         private void OnTouchUIBegin(EventContext context)
         private void OnTouchUIBegin(EventContext context)
@@ -297,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)//主角不可删除
+                if (hitGameObj.name == BodyResName || hitGameObj.name == BodyResName1)//主角不可删除
                 {
                 {
                     _ui.m_comSelectBox.m_btnDelete.visible = false;
                     _ui.m_comSelectBox.m_btnDelete.visible = false;
                 }
                 }