public MainMenuState() : base() { _ControlManager = new ControlManagerComponent(this); SpriteFont font = CorvusGame.Instance.GlobalContent.Load<SpriteFont>("Fonts/MainMenuFont"); Image bgImg = new Image(CorvusGame.Instance.GlobalContent.Load<Texture2D>("Interface/TitleScreenBackground")); bgImg.Size = new Vector2(UIHelper.Viewport.Width, UIHelper.Viewport.Height); ControlManager.AddControl(bgImg); Image titleImg = new Image(CorvusGame.Instance.GlobalContent.Load<Texture2D>("Interface/TitleText")); titleImg.Position = UIHelper.AlignControl(titleImg.Size, HorizontalAlignment.Center, VerticalAlignment.Top) + new Vector2(0, (UIHelper.Viewport.Height/2) * 0.1f);; ControlManager.AddControl(titleImg); var hackSize = new Vector2(175f, 50f); // a hack to align things. LinkButton continueBtn = new LinkButton(font); continueBtn.Text = "Continue"; continueBtn.Color = Color.Black; continueBtn.IsVisible = false; //TODO: Will need to hide this if there is no saved state. continueBtn.IsEnabled = false; continueBtn.Position = UIHelper.AlignControl(hackSize, HorizontalAlignment.Center, VerticalAlignment.Center) + new Vector2(0, 50f); continueBtn.Selected += continueBtn_Selected; ControlManager.AddControl(continueBtn); LinkButton newGameBtn = new LinkButton(font); newGameBtn.Text = "New Game"; newGameBtn.Color = Color.Black; newGameBtn.Position = UIHelper.AlignControl(hackSize, HorizontalAlignment.Center, VerticalAlignment.Center) + new Vector2(0, 100f); newGameBtn.Selected += newGameBtn_Selected; ControlManager.AddControl(newGameBtn); LinkButton arenaModeBtn = new LinkButton(font); arenaModeBtn.Text = "Arena Mode"; arenaModeBtn.Color = Color.Black; arenaModeBtn.Position = UIHelper.AlignControl(hackSize, HorizontalAlignment.Center, VerticalAlignment.Center) + new Vector2(0, 150f); arenaModeBtn.Selected += arenaModeBtn_Selected; ControlManager.AddControl(arenaModeBtn); LinkButton exitBtn = new LinkButton(font); exitBtn.Text = "Exit"; exitBtn.Color = Color.Black; exitBtn.Position = UIHelper.AlignControl(hackSize, HorizontalAlignment.Center, VerticalAlignment.Center) + new Vector2(0, 200f); exitBtn.Selected += exitBtn_Selected; ControlManager.AddControl(exitBtn); #if DEBUG LinkButton testModeBtn = new LinkButton(font); testModeBtn.Text = "Test Mode"; testModeBtn.Color = Color.Black; testModeBtn.IsEnabled = true; testModeBtn.Position = UIHelper.AlignControl(hackSize, HorizontalAlignment.Center, VerticalAlignment.Center) + new Vector2(0, 250f); testModeBtn.Selected += testModeBtn_Selected; ControlManager.AddControl(testModeBtn); #endif ControlManager.SetFocus(); this.AddComponent(_ControlManager); }
public PausedState() : base() { _ControlManager = new ControlManagerComponent(this); SpriteFont font = CorvusGame.Instance.GlobalContent.Load<SpriteFont>("Fonts/MainMenuFont"); Image bg = new Image(CorvusGame.Instance.GlobalContent.Load<Texture2D>("Interface/PausedBackgroundalt")); bg.Size = new Vector2(UIHelper.Viewport.Width, UIHelper.Viewport.Height); _ControlManager.AddControl(bg); Label lblpaused = new Label(font); lblpaused.Text = "Paused"; lblpaused.Position = UIHelper.AlignControl(lblpaused.Size, HorizontalAlignment.Center, VerticalAlignment.Top)+ new Vector2(0, 20f); _ControlManager.AddControl(lblpaused); LinkButton continueBtn = new LinkButton(font); continueBtn.Text = "Continue"; continueBtn.Selected += continueBtn_Selected; continueBtn.Position = UIHelper.AlignControl(continueBtn.Size, HorizontalAlignment.Center, VerticalAlignment.Center); _ControlManager.AddControl(continueBtn); //LinkButton optionsBtn = new LinkButton(font); //optionsBtn.Text = "Options"; //optionsBtn.Selected += optionsBtn_Selected; //optionsBtn.Position = UIHelper.AlignControl(optionsBtn.Size, HorizontalAlignment.Center, VerticalAlignment.Center) + new Vector2(0f, 50f); ; //_ControlManager.AddControl(optionsBtn); LinkButton returnToMainMenuBtn = new LinkButton(font); returnToMainMenuBtn.Text = "Return to Main Menu"; returnToMainMenuBtn.Selected += returnToMainMenuBtn_Selected; returnToMainMenuBtn.Position = UIHelper.AlignControl(returnToMainMenuBtn.Size, HorizontalAlignment.Center, VerticalAlignment.Center) + new Vector2(0f, 50f); _ControlManager.AddControl(returnToMainMenuBtn); LinkButton exitGameBtn = new LinkButton(font); exitGameBtn.Text = "Exit Game"; exitGameBtn.Selected += exitGameBtn_Selected; exitGameBtn.Position = UIHelper.AlignControl(exitGameBtn.Size, HorizontalAlignment.Center, VerticalAlignment.Center) + new Vector2(0f, 100f); _ControlManager.AddControl(exitGameBtn); _ControlManager.SetFocus(); this.AddComponent(_ControlManager); }
public OptionsState() : base() { _ControlManager = new ControlManagerComponent(this); SpriteFont font = CorvusGame.Instance.GlobalContent.Load<SpriteFont>("Fonts/MainMenuFont"); Image bg = new Image(CorvusGame.Instance.GlobalContent.Load<Texture2D>("Interface/PausedBackgroundalt")); bg.Size = new Vector2(UIHelper.Viewport.Width, UIHelper.Viewport.Height); _ControlManager.AddControl(bg); LinkButton fullScreenBtn = new LinkButton(font); fullScreenBtn.Text = "Fullscreen: " + (audio ? "on" : "off"); fullScreenBtn.Selected += fullScreenBtn_Selected; fullScreenBtn.Position = UIHelper.AlignControl(fullScreenBtn.Size, HorizontalAlignment.Center, VerticalAlignment.Center) + new Vector2(0f, 50f); _ControlManager.AddControl(fullScreenBtn); LinkButton audioBtn = new LinkButton(font); audioBtn.Text = "Audio: " + (audio ? "on" : "off"); audioBtn.Selected += audioBtn_Selected; audioBtn.Position = UIHelper.AlignControl(audioBtn.Size, HorizontalAlignment.Center, VerticalAlignment.Center) + new Vector2(0f, 100f); _ControlManager.AddControl(audioBtn); LinkButton rumbleBtn = new LinkButton(font); rumbleBtn.Text = "Rumble: " + (rumble ? "on" : "off"); rumbleBtn.Selected += rumbleBtn_Selected; rumbleBtn.Position = UIHelper.AlignControl(rumbleBtn.Size, HorizontalAlignment.Center, VerticalAlignment.Center) + new Vector2(0f, 150f); _ControlManager.AddControl(rumbleBtn); LinkButton backBtn = new LinkButton(font); backBtn.Text = "Back"; backBtn.Selected += backBtn_Selected; backBtn.Position = UIHelper.AlignControl(backBtn.Size, HorizontalAlignment.Center, VerticalAlignment.Center) + new Vector2(0f, 200f); _ControlManager.AddControl(backBtn); _ControlManager.SetFocus(); this.AddComponent(_ControlManager); }