[unity] Some cleanup.

This commit is contained in:
pharan 2018-04-17 07:54:58 +08:00
parent 63b27b9f46
commit 488e6a8b2c
3 changed files with 3 additions and 22 deletions

View File

@ -28,10 +28,6 @@
* POSSIBILITY OF SUCH DAMAGE.
*****************************************************************************/
#if UNITY_5_6_OR_NEWER
#define UNITY_CLIPINFOCACHE
#endif
using UnityEngine;
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<AnimationClip, int> clipNameHashCodeTable = new Dictionary<AnimationClip, int>(AnimationClipEqualityComparer.Instance);
readonly List<Animation> previousAnimations = new List<Animation>();
#if UNITY_CLIPINFOCACHE
readonly List<AnimatorClipInfo> clipInfoCache = new List<AnimatorClipInfo>();
readonly List<AnimatorClipInfo> nextClipInfoCache = new List<AnimatorClipInfo>();
#endif
Animator animator;
public Animator Animator { get { return this.animator; } }
@ -137,10 +131,8 @@ namespace Spine.Unity {
animationTable.Add(a.Name.GetHashCode(), a);
clipNameHashCodeTable.Clear();
#if UNITY_CLIPINFOCACHE
clipInfoCache.Clear();
nextClipInfoCache.Clear();
#endif
}
public void Apply (Skeleton skeleton) {
@ -265,7 +257,6 @@ namespace Spine.Unity {
out int nextClipInfoCount,
out IList<AnimatorClipInfo> clipInfo,
out IList<AnimatorClipInfo> nextClipInfo) {
#if UNITY_CLIPINFOCACHE
clipInfoCount = animator.GetCurrentAnimatorClipInfoCount(layer);
nextClipInfoCount = animator.GetNextAnimatorClipInfoCount(layer);
if (clipInfoCache.Capacity < clipInfoCount) clipInfoCache.Capacity = clipInfoCount;
@ -275,13 +266,6 @@ namespace Spine.Unity {
clipInfo = clipInfoCache;
nextClipInfo = nextClipInfoCache;
#else
clipInfo = animator.GetCurrentAnimatorClipInfo(layer);
nextClipInfo = animator.GetNextAnimatorClipInfo(layer);
clipInfoCount = clipInfo.Count;
nextClipInfoCount = nextClipInfo.Count;
#endif
}
int NameHashCode (AnimationClip clip) {

View File

@ -102,11 +102,11 @@ namespace Spine.Unity.Editor {
int propertyPathLength = propertyPath.Length;
int dotCount = 0;
const int siblingOfListDotCount = 3;
const int SiblingOfListDotCount = 3;
for (int i = 1; i < propertyPathLength; i++) {
if (propertyPath[propertyPathLength - i] == '.') {
dotCount++;
if (dotCount >= siblingOfListDotCount) {
if (dotCount >= SiblingOfListDotCount) {
localPathLength = i - 1;
break;
}
@ -157,7 +157,7 @@ namespace Spine.Unity.Editor {
get {
if (boxScopeStyle == null) {
boxScopeStyle = new GUIStyle(EditorStyles.helpBox);
var p = boxScopeStyle.padding;
RectOffset p = boxScopeStyle.padding; // RectOffset is a class
p.right += 6;
p.top += 1;
p.left += 3;

View File

@ -28,10 +28,7 @@
* POSSIBILITY OF SUCH DAMAGE.
*****************************************************************************/
// Contributed by: Mitch Thompson and John Dy
using UnityEngine;
using Spine;
namespace Spine.Unity {
public static class SkeletonExtensions {