Просмотр исходного кода

[unity] Fixed some compiler warnings when building for platforms instead of editor. Closes #1604.

Harald Csaszar 5 лет назад
Родитель
Сommit
d252df7ece

+ 3 - 3
spine-csharp/src/MathUtils.cs

@@ -38,6 +38,9 @@ namespace Spine {
 		public const float RadDeg = 180f / PI;
 		public const float DegRad = PI / 180;
 
+		static Random random = new Random();
+
+	#if USE_FAST_SIN_COS_ATAN2_APPROXIMATIONS
 		const int SIN_BITS = 14; // 16KB. Adjust for accuracy.
 		const int SIN_MASK = ~(-1 << SIN_BITS);
 		const int SIN_COUNT = SIN_MASK + 1;
@@ -47,9 +50,6 @@ namespace Spine {
 		const float DegToIndex = SIN_COUNT / DegFull;
 		static float[] sin = new float[SIN_COUNT];
 
-		static Random random = new Random();
-
-	#if USE_FAST_SIN_COS_ATAN2_APPROXIMATIONS
 		static MathUtils () {
 			for (int i = 0; i < SIN_COUNT; i++)
 				sin[i] = (float)Math.Sin((i + 0.5f) / SIN_COUNT * RadFull);

+ 2 - 2
spine-unity/Assets/Spine Examples/Scripts/Getting Started Scripts/SpineboyTargetController.cs

@@ -36,7 +36,7 @@ namespace Spine.Unity.Examples {
 
 		[SpineBone(dataField:"skeletonAnimation")]
 		public string boneName;
-		public new Camera camera;
+		public Camera cam;
 
 		Bone bone;
 
@@ -50,7 +50,7 @@ namespace Spine.Unity.Examples {
 
 		void Update () {
 			var mousePosition = Input.mousePosition;
-			var worldMousePosition = camera.ScreenToWorldPoint(mousePosition);
+			var worldMousePosition = cam.ScreenToWorldPoint(mousePosition);
 			var skeletonSpacePoint = skeletonAnimation.transform.InverseTransformPoint(worldMousePosition);
 			skeletonSpacePoint.x *= skeletonAnimation.Skeleton.ScaleX;
 			skeletonSpacePoint.y *= skeletonAnimation.Skeleton.ScaleY;

+ 3 - 2
spine-unity/Assets/Spine/Runtime/spine-unity/Asset Types/SkeletonDataCompatibility.cs

@@ -36,10 +36,12 @@ namespace Spine.Unity {
 
 	public static class SkeletonDataCompatibility {
 
+	#if UNITY_EDITOR
 		static readonly int[][] compatibleBinaryVersions = { new[] { 3, 8, 0 } };
 		static readonly int[][] compatibleJsonVersions = { new[] { 3, 8, 0 } };
 
 		static bool wasVersionDialogShown = false;
+	#endif
 
 		public enum SourceType {
 			Json,
@@ -110,7 +112,6 @@ namespace Spine.Unity {
 				}
 			}
 
-			string primaryRuntimeVersionDebugString = compatibleBinaryVersions[0][0] + "." + compatibleBinaryVersions[0][1];
 			if (string.IsNullOrEmpty(fileVersion.rawVersion)) {
 				// very likely not a Spine skeleton json file at all.
 				return null;
@@ -136,7 +137,7 @@ namespace Spine.Unity {
 			info.actualVersion = fileVersion;
 			info.compatibleVersions = (fileVersion.sourceType == SourceType.Binary) ? compatibleBinaryVersions
 				: compatibleJsonVersions;
-			
+
 			foreach (var compatibleVersion in info.compatibleVersions) {
 				bool majorMatch = fileVersion.version[0] == compatibleVersion[0];
 				bool minorMatch = fileVersion.version[1] == compatibleVersion[1];

+ 4 - 0
spine-unity/Assets/Spine/Runtime/spine-unity/Utility/AtlasUtilities.cs

@@ -487,6 +487,10 @@ namespace Spine.Unity.AttachmentTools {
 				this.i = i;
 				this.region = region;
 			}
+
+			public override int GetHashCode () {
+				return i.GetHashCode() * 23 ^ region.GetHashCode();
+			}
 		}
 		static Dictionary<IntAndAtlasRegionKey, Texture2D> CachedRegionTextures = new Dictionary<IntAndAtlasRegionKey, Texture2D>();
 		static List<Texture2D> CachedRegionTexturesList = new List<Texture2D>();