public void StartGame(int slot) { currentSlot = slot; if (slots[currentSlot] != null && slots[currentSlot].success) { return; //FIXME: Play a negative beep or something. } else if (slots[currentSlot] == null || !slots[currentSlot].started) { universe.ClearGameObjects(); menuState = MenuStateEnum.NONE; gameState = GameStateEnum.PLAYING; NewGame(); state.playingState = PlayStateEnum.INTRO; } else { universe.ClearGameObjects(); menuState = MenuStateEnum.NONE; gameState = GameStateEnum.PLAYING; state = slots[currentSlot]; LoadGame(); state.playingState = PlayStateEnum.PLAY; } soundtrack.Stop(); player.transform.position = new Vector2(state.playerState.playerPositionX, state.playerState.playerPositionY); SaveGame(); soundtrack.Play(); }
private void ShowFullMenu(bool animated) { if (animated) { UIView.Animate(0.3, 0, UIViewAnimationOptions.BeginFromCurrentState | UIViewAnimationOptions.TransitionCrossDissolve | UIViewAnimationOptions.CurveEaseOut | UIViewAnimationOptions.AllowAnimatedContent, () => { for (int i = 0; i < this.itemViews.Count; i++) { var itemView = this.itemViews[i]; itemView.TargetFrame = new RectangleF(0, itemView.Bounds.Size.Height * i, itemView.Bounds.Size.Width, itemView.Bounds.Size.Height); itemView.Alpha = 0.1f; } }, () => { UIView.Animate(0.3, 0, UIViewAnimationOptions.BeginFromCurrentState | UIViewAnimationOptions.TransitionCrossDissolve | UIViewAnimationOptions.CurveEaseOut | UIViewAnimationOptions.AllowAnimatedContent, () => { this.IterateAndShowFullMenu(); }, () => { this.MenuState = MenuStateEnum.FullMenu; }); }); } else { this.IterateAndShowFullMenu(); this.MenuState = MenuStateEnum.FullMenu; } }
void ManipulateScale(GameTime gameTime) { switch (currentState) { case MenuStateEnum.Maximizing: transition.Increase(gameTime); break; case MenuStateEnum.Minimizing: transition.Decrease(gameTime); break; } if (transition.Value == 0.0f) { if (pendingWindow == null) { currentState = MenuStateEnum.Hidden; } else { activeWindow = pendingWindow; activeWindow.IsActive = true; this.currentState = MenuStateEnum.Maximizing; } } else if (transition.Value == transition.MaxValue) { currentState = MenuStateEnum.Focused; } camera.Zoom = transition.Value; }
public void OnClickMultiPlayerPlay() { //GameControllerCall GameStateHolder.GameMode = GameStateHolder.GameModesEnum.MultiPlayer; MenuState = MenuStateEnum.MultiPlayerPlay; UpdateUI(); }
public void SwapWindow(string window) { if (menuWindows.ContainsKey(window)) { pendingWindow = menuWindows[window]; this.currentState = MenuStateEnum.Minimizing; } }
public SlideMenu (List<MenuItem> items) { this.items = items; this.UserInteractionEnabled = true; this.itemViews = new List<MenuItemView>(); this.MenuState = MenuStateEnum.IconMenu; this.SetupLayout(); this.ShowIconMenu (false); }
public MainWindowViewModel() { _game = new Game(); _game.Message += MessageHandler; _menuState = MenuStateEnum.Combat; _game.Play(); _outputString = new StringBuilder(); WriteToOutputString("Hello, Welcome to Dungeons and Dragons"); }
public SlideMenu(List <MenuItem> items) { this.items = items; this.UserInteractionEnabled = true; this.itemViews = new List <MenuItemView>(); this.MenuState = MenuStateEnum.IconMenu; this.SetupLayout(); this.ShowIconMenu(false); }
public MainWindowViewModel() { _game = new Game(); _game.Message += MessageHandler; _menuState = MenuStateEnum.Combat; _game.Play(); _outputString = new StringBuilder(); WriteToOutputString("Hello, Welcome to Dungeons and Dragons"); }
public void OnClickGetInfoMultiPlayer() { if (PanelMultiPlayer.transform.Find("IN_Name").GetComponent <InputField> ().text.Length > 0 && PanelMultiPlayer.transform.Find("IN_Age").GetComponent <InputField> ().text.Length > 0) { MenuState = MenuStateEnum.MultiPlayerControllerDetectionPhase; UpdateUI(); } else { StartCoroutine(SetStatusBarText("INFO: Please input your name and age!")); } }
public void DrawCredits() { if (InputManager.Instance.GetKeyboardButtonDown(Microsoft.Xna.Framework.Input.Keys.Enter) || InputManager.Instance.GetGamePadButtonDown(Microsoft.Xna.Framework.Input.Buttons.A)) { this.menuState = MenuStateEnum.MainMenu; } GUIManager.Instance.DrawText(this.font, "BACK", this.backPos, Color.Yellow); GUIManager.Instance.DrawText(this.font, "$", this.creditsDollarOnePos, this.normalColor); GUIManager.Instance.DrawText(this.font, "$", this.creditsDollarTwoPos, this.normalColor); for (int i = 0; i < 6; ++i) { GUIManager.Instance.DrawText(this.font, this.names[i], this.firstNamePos + new Vector2(0.0f, i * 0.033f), this.normalColor, 0.55f); } }
public void OnClickGetInfoSinglePlayer() { if (PanelSinglePlayer.transform.Find("IN_Name").GetComponent <InputField> ().text.Length > 0 && PanelSinglePlayer.transform.Find("IN_Age").GetComponent <InputField> ().text.Length > 0) { MenuState = MenuStateEnum.SinglePlayerControllerDetectionPhase; UpdateUI(); PlayerStateHolder.PlayerType = PlayerStateHolder.PlayerEnum.FirstPlayer; PlayerStateHolder.PlayerName = PanelSinglePlayer.transform.Find("IN_Name").GetComponent <InputField> ().text; PlayerStateHolder.PlayerAge = int.Parse(PanelSinglePlayer.transform.Find("IN_Age").GetComponent <InputField> ().text); } else { StartCoroutine(SetStatusBarText("INFO: Please input your name and age!")); } }
private void ShowIconMenu(bool animated) { if (animated) { UIView.Animate(0.3, 0, UIViewAnimationOptions.BeginFromCurrentState | UIViewAnimationOptions.TransitionCrossDissolve | UIViewAnimationOptions.CurveEaseOut | UIViewAnimationOptions.AllowAnimatedContent, () => { this.IterateAndShowIcons(); }, () => { this.MenuState = MenuStateEnum.IconMenu; }); } else { this.IterateAndShowIcons(); this.MenuState = MenuStateEnum.IconMenu; } }
public void ActionHandler(object sender, PlayerActionEventArgs args) { if (SelectedCharacter == null) { WriteToOutputString("Please Select a target to attack."); } else { _game.PlayerAction(args.Action, SelectedCharacter); } switch (args.Action) { case PlayerActionEnum.Attack: if (SelectedCharacter == null) { WriteToOutputString("Please Select a target to attack."); } else { _game.PlayerAction(args.Action, SelectedCharacter); } break; case PlayerActionEnum.FullAttack: if (SelectedCharacter == null) { WriteToOutputString("Please Select a target to attack."); } else { _game.PlayerAction(args.Action, SelectedCharacter); } break; case PlayerActionEnum.EndTurn: _game.PlayerAction(args.Action, SelectedCharacter); break; case PlayerActionEnum.DisplayItems: _previousState = MenuState; MenuState = MenuStateEnum.Items; break; } }
public MenuHandler(ContentManager Content, GraphicsDevice graphicsDevice, MapHandlerScene mapHandler, PuzzleEngineAlpha.Level.TileMap tileMap, ResolutionHandler resolutionHandler, GameSceneDirector sceneDirector) { this.graphicsDevice = graphicsDevice; menuWindows = new Dictionary <string, IScene>(); menuWindows.Add("mainMenu", new MainMenu(Content, this, sceneDirector)); menuWindows.Add("loadMap", new LoadMapMenu(graphicsDevice, Content, this, mapHandler, tileMap)); menuWindows.Add("settings", new SettingsMenu(Content, this, resolutionHandler)); activeWindow = menuWindows["mainMenu"]; IsActive = false; currentState = new MenuStateEnum(); currentState = MenuStateEnum.Hidden; transition = new PuzzleEngineAlpha.Animations.SmoothTransition(0.0f, 0.011f, 0.0f, 1.0f); this.camera = new PuzzleEngineAlpha.Camera.Camera(Vector2.Zero, new Vector2(ResolutionHandler.WindowWidth, ResolutionHandler.WindowHeight), new Vector2(ResolutionHandler.WindowWidth, PuzzleEngineAlpha.Resolution.ResolutionHandler.WindowHeight)); camera.Zoom = transition.Value; ResolutionHandler.Changed += ResetSizes; }
/// <summary> /// Handling keys for menu navigation. /// </summary> /// <param name="keyboard"> Game's KeyboardState.</param> public static void KeysHandler(KeyboardState keyboard) { KeyboardState newKeyboardState = keyboard; if (newKeyboardState.IsKeyDown(Keys.Up) && oldKeyboardState.IsKeyUp(Keys.Up)) { menuState--; if (menuState < 0) { menuState = 0; } } else if (newKeyboardState.IsKeyDown(Keys.Down) && oldKeyboardState.IsKeyUp(Keys.Down)) { menuState++; if (menuState == (MenuStateEnum)3) { menuState = MenuStateEnum.exit; } } else if (keyboard.IsKeyDown(Keys.Enter)) { switch (menuState) { case MenuStateEnum.newGame: MenuFlags.isMenuActive = false; break; case MenuStateEnum.ranking: Ranking.isRankingActive = true; break; case MenuStateEnum.exit: MenuFlags.exitFlag = true; break; default: break; } } oldKeyboardState = newKeyboardState; }
public void GoInactive() { currentState = MenuStateEnum.Minimizing; pendingWindow = null; }
public void OnClickPlay() { MenuState = MenuStateEnum.Play; UpdateUI(); }
public void Start() { MenuState = MenuStateEnum.Init; BackgroundMusic.volume = PlayerPrefs.GetFloat("BackgroundMusic", 1); PlayerStateHolder.PlayerHand = PlayerStateHolder.PlayerHandEnum.LeftHand; }
public void OnClickNoExit() { MenuState = MenuStateEnum.Init; UpdateUI(); }
public void OnClickSaveAndExitSettings() { PlayerPrefs.SetFloat("BackgroundMusic", BackgroundMusic.volume); MenuState = MenuStateEnum.Init; UpdateUI(); }
public void ActionHandler(object sender, PlayerActionEventArgs args) { if (SelectedCharacter == null) { WriteToOutputString("Please Select a target to attack."); } else { _game.PlayerAction(args.Action, SelectedCharacter); } switch (args.Action) { case PlayerActionEnum.Attack: if (SelectedCharacter == null) { WriteToOutputString("Please Select a target to attack."); } else { _game.PlayerAction(args.Action, SelectedCharacter); } break; case PlayerActionEnum.FullAttack: if (SelectedCharacter == null) { WriteToOutputString("Please Select a target to attack."); } else { _game.PlayerAction(args.Action, SelectedCharacter); } break; case PlayerActionEnum.EndTurn: _game.PlayerAction(args.Action, SelectedCharacter); break; case PlayerActionEnum.DisplayItems: _previousState = MenuState; MenuState = MenuStateEnum.Items; break; } }
private void ShowFullMenu (bool animated) { if (animated) { UIView.Animate(0.3, 0, UIViewAnimationOptions.BeginFromCurrentState|UIViewAnimationOptions.TransitionCrossDissolve|UIViewAnimationOptions.CurveEaseOut|UIViewAnimationOptions.AllowAnimatedContent, () => { for (int i = 0; i < this.itemViews.Count; i++) { var itemView = this.itemViews[i]; itemView.TargetFrame = new RectangleF (0, itemView.Bounds.Size.Height * i, itemView.Bounds.Size.Width, itemView.Bounds.Size.Height); itemView.Alpha = 0.1f; } }, () => { UIView.Animate(0.3, 0, UIViewAnimationOptions.BeginFromCurrentState|UIViewAnimationOptions.TransitionCrossDissolve|UIViewAnimationOptions.CurveEaseOut|UIViewAnimationOptions.AllowAnimatedContent, () => { this.IterateAndShowFullMenu(); }, () => { this.MenuState = MenuStateEnum.FullMenu; }); }); } else { this.IterateAndShowFullMenu(); this.MenuState = MenuStateEnum.FullMenu; } }
public void DrawMainMenu() { if (InputManager.Instance.GetKeyboardButtonDown(Microsoft.Xna.Framework.Input.Keys.S) || InputManager.Instance.GetGamePadButtonDown(Microsoft.Xna.Framework.Input.Buttons.DPadDown) || InputManager.Instance.GetGamePadButtonDown(Microsoft.Xna.Framework.Input.Buttons.LeftThumbstickDown) || InputManager.Instance.GetKeyboardButtonDown(Microsoft.Xna.Framework.Input.Keys.Down)) { if (currentOption < 3) { currentOption += 1; } else { currentOption = 0; } if (currentOption == 1) { currentOption += 1; } this.currentDollarYPos = this.dollarInitialYPos + 0.06f * this.currentOption; } if (InputManager.Instance.GetKeyboardButtonDown(Microsoft.Xna.Framework.Input.Keys.W) || InputManager.Instance.GetGamePadButtonDown(Microsoft.Xna.Framework.Input.Buttons.DPadUp) || InputManager.Instance.GetGamePadButtonDown(Microsoft.Xna.Framework.Input.Buttons.LeftThumbstickUp) || InputManager.Instance.GetKeyboardButtonDown(Microsoft.Xna.Framework.Input.Keys.Up)) { if (currentOption > 0) { currentOption -= 1; } else { currentOption = 3; } if (currentOption == 1) { currentOption -= 1; } this.currentDollarYPos = this.dollarInitialYPos + 0.06f * this.currentOption; } GUIManager.Instance.DrawText(this.font, "NEW GAME", this.newGamePos, this.currentOption == 0 ? this.activeColor : this.normalColor); GUIManager.Instance.DrawText(this.font, "CONTINUE", this.continuePos, Color.Gray); GUIManager.Instance.DrawText(this.font, "CREDITS", this.creditsPos, this.currentOption == 2 ? this.activeColor : this.normalColor); GUIManager.Instance.DrawText(this.font, "EXIT", this.exitPos, this.currentOption == 3 ? this.activeColor : this.normalColor); GUIManager.Instance.DrawText(this.font, "$", new Vector2(this.dollarOneXPos, this.currentDollarYPos), this.normalColor); GUIManager.Instance.DrawText(this.font, "$", new Vector2(this.dollarTwoXPos, this.currentDollarYPos), this.normalColor); if (InputManager.Instance.GetKeyboardButtonDown(Microsoft.Xna.Framework.Input.Keys.Enter) || InputManager.Instance.GetGamePadButtonDown(Microsoft.Xna.Framework.Input.Buttons.A)) { switch (this.currentOption) { case 0: SaveManager.Instance.XmlPath = "../../../../TrashSoupContent/Scenes/loading.xml"; welcomeCue.Stop(AudioStopOptions.Immediate); bgCue.Stop(AudioStopOptions.Immediate); SaveManager.Instance.LoadFileAction(); break; case 1: SaveManager.Instance.XmlPath = "../../../../TrashSoupContent/Scenes/loading.xml"; SaveManager.Instance.LoadFileAction(); break; case 2: this.menuState = MenuStateEnum.Credits; break; case 3: TrashSoupGame.Instance.Exit(); break; } } }
public void OnClickSettings() { MenuState = MenuStateEnum.Settings; UpdateUI(); GameObject.Find("SLDR_BackgroundMusic").GetComponent <Slider> ().value = BackgroundMusic.volume; }
private void ShowIconMenu(bool animated) { if (animated) { UIView.Animate(0.3, 0, UIViewAnimationOptions.BeginFromCurrentState|UIViewAnimationOptions.TransitionCrossDissolve|UIViewAnimationOptions.CurveEaseOut|UIViewAnimationOptions.AllowAnimatedContent, () => { this.IterateAndShowIcons(); }, () => { this.MenuState = MenuStateEnum.IconMenu; }); } else { this.IterateAndShowIcons(); this.MenuState = MenuStateEnum.IconMenu; } }