From 8d77144cfb756529507dc6927dcdcfd9f4a30750 Mon Sep 17 00:00:00 2001
From: yyl <yyl>
Date: 星期三, 25 二月 2026 14:48:37 +0800
Subject: [PATCH] 视频播放支持
---
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