فهرست منبع

Tidy up Sample

Dominique Louis 3 هفته پیش
والد
کامیت
42e76acf16

+ 12 - 19
NetworkStateManagement/Core/NetworkStateManagementGame.cs

@@ -22,6 +22,8 @@ namespace NetworkStateManagement
 	/// </summary>
 	public class NetworkStateManagementGame : Game
 	{
+		const int screenWidth = 480;
+		const int screenHeight = 540;
 
 		GraphicsDeviceManager graphics;
 		ScreenManager screenManager;
@@ -30,17 +32,14 @@ namespace NetworkStateManagement
 		// By preloading any assets used by UI rendering, we avoid framerate glitches
 		// when they suddenly need to be loaded in the middle of a menu transition.
 		static readonly string[] preloadAssets =
-	{
-		"gradient",
-		"cat",
-		"chat_ready",
-		"chat_able",
-		"chat_talking",
-		"chat_mute",
-	};
-
-
-
+		{
+			"gradient",
+			"cat",
+			"chat_ready",
+			"chat_able",
+			"chat_talking",
+			"chat_mute",
+		};
 
 		/// <summary>
 		/// The main game constructor.
@@ -53,8 +52,8 @@ namespace NetworkStateManagement
 #if MOBILE
 			graphics.IsFullScreen = true;
 #endif
-			graphics.PreferredBackBufferWidth = 1067;
-			graphics.PreferredBackBufferHeight = 600;
+			graphics.PreferredBackBufferWidth = screenWidth;
+			graphics.PreferredBackBufferHeight = screenHeight;
 
 			// Create components.
 			screenManager = new ScreenManager(this);
@@ -76,7 +75,6 @@ namespace NetworkStateManagement
 			// Guide.SimulateTrialMode = true;
 		}
 
-
 		/// <summary>
 		/// Loads graphics content.
 		/// </summary>
@@ -88,10 +86,6 @@ namespace NetworkStateManagement
 			}
 		}
 
-
-
-
-
 		/// <summary>
 		/// This is called when the game should draw itself.
 		/// </summary>
@@ -105,5 +99,4 @@ namespace NetworkStateManagement
 
 
 	}
-
 }

+ 2 - 21
NetworkStateManagement/Core/Networking/LobbyScreen.cs

@@ -30,9 +30,6 @@ namespace NetworkStateManagement
 		Texture2D isTalkingTexture;
 		Texture2D voiceMutedTexture;
 
-
-
-
 		/// <summary>
 		/// Constructs a new lobby screen.
 		/// </summary>
@@ -45,7 +42,6 @@ namespace NetworkStateManagement
 
 		}
 
-
 		/// <summary>
 		/// Loads graphics content used by the lobby screen.
 		/// </summary>
@@ -59,10 +55,6 @@ namespace NetworkStateManagement
 			voiceMutedTexture = content.Load<Texture2D>("chat_mute");
 		}
 
-
-
-
-
 		/// <summary>
 		/// Updates the lobby screen.
 		/// </summary>
@@ -91,7 +83,6 @@ namespace NetworkStateManagement
 			}
 		}
 
-
 		/// <summary>
 		/// Handles user input for all the local gamers in the session. Unlike most
 		/// screens, which use the InputState class to combine input data from all
@@ -117,7 +108,6 @@ namespace NetworkStateManagement
 			}
 		}
 
-
 		/// <summary>
 		/// Handle MenuSelect inputs by marking ourselves as ready.
 		/// </summary>
@@ -142,7 +132,6 @@ namespace NetworkStateManagement
 			}
 		}
 
-
 		/// <summary>
 		/// Event handler for when the host selects ok on the "are you sure
 		/// you want to start even though not everyone is ready" message box.
@@ -155,7 +144,6 @@ namespace NetworkStateManagement
 			}
 		}
 
-
 		/// <summary>
 		/// Handle MenuCancel inputs by clearing our ready status, or if it is
 		/// already clear, prompting if the user wants to leave the session.
