| | |
| | | using System; |
| | | using System.Collections.Generic; |
| | | using Spine; |
| | | using Spine.Unity; |
| | | |
| | | public static class Extension |
| | | { |
| | |
| | | } |
| | | } |
| | | } |
| | | |
| | | 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; |
| | | } |
| | | |
| | | } |