mirror of
https://github.com/EsotericSoftware/spine-runtimes.git
synced 2026-03-26 22:49:01 +08:00
[unity] Some cleanup.
This commit is contained in:
parent
63b27b9f46
commit
488e6a8b2c
@ -28,10 +28,6 @@
|
|||||||
* POSSIBILITY OF SUCH DAMAGE.
|
* POSSIBILITY OF SUCH DAMAGE.
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
|
|
||||||
#if UNITY_5_6_OR_NEWER
|
|
||||||
#define UNITY_CLIPINFOCACHE
|
|
||||||
#endif
|
|
||||||
|
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
|
||||||
@ -118,10 +114,8 @@ namespace Spine.Unity {
|
|||||||
readonly Dictionary<int, Spine.Animation> animationTable = new Dictionary<int, Spine.Animation>(IntEqualityComparer.Instance);
|
readonly Dictionary<int, Spine.Animation> animationTable = new Dictionary<int, Spine.Animation>(IntEqualityComparer.Instance);
|
||||||
readonly Dictionary<AnimationClip, int> clipNameHashCodeTable = new Dictionary<AnimationClip, int>(AnimationClipEqualityComparer.Instance);
|
readonly Dictionary<AnimationClip, int> clipNameHashCodeTable = new Dictionary<AnimationClip, int>(AnimationClipEqualityComparer.Instance);
|
||||||
readonly List<Animation> previousAnimations = new List<Animation>();
|
readonly List<Animation> previousAnimations = new List<Animation>();
|
||||||
#if UNITY_CLIPINFOCACHE
|
|
||||||
readonly List<AnimatorClipInfo> clipInfoCache = new List<AnimatorClipInfo>();
|
readonly List<AnimatorClipInfo> clipInfoCache = new List<AnimatorClipInfo>();
|
||||||
readonly List<AnimatorClipInfo> nextClipInfoCache = new List<AnimatorClipInfo>();
|
readonly List<AnimatorClipInfo> nextClipInfoCache = new List<AnimatorClipInfo>();
|
||||||
#endif
|
|
||||||
|
|
||||||
Animator animator;
|
Animator animator;
|
||||||
public Animator Animator { get { return this.animator; } }
|
public Animator Animator { get { return this.animator; } }
|
||||||
@ -137,10 +131,8 @@ namespace Spine.Unity {
|
|||||||
animationTable.Add(a.Name.GetHashCode(), a);
|
animationTable.Add(a.Name.GetHashCode(), a);
|
||||||
|
|
||||||
clipNameHashCodeTable.Clear();
|
clipNameHashCodeTable.Clear();
|
||||||
#if UNITY_CLIPINFOCACHE
|
|
||||||
clipInfoCache.Clear();
|
clipInfoCache.Clear();
|
||||||
nextClipInfoCache.Clear();
|
nextClipInfoCache.Clear();
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Apply (Skeleton skeleton) {
|
public void Apply (Skeleton skeleton) {
|
||||||
@ -265,7 +257,6 @@ namespace Spine.Unity {
|
|||||||
out int nextClipInfoCount,
|
out int nextClipInfoCount,
|
||||||
out IList<AnimatorClipInfo> clipInfo,
|
out IList<AnimatorClipInfo> clipInfo,
|
||||||
out IList<AnimatorClipInfo> nextClipInfo) {
|
out IList<AnimatorClipInfo> nextClipInfo) {
|
||||||
#if UNITY_CLIPINFOCACHE
|
|
||||||
clipInfoCount = animator.GetCurrentAnimatorClipInfoCount(layer);
|
clipInfoCount = animator.GetCurrentAnimatorClipInfoCount(layer);
|
||||||
nextClipInfoCount = animator.GetNextAnimatorClipInfoCount(layer);
|
nextClipInfoCount = animator.GetNextAnimatorClipInfoCount(layer);
|
||||||
if (clipInfoCache.Capacity < clipInfoCount) clipInfoCache.Capacity = clipInfoCount;
|
if (clipInfoCache.Capacity < clipInfoCount) clipInfoCache.Capacity = clipInfoCount;
|
||||||
@ -275,13 +266,6 @@ namespace Spine.Unity {
|
|||||||
|
|
||||||
clipInfo = clipInfoCache;
|
clipInfo = clipInfoCache;
|
||||||
nextClipInfo = nextClipInfoCache;
|
nextClipInfo = nextClipInfoCache;
|
||||||
#else
|
|
||||||
clipInfo = animator.GetCurrentAnimatorClipInfo(layer);
|
|
||||||
nextClipInfo = animator.GetNextAnimatorClipInfo(layer);
|
|
||||||
|
|
||||||
clipInfoCount = clipInfo.Count;
|
|
||||||
nextClipInfoCount = nextClipInfo.Count;
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int NameHashCode (AnimationClip clip) {
|
int NameHashCode (AnimationClip clip) {
|
||||||
|
|||||||
@ -102,11 +102,11 @@ namespace Spine.Unity.Editor {
|
|||||||
int propertyPathLength = propertyPath.Length;
|
int propertyPathLength = propertyPath.Length;
|
||||||
|
|
||||||
int dotCount = 0;
|
int dotCount = 0;
|
||||||
const int siblingOfListDotCount = 3;
|
const int SiblingOfListDotCount = 3;
|
||||||
for (int i = 1; i < propertyPathLength; i++) {
|
for (int i = 1; i < propertyPathLength; i++) {
|
||||||
if (propertyPath[propertyPathLength - i] == '.') {
|
if (propertyPath[propertyPathLength - i] == '.') {
|
||||||
dotCount++;
|
dotCount++;
|
||||||
if (dotCount >= siblingOfListDotCount) {
|
if (dotCount >= SiblingOfListDotCount) {
|
||||||
localPathLength = i - 1;
|
localPathLength = i - 1;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -157,7 +157,7 @@ namespace Spine.Unity.Editor {
|
|||||||
get {
|
get {
|
||||||
if (boxScopeStyle == null) {
|
if (boxScopeStyle == null) {
|
||||||
boxScopeStyle = new GUIStyle(EditorStyles.helpBox);
|
boxScopeStyle = new GUIStyle(EditorStyles.helpBox);
|
||||||
var p = boxScopeStyle.padding;
|
RectOffset p = boxScopeStyle.padding; // RectOffset is a class
|
||||||
p.right += 6;
|
p.right += 6;
|
||||||
p.top += 1;
|
p.top += 1;
|
||||||
p.left += 3;
|
p.left += 3;
|
||||||
|
|||||||
@ -28,10 +28,7 @@
|
|||||||
* POSSIBILITY OF SUCH DAMAGE.
|
* POSSIBILITY OF SUCH DAMAGE.
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
|
|
||||||
// Contributed by: Mitch Thompson and John Dy
|
|
||||||
|
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using Spine;
|
|
||||||
|
|
||||||
namespace Spine.Unity {
|
namespace Spine.Unity {
|
||||||
public static class SkeletonExtensions {
|
public static class SkeletonExtensions {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user