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

This commit is contained in:
Harald Csaszar 2020-01-24 13:55:45 +01:00
parent e62c42c041
commit d252df7ece
4 changed files with 12 additions and 7 deletions

View File

@ -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);

View File

@ -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;

View File

@ -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];

View File

@ -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>();