/// <summary> /// Handles the user SwinGame. /// </summary> /// <remarks> /// Reads key and mouse input and converts these into /// actions for the game to perform. The actions /// performed depend upon the state of the game. /// </remarks> public static void HandleUserInput() { //Read incoming input events SwinGame.ProcessEvents(); if (SwinGame.KeyTyped(KeyCode.PageUpKey)) { float max = 1.0F; float increment = 0.1F; if (Audio.MusicVolume() != max) { Audio.SetMusicVolume(Audio.MusicVolume() + increment); } } if (SwinGame.KeyTyped(KeyCode.PageDownKey)) { float min = 0.0F; float decrement = 0.1F; if (Audio.MusicVolume() != min) { Audio.SetMusicVolume(Audio.MusicVolume() - decrement); } } switch (CurrentState) { case GameState.ViewingMainMenu: MenuController.HandleMainMenuInput(); break; case GameState.ViewingGameMenu: MenuController.HandleGameMenuInput(); break; case GameState.AlteringSettings: MenuController.HandleSetupMenuInput(); break; case GameState.Deploying: DeploymentController.HandleDeploymentInput(); break; case GameState.Discovering: DiscoveryController.HandleDiscoveryInput(); break; case GameState.EndingGame: EndingGameController.HandleEndOfGameInput(); break; case GameState.ViewingHighScores: HighScoreController.HandleHighScoreInput(); break; } UtilityFunctions.UpdateAnimations(); }
public GameController(GameResources resources, ScreenController screenController, MenuController menuController, DeploymentController deploymentController, DiscoveryController discoveryController, EndingGameController endingGameController, HighScoreController highScoreController) { //install the controllers and resources Resources = resources; this.screenController = screenController; this.screenController._controller = this; _menuController = menuController; _menuController._controller = this; _deploymentController = deploymentController; _deploymentController._controller = this; _discoveryController = discoveryController; _discoveryController._controller = this; _endingGameController = endingGameController; _endingGameController._controller = this; this.highScoreController = highScoreController; this.highScoreController._controller = this; //bottom state will be quitting. If player exits main menu then the game is over _state.Push(GameState.Quitting); //at the start the player is viewing the main menu _state.Push(GameState.ViewingMainMenu); }
/// <summary> /// Handles the user SwinGame. /// </summary> /// <remarks> /// Reads key and mouse input and converts these into /// actions for the game to perform. The actions /// performed depend upon the state of the game. /// </remarks> public static void HandleUserInput() { //Read incoming input events SwinGame.ProcessEvents(); //Mute background music if (SwinGame.KeyTyped(KeyCode.vk_m)) { if (SwinGame.MusicPlaying()) { SwinGame.StopMusic(); _mute = true; } else { SwinGame.PlayMusic(GameResources.GameMusic("Background")); _mute = false; } } switch (CurrentState) { case GameState.ViewingMainMenu: MenuController.HandleMainMenuInput(); break; case GameState.ViewingGameMenu: MenuController.HandleGameMenuInput(); break; case GameState.AlteringSettings: MenuController.HandleSetupMenuInput(); break; case GameState.Deploying: DeploymentController.HandleDeploymentInput(); MenuController.HandleCommonMenuInput(); //Aerisha Changes/Additions break; case GameState.Discovering: DiscoveryController.HandleDiscoveryInput(); MenuController.HandleCommonMenuInput(); //Aerisha Changes/Additions break; case GameState.EndingGame: EndingGameController.HandleEndOfGameInput(); break; case GameState.ViewingHighScores: HighScoreController.HandleHighScoreInput(); MenuController.HandleScoresPageInput(); //Aerisha Changes/Additions break; case GameState.ViewingInstructMenu: Instructions.HandleInstructInput(); break; } UtilityFunctions.UpdateAnimations(); }
// <summary> // Handles the user SwinGame. // </summary> // <remarks> // Reads key and mouse input and converts these into // actions for the game to perform. The actions // performed depend upon the state of the game. // </remarks> public static void HandleUserInput() { // Read incoming input events SwinGame.ProcessEvents(); switch (CurrentState) { case var @case when @case == GameState.ViewingMainMenu: { MenuController.HandleMainMenuInput(); break; } case var case1 when case1 == GameState.ViewingGameMenu: { MenuController.HandleGameMenuInput(); break; } case var case2 when case2 == GameState.AlteringSettings: { MenuController.HandleSetupMenuInput(); break; } case var case3 when case3 == GameState.Deploying: { DeploymentController.HandleDeploymentInput(); break; } case var case4 when case4 == GameState.Discovering: { DiscoveryController.HandleDiscoveryInput(); break; } case var case5 when case5 == GameState.EndingGame: { EndingGameController.HandleEndOfGameInput(); break; } case var case6 when case6 == GameState.ViewingHighScores: { HighScoreController.HandleHighScoreInput(); break; } } UtilityFunctions.UpdateAnimations(); if (SwinGame.KeyTyped(KeyCode.MKey)) { SwinGame.PauseMusic(); } if (SwinGame.KeyTyped(KeyCode.UKey)) { SwinGame.ResumeMusic(); } }
/// <summary> /// ''' Handles the user SwinGame. /// ''' </summary> /// ''' <remarks> /// ''' Reads key and mouse input and converts these into /// ''' actions for the game to perform. The actions /// ''' performed depend upon the state of the game. /// ''' </remarks> public static void HandleUserInput() { // Read incoming input events SwinGame.ProcessEvents(); switch (CurrentState) { case GameState.ViewingMainMenu: { MenuController.HandleMainMenuInput(); break; } case GameState.ViewingGameMenu: { MenuController.HandleGameMenuInput(); break; } case GameState.AlteringSettings: { MenuController.HandleSetupMenuInput(); break; } case GameState.Deploying: { DeploymentController.HandleDeploymentInput(); break; } case GameState.Discovering: { DiscoveryController.HandleDiscoveryInput(); break; } case GameState.EndingGame: { EndingGameController.HandleEndOfGameInput(); break; } case GameState.ViewingHighScores: { HighScoreController.HandleHighScoreInput(); break; } case GameState.ViewingInstruction: { InstructionController.HandleInstructInput(); break; } case GameState.Reveal: { RevealController.HandleRevealInput(); break; } case GameState.ViewingInstructionImg: { InstructionImgController.HandleImgInstructInput(); break; } UtilityFunctions.UpdateAnimations(); } }
/// <summary> /// Draws the current state of the game to the screen. /// </summary> /// <remarks> /// What is drawn depends upon the state of the game. /// </remarks> public static void DrawScreen(ThemeColor color) { if (MenuController.TColor == ThemeColor.Pink) { UtilityFunctions.DrawBackground(ThemeColor.Pink); } else if (MenuController.TColor == ThemeColor.Green) { UtilityFunctions.DrawBackground(ThemeColor.Green); } else { UtilityFunctions.DrawBackground(ThemeColor.Blue); } switch (CurrentState) { case GameState.ViewingMainMenu: MenuController.DrawMainMenu(); break; case GameState.ViewingGameMenu: MenuController.DrawGameMenu(); break; case GameState.AlteringSettings: MenuController.DrawSettings(); break; /*Add Theme draw*/ case GameState.ThemeColors: MenuController.ThemeSettings(); break; /*Added Draw MusicSettings*/ case GameState.MusicSettings: MenuController.MusicSettings(); break; case GameState.Deploying: DeploymentController.DrawDeployment(); break; case GameState.Discovering: DiscoveryController.DrawDiscovery(); break; //case GameState.EndingGame: // EndingGameController.DrawEndOfGame (); // break; case GameState.ViewingHighScores: HighScoreController.DrawHighScores(); break; } UtilityFunctions.DrawAnimations(); SwinGame.RefreshScreen(); }
//TODO update for unity public static DiscoveryController GetInstance() { if (mInstance == null) { mInstance = new DiscoveryController(); } return(mInstance); }
/// <summary> /// Handles the user SwinGame. /// </summary> /// <remarks> /// Reads key and mouse input and converts these into /// actions for the game to perform. The actions /// performed depend upon the state of the game. /// </remarks> public static void HandleUserInput() { //Read incoming input events SwinGame.ProcessEvents(); switch (CurrentState) { case GameState.ViewingMainMenu: MenuController.HandleMainMenuInput(); break; case GameState.ViewingGameMenu: MenuController.HandleGameMenuInput(); break; case GameState.AlteringSettings: MenuController.HandleSetupMenuInput(); break; // Added Function: Change Music Function // Author: Ernest Soo case GameState.AlteringMusic: MenuController.HandleMusicMenuInput(); break; // Added Function: Change Background Function // Author: Jacky case GameState.AlteringBackground: MenuController.HandleBackgroundMenuInput(); break; // Added Function: Help Function // Author: Ernest Soo case GameState.ViewingHelp: MenuController.HandleHelpMenuInput(); break; case GameState.Deploying: DeploymentController.HandleDeploymentInput(); break; case GameState.Discovering: DiscoveryController.HandleDiscoveryInput(); break; case GameState.EndingGame: EndingGameController.HandleEndOfGameInput(); break; case GameState.ViewingHighScores: HighScoreController.HandleHighScoreInput(); break; } UtilityFunctions.UpdateAnimations(); }
/// <summary> /// Handles the user SwinGame. /// </summary> /// <remarks> /// Reads key and mouse input and converts these into /// actions for the game to perform. The actions /// performed depend upon the state of the game. /// </remarks> public static void HandleUserInput() { //Read incoming input events SwinGame.ProcessEvents(); switch (CurrentState) { case GameState.ViewingMainMenu: MenuController.HandleMainMenuInput(); break; case GameState.ViewingInstruction: Rules.HandleInstruction(); break; case GameState.ViewingGameMenu: MenuController.HandleGameMenuInput(); break; case GameState.AlteringSettings: MenuController.HandleSetupMenuInput(); break; case GameState.Deploying: DeploymentController.HandleDeploymentInput(); break; case GameState.Discovering: DiscoveryController.HandleDiscoveryInput(); break; case GameState.EndingGame: EndingGameController.HandleEndOfGameInput(); break; case GameState.ViewingHighScores: HighScoreController.HandleHighScoreInput(); break; case GameState.AlteringOption: MenuController.HandleOptionMenuInput(); break; case GameState.ChangingMusic: MenuController.HandleMusicMenuInput(); break; /*case GameState.changebg: * MenuController.HandleBGMenuInput (); * break;*/ } UtilityFunctions.UpdateAnimations(); }
public MapInterface( CountryController country, MapController map, DiscoveryController discovery, OutputController output, ContextController context ) { _country = country; _map = map; _discovery = discovery; _out = output; _context = context; ResetPosition(); }
// '' <summary> // '' Handles input during the discovery phase of the game. // '' </summary> // '' <remarks> // '' Escape opens the game menu. Clicking the mouse will // '' attack a location. // '' </remarks> public static void HandleDiscoveryInput() { if (SwinGame.KeyTyped(KeyCode.VK_ESCAPE)) { AddNewState(GameState.ViewingGameMenu); } if (SwinGame.MouseClicked(MouseButton.LeftButton)) { DiscoveryController.DoAttack(); } }
// <summary> // Handles input during the discovery phase of the game. // </summary> // <remarks> // Escape opens the game menu. Clicking the mouse will // attack a location. // </remarks> public static void HandleDiscoveryInput() { if (SwinGame.KeyTyped(KeyCode.EscapeKey)) // condition if esc key is pressed { GameController.AddNewState(GameState.ViewingGameMenu); } if (SwinGame.MouseClicked(MouseButton.LeftButton)) // condition if m1 key is pressed { DiscoveryController.DoAttack(); } }
/// <summary> /// Draws the current state of the game to the screen. /// </summary> /// <remarks> /// What is drawn depends upon the state of the game. /// </remarks> public static void DrawScreen() { UtilityFunctions.DrawBackground(); switch (CurrentState) { case GameState.ViewingMainMenu: { MenuController.DrawMainMenu(); break; } case GameState.ViewingGameMenu: { MenuController.DrawGameMenu(); break; } case GameState.AlteringSettings: { MenuController.DrawSettings(); break; } case GameState.Deploying: { DeploymentController.DrawDeployment(); break; } case GameState.Discovering: { DiscoveryController.DrawDiscovery(); break; } case GameState.EndingGame: { EndingGameController.DrawEndOfGame(); break; } case GameState.ViewingHighScores: { HighScoreController.DrawHighScores(); break; } } UtilityFunctions.DrawAnimations(); SwinGame.RefreshScreen(); }
/// <summary> /// Handles the user SwinGame. /// </summary> /// <remarks> /// Reads key and mouse input and converts these into /// actions for the game to perform. The actions /// performed depend upon the state of the game. /// </remarks> public static void HandleUserInput() { //Read incoming input events SwinGame.ProcessEvents(); if (SwinGame.KeyTyped(KeyCode.vk_F1)) { SwinGame.ToggleFullScreen(); } if (SwinGame.KeyTyped(KeyCode.vk_F2)) { SwinGame.TakeScreenshot("screenshot"); } switch (CurrentState) { case GameState.ViewingMainMenu: MenuController.HandleMainMenuInput(); break; case GameState.ViewingGameMenu: MenuController.HandleGameMenuInput(); break; case GameState.AlteringSettings: MenuController.HandleSetupMenuInput(); break; case GameState.BGMSettings: MenuController.HandleBGMMenuInput(); break; case GameState.Deploying: DeploymentController.HandleDeploymentInput(); break; case GameState.Discovering: DiscoveryController.HandleDiscoveryInput(); break; case GameState.EndingGame: EndingGameController.HandleEndOfGameInput(); break; case GameState.ViewingHighScores: HighScoreController.HandleHighScoreInput(); break; } UtilityFunctions.UpdateAnimations(); }
/// <summary> /// Draws the current state of the game to the screen. /// </summary> /// <remarks> /// What is drawn depends upon the state of the game. /// </remarks> public static void DrawScreen() { UtilityFunctions.DrawBackground(); switch (CurrentState) { case GameState.ViewingMainMenu: MenuController.DrawMainMenu(); SwinGame.StopTimer(Timer); break; case GameState.ViewingGameMenu: MenuController.DrawGameMenu(); SwinGame.StopTimer(Timer); break; case GameState.AlteringSettings: MenuController.DrawSettings(); SwinGame.StopTimer(Timer); break; case GameState.Deploying: DeploymentController.DrawDeployment(); SwinGame.ResetTimer(Timer); break; case GameState.Discovering: DiscoveryController.DrawDiscovery(); if (SwinGame.TimerTicks(Timer) == 0) { SwinGame.StartTimer(Timer); } break; case GameState.EndingGame: EndingGameController.DrawEndOfGame(); break; case GameState.ViewingHighScores: HighScoreController.DrawHighScores(); SwinGame.StopTimer(Timer); break; case GameState.ViewInstruction: Instruction.WriteInstruction(); break; } UtilityFunctions.DrawAnimations(); SwinGame.RefreshScreen(); }
public ConquestInterface( ContextController context, InputController input, OutputController output, CountryController country, MapController map, DiscoveryController discovery, ArmyController army, ConquestController conquest ) { _context = context; _input = input; _out = output; _country = country; _map = map; _discovery = discovery; _army = army; _conquest = conquest; }
public void DiscoveryController_PostInvalidData_ReturnsBadRequest() { var controller = new DiscoveryController(_service, _logger) { ControllerContext = new ControllerContext() }; controller.ModelState.AddModelError("foo", "bar"); var res = (ObjectResult)controller.Post(null, null).Result; Assert.AreEqual(StatusCodes.Status400BadRequest, res.StatusCode); Assert.AreEqual("bar", ((ValidationErrorsViewModel)res.Value).Errors.Single().Message); }
/// <summary> /// Draws the current state of the game to the screen. /// </summary> /// <remarks> /// What is drawn depends upon the state of the game. /// </remarks> public static void DrawScreen() { UtilityFunctions.DrawBackground(); if (CurrentState == GameState.ViewingMainMenu) { SwinGame.StopTimer(GameTimer); MenuController.DrawMainMenu(); } else if (CurrentState == GameState.ViewingGameMenu) { SwinGame.StopTimer(GameTimer); MenuController.DrawGameMenu(); } else if (CurrentState == GameState.AlteringSettings) { SwinGame.StopTimer(GameTimer); MenuController.DrawSettings(); } else if (CurrentState == GameState.AlterMusics) { SwinGame.StopTimer(GameTimer); MenuController.DrawMusicSettings(); } else if (CurrentState == GameState.Deploying) { SwinGame.ResetTimer(GameTimer); DeploymentController.DrawDeployment(); } else if (CurrentState == GameState.Discovering) { if (SwinGame.TimerTicks(GameTimer) == 0) { SwinGame.StartTimer(GameTimer); } DiscoveryController.DrawDiscovery(); } else if (CurrentState == GameState.EndingGame) { EndingGameController.DrawEndOfGame(); } else if (CurrentState == GameState.ViewingHighScores) { HighScoreController.DrawHighScores(); } UtilityFunctions.DrawAnimations(); SwinGame.RefreshScreen(120); }
/// <summary> /// Draws the current state of the game to the screen. /// </summary> /// <remarks> /// What is drawn depends upon the state of the game. /// </remarks> public static void DrawScreen() { UtilityFunctions.DrawBackground(); switch (CurrentState) { case GameState.ViewingMainMenu: MenuController.DrawMainMenu(); break; case GameState.ViewingGameMenu: MenuController.DrawGameMenu(); break; case GameState.AlteringSettings: MenuController.DrawSettings(); break; // Added Function: Change Music Function // Author: Ernest Soo case GameState.AlteringMusic: MenuController.DrawMusic(); break; // Added Function: Change Background Function // Author: Jacky Ten case GameState.AlteringBackground: MenuController.DrawBackground(); break; case GameState.Deploying: DeploymentController.DrawDeployment(); break; case GameState.Discovering: DiscoveryController.DrawDiscovery(); break; case GameState.EndingGame: EndingGameController.DrawEndOfGame(); break; case GameState.ViewingHighScores: HighScoreController.DrawHighScores(); break; } UtilityFunctions.DrawAnimations(); SwinGame.RefreshScreen(); }
/// <summary> /// Draws the current state of the game to the screen. /// </summary> /// <remarks> /// What is drawn depends upon the state of the game. /// </remarks> public static void DrawScreen() { UtilityFunctions.DrawBackground(); switch (CurrentState) { case GameState.ViewingMainMenu: MenuController.DrawMainMenu(); break; case GameState.ViewingGameMenu: MenuController.DrawGameMenu(); break; case GameState.AlteringSettings: MenuController.DrawSettings(); break; case GameState.ChangingMusic: MenuController.DrawMusicMenu(); break; case GameState.Deploying: DeploymentController.DrawDeployment(); break; case GameState.Discovering: DiscoveryController.DrawDiscovery(); break; case GameState.EndingGame: EndingGameController.DrawEndOfGame(); break; case GameState.ViewingHighScores: HighScoreController.DrawHighScores(); break; case GameState.ShowingHint: // ShowingHint state draws the Hints on top of the regular grid DiscoveryController.DrawDiscovery(); DiscoveryController.DrawHint(); break; } UtilityFunctions.DrawAnimations(); SwinGame.RefreshScreen(); }
/// <summary> /// C-tor /// </summary> public DiscoveryPage() { InitializeComponent(); _controller = new DiscoveryController(this); _controller.DeviceDiscovered += OnDeviceDiscovered; _controller.DiscoveryCompleted += OnDiscoveryCompleted; _controller.DeviceInformationReceived += OnDeviceInformationReceived; _controller.DiscoveryError += OnDiscoveryError; ClearServiceInfo(); FillNetworkInterfaces(); if (cmbNICs.Items.Count > 0) { cmbNICs.SelectedIndex = 0; } }
/// <summary> /// C-tor /// </summary> public DiscoveryPage() { InitializeComponent(); _controller = new DiscoveryController(this); _controller.DeviceDiscovered += new Action <DeviceDiscoveryData>(OnDeviceDiscovered); _controller.DiscoveryCompleted += new Action(OnDiscoveryCompleted); _controller.DeviceInformationReceived += new ManagementServiceProvider.DeviceInformationReceived(OnDeviceInformationReceived); _controller.DiscoveryError += new Action <Exception>(OnDiscoveryError); ClearServiceInfo(); FillNetworkInterfaces(); if (cmbNICs.Items.Count > 0) { cmbNICs.SelectedIndex = 0; } }
/// <summary> /// Handles the user SwinGame. /// </summary> /// <remarks> /// Reads key and mouse input and converts these into /// actions for the game to perform. The actions /// performed depend upon the state of the game. /// </remarks> public static void HandleUserInput() { //Read incoming input events SwinGame.ProcessEvents(); switch (CurrentState) { case GameState.ViewingMainMenu: MenuController.HandleMainMenuInput(); break; case GameState.ViewingGameMenu: MenuController.HandleGameMenuInput(); break; case GameState.AlteringSettings: MenuController.HandleSetupMenuInput(); break; /*Added MusicSettings*/ case GameState.MusicSettings: MenuController.HandleMusicMenuInput(); break; /*Add themesetting*/ case GameState.ThemeColors: MenuController.HandleThemeMenuInput(); break; case GameState.Deploying: DeploymentController.HandleDeploymentInput(); break; case GameState.Discovering: DiscoveryController.HandleDiscoveryInput(); break; case GameState.EndingGame: EndingGameController.HandleEndOfGameInput(); break; case GameState.ViewingHighScores: HighScoreController.HandleHighScoreInput(); break; } UtilityFunctions.UpdateAnimations(); }
/// <summary> /// Handles the user SwinGame. /// </summary> /// <remarks> /// Reads key and mouse input and converts these into /// actions for the game to perform. The actions /// performed depend upon the state of the game. /// </remarks> public static void HandleUserInput() { //Read incoming input events SwinGame.ProcessEvents(); switch (CurrentState) { case GameState.ViewingMainMenu: MenuController.HandleMainMenuInput(); break; case GameState.ViewingGameMenu: MenuController.HandleGameMenuInput(); break; case GameState.AlteringSettings: MenuController.HandleSetupMenuInput(); break; case GameState.ChangingMusic: MenuController.HandleMusicMenuInput(); break; case GameState.Deploying: DeploymentController.HandleDeploymentInput(); break; case GameState.Discovering: DiscoveryController.HandleDiscoveryInput(); break; case GameState.EndingGame: EndingGameController.HandleEndOfGameInput(); break; case GameState.ViewingHighScores: HighScoreController.HandleHighScoreInput(); break; case GameState.ShowingHint: // ShowingHint state must use same input handler as Discovery state // since it works on top of the same state DiscoveryController.HandleDiscoveryInput(); break; } UtilityFunctions.UpdateAnimations(); }
/// <summary> /// Draws the current state of the game to the screen. /// </summary> /// <remarks> /// What is drawn depends upon the state of the game. /// </remarks> public static void DrawScreen() { if (SwinGame.KeyTyped(KeyCode.vk_m)) { GameResources.Mute(); } if (SwinGame.KeyTyped(KeyCode.vk_p)) { GameResources.Play(); } UtilityFunctions.DrawBackground(); switch (CurrentState) { case GameState.ViewingMainMenu: MenuController.DrawMainMenu(); break; case GameState.ViewingGameMenu: MenuController.DrawGameMenu(); break; case GameState.AlteringSettings: MenuController.DrawSettings(); break; case GameState.Deploying: DeploymentController.DrawDeployment(); break; case GameState.Discovering: DiscoveryController.DrawDiscovery(); break; case GameState.EndingGame: EndingGameController.DrawEndOfGame(); break; case GameState.ViewingHighScores: HighScoreController.DrawHighScores(); break; } UtilityFunctions.DrawAnimations(); SwinGame.RefreshScreen(); }
/// <summary> /// Draws the current state of the game to the screen. /// </summary> /// <remarks> /// What is drawn depends upon the state of the game. /// </remarks> public static void DrawScreen() { UtilityFunctions.DrawBackground(); switch (CurrentState) { case GameState.ViewingMainMenu: MenuController.DrawMainMenu(); break; case GameState.ViewingGameMenu: MenuController.DrawGameMenu(); break; case GameState.AlteringSettings: MenuController.DrawSettings(); break; case GameState.Deploying: DeploymentController.DrawDeployment(); MenuController.DrawCommonMenu(); // Aerisha Changes/Additions break; case GameState.Discovering: DiscoveryController.DrawDiscovery(); MenuController.DrawCommonMenu(); // Aerisha Changes/Additions break; case GameState.EndingGame: EndingGameController.DrawEndOfGame(); break; case GameState.ViewingHighScores: HighScoreController.DrawHighScores(); MenuController.DrawScoresPage(); // Aerisha Changes/Additions break; case GameState.ViewingInstructMenu: Instructions.DrawInstruct(); break; } UtilityFunctions.DrawAnimations(); SwinGame.RefreshScreen(); }
/// <summary> /// ''' Draws the current state of the game to the screen. /// ''' </summary> /// ''' <remarks> /// ''' What is drawn depends upon the state of the game. /// ''' </remarks> public static void DrawScreen() { UtilityFunctions.DrawBackground(); if (CurrentState == GameState.ViewingMainMenu) { MenuController.DrawMainMenu(); } else if (CurrentState == GameState.ViewingGameMenu) { MenuController.DrawGameMenu(); } else if (CurrentState == GameState.AlteringSettings) { MenuController.DrawSettings(); } else if (CurrentState == GameState.ChangingMusic) //Recently Added { MenuController.DrawMusicMenu(); } else if (CurrentState == GameState.Deploying) { DeploymentController.DrawDeployment(); } else if (CurrentState == GameState.AlteringOption) { MenuController.DrawOption(); //RECENTLY ADDED } else if (CurrentState == GameState.Discovering) { DiscoveryController.DrawDiscovery(); } else if (CurrentState == GameState.EndingGame) { EndingGameController.DrawEndOfGame(); } else if (CurrentState == GameState.ViewingHighScores) { HighScoreController.DrawHighScores(); } UtilityFunctions.DrawAnimations(); SwinGame.RefreshScreen(); }
/// <summary> /// Handles the user SwinGame. /// </summary> /// <remarks> /// Reads key and mouse input and converts these into /// actions for the game to perform. The actions /// performed depend upon the state of the game. /// </remarks> public static void HandleUserInput() { //Read incoming input events SwinGame.ProcessEvents(); if (_muteCheck) { SwinGame.PauseMusic(); } else { SwinGame.ResumeMusic(); } if (CurrentState == GameState.ViewingMainMenu) { MenuController.HandleMainMenuInput(); } else if (CurrentState == GameState.ViewingGameMenu) { MenuController.HandleGameMenuInput(); } else if (CurrentState == GameState.AlteringSettings) { MenuController.HandleSetupMenuInput(); } else if (CurrentState == GameState.Deploying) { DeploymentController.HandleDeploymentInput(); } else if (CurrentState == GameState.Discovering) { DiscoveryController.HandleDiscoveryInput(); } else if (CurrentState == GameState.EndingGame) { EndingGameController.HandleEndOfGameInput(); } else if (CurrentState == GameState.ViewingHighScores) { HighScoreController.HandleHighScoreInput(); } UtilityFunctions.UpdateAnimations(); }
/// <summary> /// ''' Handles the user SwinGame. /// ''' </summary> /// ''' <remarks> /// ''' Reads key and mouse input and converts these into /// ''' actions for the game to perform. The actions /// ''' performed depend upon the state of the game. /// ''' </remarks> public static void HandleUserInput() { // Read incoming input events SwinGame.ProcessEvents(); if (CurrentState == GameState.ViewingMainMenu) { MenuController.HandleMainMenuInput(); } else if (CurrentState == GameState.ViewingGameMenu) { MenuController.HandleGameMenuInput(); } else if (CurrentState == GameState.AlteringSettings) { MenuController.HandleSetupMenuInput(); } else if (CurrentState == GameState.ChangingMusic) //Recently Added { MenuController.HandleMusicMenuInput(); } else if (CurrentState == GameState.Deploying) { DeploymentController.HandleDeploymentInput(); } else if (CurrentState == GameState.Discovering) { DiscoveryController.HandleDiscoveryInput(); } else if (CurrentState == GameState.AlteringOption) //RECENTLY ADDED { MenuController.HandleOptionMenuInput(); } else if (CurrentState == GameState.EndingGame) { EndingGameController.HandleEndOfGameInput(); } else if (CurrentState == GameState.ViewingHighScores) { HighScoreController.HandleHighScoreInput(); } UtilityFunctions.UpdateAnimations(); }
/// <summary> /// Handles the user SwinGame. /// </summary> /// <remarks> /// Reads key and mouse input and converts these into /// actions for the game to perform. The actions /// performed depend upon the state of the game. /// </remarks> public static void HandleUserInput() { //Read incoming input events SwinGame.ProcessEvents(); switch (CurrentState) { case GameState.ViewingMainMenu: MenuController.HandleMainMenuInput(); break; case GameState.ViewingGameMenu: MenuController.HandleGameMenuInput(); break; case GameState.AlteringSettings: MenuController.HandleSetupMenuInput(); break; case GameState.Deploying: DeploymentController.HandleDeploymentInput(); break; case GameState.Discovering: DiscoveryController.HandleDiscoveryInput(); break; case GameState.EndingGame: EndingGameController.HandleEndOfGameInput(); break; case GameState.ViewingHighScores: HighScoreController.HandleHighScoreInput(); break; } if (SwinGame.MouseClicked(MouseButton.LeftButton)) { if (UtilityFunctions.IsMouseInRectangle(HOME_BUTTON_LEFT, TOP_BUTTONS_TOP, HOME_BUTTON_WIDTH, TOP_BUTTONS_HEIGHT)) { GameController.AddNewState(GameState.ViewingGameMenu); } } UtilityFunctions.UpdateAnimations(); }