@@ -174,10 +162,6 @@ namespace NetworkStateManagement
 			}
 		}
 
-
-
-
-
 		/// <summary>
 		/// Draws the lobby screen.
 		/// </summary>
@@ -186,7 +170,7 @@ namespace NetworkStateManagement
 			SpriteBatch spriteBatch = ScreenManager.SpriteBatch;
 			SpriteFont font = ScreenManager.Font;
 
-			Vector2 position = new Vector2(100, 150);
+			Vector2 position = new Vector2(50, 100);
 
 			// Make the lobby slide into place during transitions.
 			float transitionOffset = (float)Math.Pow(TransitionPosition, 2);
@@ -219,7 +203,7 @@ namespace NetworkStateManagement
 			// Draw the screen title.
 			string title = Resources.Lobby;
 
-			Vector2 titlePosition = new Vector2(533, 80);
+			Vector2 titlePosition = new Vector2(100, 80);
 			Vector2 titleOrigin = font.MeasureString(title) / 2;
 			Color titleColor = new Color(192, 192, 192) * TransitionAlpha;
 			float titleScale = 1.25f;
@@ -232,7 +216,6 @@ namespace NetworkStateManagement
 			spriteBatch.End();
 		}
 
-
 		/// <summary>
 		/// Helper draws the gamertag and status icons for a single NetworkGamer.
 		/// </summary>
@@ -283,7 +266,5 @@ namespace NetworkStateManagement
 			spriteBatch.DrawString(font, text, position + iconWidth * 2,
 				color * TransitionAlpha);
 		}
-
-
 	}
 }

+ 1 - 19
NetworkStateManagement/Core/Screens/GameplayScreen.cs

@@ -34,10 +34,7 @@ namespace NetworkStateManagement
         Random random = new Random();
 
         float pauseAlpha;
-
-
-
-
+        
         /// <summary>
         /// The logic for deciding whether the game is paused depends on whether
         /// this is a networked or single player game. If we are in a network session,
@@ -63,10 +60,6 @@ namespace NetworkStateManagement
             }
         }
 
-
-
-
-
         /// <summary>
         /// Constructor.
         /// </summary>
@@ -78,7 +71,6 @@ namespace NetworkStateManagement
             TransitionOffTime = TimeSpan.FromSeconds(0.5);
         }
 
-
         /// <summary>
         /// Load graphics content for the game.
         /// </summary>
@@ -100,7 +92,6 @@ namespace NetworkStateManagement
             ScreenManager.Game.ResetElapsedTime();
         }
 
-
         /// <summary>
         /// Unload graphics content used by the game.
         /// </summary>
@@ -109,10 +100,6 @@ namespace NetworkStateManagement
             content.Unload();
         }
 
-
-
-
-
         /// <summary>
         /// Updates the state of the game.
         /// </summary>
@@ -156,7 +143,6 @@ namespace NetworkStateManagement
             }
         }
 
-
         /// <summary>
         /// Lets the game respond to player input. Unlike the Update method,
         /// this will only be called when the gameplay screen is active.
@@ -185,7 +171,6 @@ namespace NetworkStateManagement
             }
         }
 
-
         /// <summary>
         /// Handles input for the specified player. In local game modes, this is called
         /// just once for the controlling player. In network modes, it can be called
@@ -240,7 +225,6 @@ namespace NetworkStateManagement
             return true;
         }
 
-
         /// <summary>
         /// Draws the gameplay screen.
         /// </summary>
@@ -277,7 +261,5 @@ namespace NetworkStateManagement
                 ScreenManager.FadeBackBufferToBlack(alpha);
             }
         }
-
-
     }
 }

+ 11 - 0
NetworkStateManagement/NetworkStateManagement.code-workspace

@@ -0,0 +1,11 @@
+{
+	"folders": [
+		{
+			"path": "."
+		},
+		{
+			"path": "../MonoGame.Xna.Framework.Net"
+		}
+	],
+	"settings": {}
+}