From 9fb3c8e114a67c0cdf353b32b1b50e90414fd597 Mon Sep 17 00:00:00 2001
From: yyl <yyl>
Date: 星期三, 25 二月 2026 16:34:07 +0800
Subject: [PATCH] Merge branch 'master' into h5version

---
 Main/Utility/Extension.cs |   59 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 59 insertions(+), 0 deletions(-)

diff --git a/Main/Utility/Extension.cs b/Main/Utility/Extension.cs
index b5d01c7..9725ea7 100644
--- a/Main/Utility/Extension.cs
+++ b/Main/Utility/Extension.cs
@@ -1,5 +1,7 @@
 using System;
 using System.Collections.Generic;
+using Spine;
+using Spine.Unity;
 
 public static class Extension
 {
@@ -74,4 +76,61 @@
             }
         }
     }
+
+    public static bool IsSpine(this string _resName)
+    {
+        if (string.IsNullOrEmpty(_resName))
+        {
+            return false;
+        }
+
+        return _resName.Contains("SkeletonData");
+    }
+
+    public static bool IsVideo(this string _resName)
+    {
+        if (string.IsNullOrEmpty(_resName))
+        {
+            return false;
+        }
+
+        return _resName.EndsWith(".mp4");
+    }
+
+    public static bool ContainsMotion(this Spine.Skeleton skeleton, string motionName)
+    {
+        if (skeleton == null || string.IsNullOrEmpty(motionName))
+        {
+            return false;
+        }
+
+        for (int i = 0; i < skeleton.Data.Animations.Count; i++)
+        {
+            if (skeleton.Data.Animations.Items[i].Name.ToLower() == motionName.ToLower())
+            {
+                return true;
+            }
+        }
+
+        return false;
+    }
+
+    public static Spine.Animation GetSpineAnimation(this Spine.Skeleton skeleton, string motionName)
+    {
+        if (skeleton == null || string.IsNullOrEmpty(motionName))
+        {
+            return null;
+        }
+
+        for (int i = 0; i < skeleton.Data.Animations.Count; i++)
+        {
+            if (skeleton.Data.Animations.Items[i].Name.ToLower() == motionName.ToLower())
+            {
+                return skeleton.Data.Animations.Items[i];
+            }
+        }
+
+        return null;
+    }
+
 }
\ No newline at end of file

--
Gitblit v1.8.0