diff --git a/src/GameplayKit/GKCompat.cs b/src/GameplayKit/GKCompat.cs index a5ee348dc6..9fe28c794a 100644 --- a/src/GameplayKit/GKCompat.cs +++ b/src/GameplayKit/GKCompat.cs @@ -6,34 +6,20 @@ using ObjCRuntime; using OpenTK; using System.Runtime.Versioning; -#if !XAMCORE_4_0 && !MONOMAC && !__MACCATALYST__ +#if !NET && !MONOMAC && !__MACCATALYST__ namespace GameplayKit { public partial class GKQuadTree { -#if !NET [Obsolete ("Use the constructor with the same signature.")] -#else - [Obsolete ("Use the constructor with the same signature.", DiagnosticId = "BI1234", UrlFormat = "https://github.com/xamarin/xamarin-macios/wiki/Obsolete")] -#endif public static GKQuadTree QuadTreeWithMinPosition (Vector2 min, Vector2 max, float minCellSize) { return new GKQuadTree (min, max, minCellSize); } -#if !NET [Deprecated (PlatformName.iOS, 10,0, message: "Empty stub (always return 'false') as this API is now rejected).")] [Deprecated (PlatformName.TvOS, 10,0, message: "Empty stub (always return 'false') as this API is now rejected).")] -#else - [UnsupportedOSPlatform ("ios10.0")] - [UnsupportedOSPlatform ("tvos10.0")] -#if IOS - [Obsolete ("Starting with ios10.0 empty stub (always return 'false') as this API is now rejected).", DiagnosticId = "BI1234", UrlFormat = "https://github.com/xamarin/xamarin-macios/wiki/Obsolete")] -#elif TVOS - [Obsolete ("Starting with tvos10.0 empty stub (always return 'false') as this API is now rejected).", DiagnosticId = "BI1234", UrlFormat = "https://github.com/xamarin/xamarin-macios/wiki/Obsolete")] -#endif -#endif public virtual bool RemoveData (NSObject data) { return false; @@ -41,12 +27,7 @@ namespace GameplayKit { } public partial class GKQuadTreeNode { - -#if !NET [Obsolete ("A valid instance of this type cannot be directly created.")] -#else - [Obsolete ("A valid instance of this type cannot be directly created.", DiagnosticId = "BI1234", UrlFormat = "https://github.com/xamarin/xamarin-macios/wiki/Obsolete")] -#endif public GKQuadTreeNode () { } diff --git a/src/GameplayKit/GKGridGraph.cs b/src/GameplayKit/GKGridGraph.cs index edff12da61..6d865560c1 100644 --- a/src/GameplayKit/GKGridGraph.cs +++ b/src/GameplayKit/GKGridGraph.cs @@ -14,7 +14,7 @@ using Vector2i = global::OpenTK.Vector2i; namespace GameplayKit { public partial class GKGridGraph { -#if !XAMCORE_4_0 +#if !NET public virtual GKGridGraphNode GetNodeAt (Vector2i position) { return GetNodeAt (position); diff --git a/src/GameplayKit/GKObstacleGraph.cs b/src/GameplayKit/GKObstacleGraph.cs index bd33d7cfa3..4b1d5966ed 100644 --- a/src/GameplayKit/GKObstacleGraph.cs +++ b/src/GameplayKit/GKObstacleGraph.cs @@ -18,11 +18,11 @@ using NativeHandle = System.IntPtr; namespace GameplayKit { public partial class GKObstacleGraph { - public -#if !XAMCORE_4_0 - virtual +#if !NET + public virtual GKGraphNode2D [] GetNodes (GKPolygonObstacle obstacle) +#else + public GKGraphNode2D [] GetNodes (GKPolygonObstacle obstacle) #endif - GKGraphNode2D [] GetNodes (GKPolygonObstacle obstacle) { return NSArray.ArrayFromHandle (_GetNodes (obstacle)); } diff --git a/src/gameplaykit.cs b/src/gameplaykit.cs index aab32f84bb..72a61cf724 100644 --- a/src/gameplaykit.cs +++ b/src/gameplaykit.cs @@ -138,7 +138,7 @@ namespace GameplayKit { [Export ("rightHanded")] bool RightHanded { get; set; } -#if !XAMCORE_4_0 +#if !NET [Obsolete ("Use 'Rotation3x3' instead.")] [Export ("rotation", ArgumentSemantic.Assign)] Matrix3 Rotation { @@ -150,7 +150,7 @@ namespace GameplayKit { #endif [Export ("rotation", ArgumentSemantic.Assign)] -#if XAMCORE_4_0 +#if NET MatrixFloat3x3 Rotation { #else [Sealed] @@ -853,7 +853,7 @@ namespace GameplayKit { Vector2i GridPosition { [MarshalDirective (NativePrefix = "xamarin_simd__", Library = "__Internal")] get; -#if !XAMCORE_4_0 +#if !NET [NotImplemented] set; #endif @@ -1478,7 +1478,7 @@ namespace GameplayKit { [Export ("displaceXWithNoise:yWithNoise:zWithNoise:")] void Displace (GKNoise xDisplacementNoise, GKNoise yDisplacementNoise, GKNoise zDisplacementNoise); -#if !XAMCORE_4_0 +#if !NET [Obsolete ("Use 'GKNoise.Displace' instead.")] [Wrap ("Displace (xDisplacementNoise, yDisplacementNoise, zDisplacementNoise)", isVirtual: true)] void DisplaceX (GKNoise xDisplacementNoise, GKNoise yDisplacementNoise, GKNoise zDisplacementNoise); @@ -1950,7 +1950,7 @@ namespace GameplayKit { [Export ("removeElement:withNode:")] bool RemoveElement (NSObject data, GKQuadTreeNode node); -#if !XAMCORE_4_0 && !MONOMAC // This API is removed in Xcode 8 +#if !NET && !MONOMAC // This API is removed in Xcode 8 [Deprecated (PlatformName.iOS, 10, 0)] [Deprecated (PlatformName.TvOS, 10, 0)] diff --git a/tests/monotouch-test/GameplayKit/GKAgent3DTest.cs b/tests/monotouch-test/GameplayKit/GKAgent3DTest.cs index 1aed1cc3d3..502d107b47 100644 --- a/tests/monotouch-test/GameplayKit/GKAgent3DTest.cs +++ b/tests/monotouch-test/GameplayKit/GKAgent3DTest.cs @@ -44,24 +44,43 @@ namespace MonoTouchFixtures.GamePlayKit public void RotationTest () { using (var obj = new GKAgent3D ()) { +#if NET + var initial = new MatrixFloat3x3 (0, 0, 1, + 0, 1, 0, + 1, 0, 0); +#else var initial = new Matrix3 (0, 0, 1, 0, 1, 0, 1, 0, 0); +#endif Asserts.AreEqual (initial, obj.Rotation, "Rotation"); +#if !NET Asserts.AreEqual ((MatrixFloat3x3) initial, obj.Rotation3x3, "Rotation3x3"); +#endif +#if !NET var mat = new Matrix3 (1, 2, 3, 4, 5, 6, 7, 8, 9); - var mat3x3 = (MatrixFloat3x3) mat; +#endif + var mat3x3 = new MatrixFloat3x3 (1, 2, 3, + 4, 5, 6, + 7, 8, 9);; +#if !NET obj.Rotation = mat; Asserts.AreEqual (mat, obj.Rotation, "Rotation after setter"); var transposed3x3 = MatrixFloat3x3.Transpose ((MatrixFloat3x3) mat); Asserts.AreEqual (transposed3x3, obj.Rotation3x3, "Rotation3x3 after setter"); Asserts.AreEqual (transposed3x3, CFunctions.GetMatrixFloat3x3 (obj, "rotation"), "Rotation3x3 after setter native"); +#endif +#if NET + obj.Rotation = mat3x3; + Asserts.AreEqual (mat3x3, obj.Rotation, "Rotation3x3 after setter 3x3"); +#else obj.Rotation3x3 = mat3x3; Asserts.AreEqual (mat3x3, obj.Rotation3x3, "Rotation3x3 after setter 3x3"); +#endif Asserts.AreEqual (mat3x3, CFunctions.GetMatrixFloat3x3 (obj, "rotation"), "Rotation3x3 after setter native 3x3"); } } diff --git a/tests/monotouch-test/GameplayKit/GKGridGraphTests.cs b/tests/monotouch-test/GameplayKit/GKGridGraphTests.cs index 36853ae0e6..231194ae14 100644 --- a/tests/monotouch-test/GameplayKit/GKGridGraphTests.cs +++ b/tests/monotouch-test/GameplayKit/GKGridGraphTests.cs @@ -61,13 +61,25 @@ namespace MonoTouchFixtures.GamePlayKit { var tile = maze[i * 10 + j]; switch ((TileType)tile) { case TileType.Wall: +#if NET + walls.Add (graph.GetNodeAt (new Vector2i (i, j))); +#else walls.Add (graph.GetNodeAt (new Vector2i (i, j))); +#endif break; case TileType.Portal: +#if NET + spawnPoints.Add (graph.GetNodeAt (new Vector2i (i, j))); +#else spawnPoints.Add (graph.GetNodeAt (new Vector2i (i, j))); +#endif break; case TileType.Start: +#if NET + startPosition = graph.GetNodeAt (new Vector2i (i, j)); +#else startPosition = graph.GetNodeAt (new Vector2i (i, j)); +#endif break; default: break; @@ -104,13 +116,25 @@ namespace MonoTouchFixtures.GamePlayKit { var tile = maze[i * 10 + j]; switch ((TileType)tile) { case TileType.Wall: +#if NET + walls.Add (graph.GetNodeAt (new Vector2i (i, j))); +#else walls.Add (graph.GetNodeAt (new Vector2i (i, j))); +#endif break; case TileType.Portal: +#if NET + spawnPoints.Add (graph.GetNodeAt (new Vector2i (i, j))); +#else spawnPoints.Add (graph.GetNodeAt (new Vector2i (i, j))); +#endif break; case TileType.Start: +#if NET + startPosition = graph.GetNodeAt (new Vector2i (i, j)); +#else startPosition = graph.GetNodeAt (new Vector2i (i, j)); +#endif break; default: break;