Переглянути джерело

Command out GamePad etc loading as that class, bizzarely, no longer exists. Fixes build.

Dominique Louis 3 тижнів тому
батько
коміт
fb084ec512

+ 13 - 0
Peer2PeerSample/.idea/.idea.Peer2PeerSample/.idea/.gitignore

@@ -0,0 +1,13 @@
+# Default ignored files
+/shelf/
+/workspace.xml
+# Rider ignored files
+/modules.xml
+/.idea.Peer2PeerSample.iml
+/contentModel.xml
+/projectSettingsUpdater.xml
+# Editor-based HTTP Client requests
+/httpRequests/
+# Datasource local storage ignored files
+/dataSources/
+/dataSources.local.xml

+ 6 - 0
Peer2PeerSample/.idea/.idea.Peer2PeerSample/.idea/AndroidProjectSystem.xml

@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project version="4">
+  <component name="AndroidProjectSystem">
+    <option name="providerId" value="RiderAndroidProjectSystem" />
+  </component>
+</project>

+ 10 - 0
Peer2PeerSample/.idea/.idea.Peer2PeerSample/.idea/deploymentTargetSelector.xml

@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project version="4">
+  <component name="deploymentTargetSelector">
+    <selectionStates>
+      <SelectionState runConfigName="Peer2Peer.Android">
+        <option name="selectionMode" value="DROPDOWN" />
+      </SelectionState>
+    </selectionStates>
+  </component>
+</project>

+ 8 - 0
Peer2PeerSample/.idea/.idea.Peer2PeerSample/.idea/indexLayout.xml

@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project version="4">
+  <component name="UserContentModel">
+    <attachedFolders />
+    <explicitIncludes />
+    <explicitExcludes />
+  </component>
+</project>

+ 7 - 0
Peer2PeerSample/.idea/.idea.Peer2PeerSample/.idea/vcs.xml

@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project version="4">
+  <component name="VcsDirectoryMappings">
+    <mapping directory="" vcs="Git" />
+    <mapping directory="$PROJECT_DIR$/.." vcs="Git" />
+  </component>
+</project>

+ 23 - 18
Peer2PeerSample/Core/PeerToPeerGame.cs

@@ -28,7 +28,7 @@ namespace PeerToPeer
 		const int screenHeight = 540;
 		const int maxGamers = 16;
 		const int maxLocalGamers = 4;
-		GraphicsDeviceManager graphics;
+		GraphicsDeviceManager graphicsDeviceManager;
 		SpriteBatch spriteBatch;
 		SpriteFont font;
 		KeyboardState currentKeyboardState;
@@ -38,17 +38,28 @@ namespace PeerToPeer
 		PacketWriter packetWriter = new PacketWriter();
 		PacketReader packetReader = new PacketReader();
 		string errorMessage;
-		Texture2D gamePadTexture;
+		//Texture2D gamePadTexture;
 
 		public PeerToPeerGame()
 		{
-			graphics = new GraphicsDeviceManager(this);
+			graphicsDeviceManager = new GraphicsDeviceManager(this);
 
-			graphics.PreferredBackBufferWidth = screenWidth;
-			graphics.PreferredBackBufferHeight = screenHeight;
-			if (UIUtilty.IsMobile)
+			graphicsDeviceManager.PreferredBackBufferWidth = screenWidth;
+			graphicsDeviceManager.PreferredBackBufferHeight = screenHeight;
+
+			if (UIUtility.IsMobile)
+			{
+				graphicsDeviceManager.IsFullScreen = true;
+				IsMouseVisible = false;
+			}
+			else if (UIUtility.IsDesktop)
+			{
+				graphicsDeviceManager.IsFullScreen = false;
+				IsMouseVisible = true;
+			}
+			else
 			{
-				graphics.IsFullScreen = true;
+				throw new PlatformNotSupportedException();
 			}
 
 			Content.RootDirectory = "Content";
@@ -65,9 +76,9 @@ namespace PeerToPeer
 
 			font = Content.Load<SpriteFont>("Font");
 
-			if (UIUtilty.IsMobile)
+			if (UIUtility.IsMobile)
 			{
-				gamePadTexture = Content.Load<Texture2D>("gamepad.png");
+				/* gamePadTexture = Content.Load<Texture2D>("gamepad.png");
 
 				ThumbStickDefinition thumbStickLeft = new ThumbStickDefinition();
 				thumbStickLeft.Position = new Vector2(10, 400);
@@ -81,7 +92,7 @@ namespace PeerToPeer
 				thumbStickRight.Texture = gamePadTexture;
 				thumbStickRight.TextureRect = new Rectangle(2, 2, 68, 68);
 
-				GamePad.RightThumbStickDefinition = thumbStickRight;
+				GamePad.RightThumbStickDefinition = thumbStickRight; */
 			}
 		}
 
@@ -263,9 +274,6 @@ namespace PeerToPeer
 
 				localTank.Update();
 
-				// Reset the writer so we don't append across frames
-				packetWriter.Position = 0; // or: packetWriter.Reset();
-
 				// Write the tank state into a network packet.
 				packetWriter.Write(localTank.Position);
 				packetWriter.Write(localTank.TankRotation);
@@ -273,9 +281,6 @@ namespace PeerToPeer
 
 				// Send the data to everyone in the session.
 				localNetworkGamer.SendData(packetWriter, SendDataOptions.InOrder);
-
-				// Reset after send, to be extra safe
-				packetWriter.Position = 0; // or: packetWriter.Reset();
 			}
 		}
 
@@ -387,9 +392,9 @@ namespace PeerToPeer
 				}
 			}
 
-			if (UIUtilty.IsMobile)
+			if (UIUtility.IsMobile)
 			{
-				GamePad.Draw(gameTime, spriteBatch);
+				// TODO GamePad.Draw(gameTime, spriteBatch);
 			}
 
 			spriteBatch.End();

+ 1 - 1
Peer2PeerSample/Core/Utils/UIUtilty.cs → Peer2PeerSample/Core/Utils/UIUtility.cs

@@ -11,7 +11,7 @@ using System.Text;
 
 namespace PeerToPeer
 {
-    public static class UIUtilty
+    public static class UIUtility
     {
         /// <summary>
         /// Indicates if the game is running on a mobile platform.