Browse Source

修复:垃圾代码导致的打包报错

XuJJ 2 weeks ago
parent
commit
1cec410b67

+ 6 - 8
snipershooting/ShootSniper/Assets/Scripts/GamePlay/Shoot/View/ProgressTipView.cs

@@ -1,7 +1,6 @@
 using SSTRCore;
 using System.Collections;
 using System.Collections.Generic;
-using UnityEditor.Animations;
 using UnityEngine;
 using UnityEngine.UI;
 public class ProgressTipView : MonoBehaviour
@@ -86,11 +85,11 @@ public class ProgressTipView : MonoBehaviour
     }
     
     private Dictionary<string, AnimationClip> animations = new Dictionary<string, AnimationClip>();
-    private Animator animator;
+    private Animation animator;
 
     private void Start()
     {
-        animator = GetComponent<Animator>();
+        animator = GetComponent<Animation>();
     }
 
     public void AddAnimation(string name, AnimationClip clip)
@@ -98,7 +97,7 @@ public class ProgressTipView : MonoBehaviour
         if (!animations.ContainsKey(name))
         {
             animations[name] = clip;
-            animator.runtimeAnimatorController = CreateAnimatorController(animations);
+            //animator.runtimeAnimatorController = CreateAnimatorController(animations);
         }
     }
 
@@ -110,13 +109,12 @@ public class ProgressTipView : MonoBehaviour
         }
     }
 
-    private AnimatorController CreateAnimatorController(Dictionary<string, AnimationClip> animations)
+    private Animation CreateAnimatorController(Dictionary<string, AnimationClip> animations)
     {
-        var controller = new AnimatorController();
+        var controller = new Animation();
         foreach (var kvp in animations)
         {
-            var state = controller.AddMotion(kvp.Value);
-            state.name = kvp.Key;
+            controller.AddClip(kvp.Value, kvp.Key);
         }
         return controller;
     }