Ver Fonte

特效ui

guodong há 2 anos atrás
pai
commit
976e4da035

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

@@ -369,18 +369,16 @@ namespace GFGGame
         private static GameObject AddAnimationObj(string res, string objName, GameObject parentObj, int sortingOrder)
         {
             string resPath = ResPathUtil.GetDressUpAnimationPath(res);
-            if (!VEngine.Versions.Contains(resPath))
-            {
-                return null;
-            }
             var gameObj = GetGameObjExisted(parentObj, objName, resPath);
             if (gameObj != null)
             {
                 return gameObj;
             }
-            var prefab = GFGAsset.Load<GameObject>(resPath);
-            gameObj = GameObject.Instantiate(prefab);
-            AddAssetReleaser(gameObj, resPath);
+            gameObj = CreateAnimationObj(resPath);
+            if(gameObj == null)
+            {
+                return null;
+            }
             if (objName == BODY_ANIMATION_NAME)
             {
                 //如果是动作动画,就根据动画位置及角度信息设置给Role对象
@@ -409,18 +407,16 @@ namespace GFGGame
         private static GameObject TryAddEffectObj(string res, string objName, GameObject parentObj, int sortingOrder, bool inAniDir)
         {
             var resPath = ResPathUtil.GetDressUpEffectPath(res, inAniDir);
-            if (!VEngine.Versions.Contains(resPath))
-            {
-                return null;
-            }
             var gameObj = GetGameObjExisted(parentObj, objName, resPath);
             if (gameObj != null)
             {
                 return gameObj;
             }
-            GameObject effPre = GFGAsset.Load<GameObject>(resPath);
-            gameObj = GameObject.Instantiate(effPre);
-            AddAssetReleaser(gameObj, resPath);
+            gameObj = CreateAnimationObj(resPath);
+            if (gameObj == null)
+            {
+                return null;
+            }
             gameObj.transform.SetParent(parentObj.transform, false);
             gameObj.name = objName;
             var sortingGroup = gameObj.transform.GetComponent<SortingGroup>();
@@ -479,12 +475,11 @@ namespace GFGGame
 
         public static GameObject CreateAnimationObj(string resPath)
         {
-            // string resPath = ResPathUtil.GetCardAnimationPath(res);
-            var prefab = GFGAsset.Load<GameObject>(resPath);
-            if (prefab == null)
+            if (!VEngine.Versions.Contains(resPath))
             {
                 return null;
             }
+            var prefab = GFGAsset.Load<GameObject>(resPath);
             var gameObj = GameObject.Instantiate(prefab);
             AddAssetReleaser(gameObj, resPath);
             return gameObj;

+ 4 - 0
GameClient/Assets/Game/HotUpdate/Effect/EffectUI.cs

@@ -25,6 +25,10 @@ namespace GFGGame
                     break;
             }
             _gameObject = DressUpUtil.CreateAnimationObj(resPath);
+            if(_gameObject == null)
+            {
+                return;
+            }
             _gameObject.transform.localScale = new Vector3(scale, scale, scale);
             _wrapper = new GoWrapper(_gameObject);
             holder.SetNativeObject(_wrapper);