public MenuManager(GraphicsDevice graphicsDevice, Game1 game) { this.game = game; middleScreenY = (ValueBank.WindowSizeY / 2); middleScreenX = (ValueBank.WindowSizeX / 2); CreatingButtons(graphicsDevice); pointerPosMainMenu = new Vector2(mainMenuButtonList[0].GetPos.X - 200, mainMenuButtonList[0].GetPos.Y + 10); pointerPosPause = new Vector2(pauseButtonList[0].GetPos.X - 200, pauseButtonList[0].GetPos.Y + 10); storyTextPos = new Vector2(70, ValueBank.WindowSizeY /*- 100*/); skipTextPos = new Vector2(ValueBank.WindowSizeX - 400, 50); pointerMainMenu = new Pointer(TextureBank.menuTextureList[5], pointerPosMainMenu, mainMenuButtonList); pointerPause = new Pointer(TextureBank.menuTextureList[5], pointerPosPause, pauseButtonList); selectedBtn = 0; mainMenuButtonList[0].activeButton = true; current = States.None; mainMenuBackground = new MainMenuBackground(); PlayerSelectManager = new PlayerSelectManager(); characterInfoManager = new CharacterInfoManager(); scrollSpeed = 0.5f; ReadStory(); }
public CharacterInfoManager() { currentCharacter = Characters.Knight; logoPos = new Vector2(ValueBank.WindowSizeX / 2 - TextureBank.menuTextureList[8].Width / 2, 50); goBackTextPos = new Vector2(15, 15); characterPos = new Rectangle(270, 380, 250, 300); characterInfoPos = new Rectangle(190, 730, 380, 350); AbilityPos = new Rectangle(1050, 500, 450, 450); background = new MainMenuBackground(); }
protected override void LoadContent() { _spriteBatch = new SpriteBatch(GraphicsDevice); Sprite.SpriteBatch = _spriteBatch; DrawnText.SpriteBatch = _spriteBatch; DrawnText.SpriteFont = Content.Load <SpriteFont>("prstartk"); AlphaPassMask.SpriteBatch = _spriteBatch; var opaqueMaskTexture = new Texture2D(GraphicsDevice, 1, 1); opaqueMaskTexture.SetData(new[] { new Color(Color.White, 0.94f) }); var transparentMaskTexture = new Texture2D(GraphicsDevice, 1, 1); transparentMaskTexture.SetData(new[] { Color.TransparentBlack }); AlphaPassMask.OpaqueMaskTexture = opaqueMaskTexture; AlphaPassMask.TransparentMaskTexture = transparentMaskTexture; LightInTheDarkness.ShaderEffect = Content.Load <Effect>("LightInTheDarkness"); LightInTheDarkness.GraphicsDevice = GraphicsDevice; LightInTheDarkness.SpriteBatch = _spriteBatch; PartyTime.ShaderEffect = Content.Load <Effect>("PartyTime"); EnemySpriteFactory.Instance.LoadAllTextures(Content); BlockSpriteFactory.Instance.LoadAllTextures(Content); ItemSpriteFactory.Instance.LoadAllTextures(Content); ProjectileSpriteFactory.Instance.LoadAllTextures(Content); LinkSpriteFactory.Instance.LoadAllTextures(Content); BackgroundSpriteFactory.Instance.LoadAllTextures(Content); PauseSpriteFactory.Instance.LoadAllTextures(Content); HUDSpriteFactory.Instance.LoadAllTextures(Content); MainMenuBackground.LoadTexture(Content); ScoreboardBackground.LoadTexture(Content); JumpMapScreen.LoadTexture(Content); MusicManager.Instance.LoadAllSounds(Content); SoundEffectManager.Instance.LoadAllSounds(Content); Survival.HUD.HUDSpriteFactory.Instance.LoadAllTextures(Content); Survival.Pause.PauseSpriteFactory.Instance.LoadAllTextures(Content); _modeSelect = new ModeSelectWorld(this, _spriteBatch); _normalAgent = new GameStateAgent(_spriteBatch, GraphicsDevice); _normalAgent.DungeonManager.LoadDungeonContent(Content); _survivalAgent = new Survival.GameState.GameStateAgent(_spriteBatch, GraphicsDevice); _survivalAgent.DungeonManager.LoadDungeonContent(Content); }
void InitMenuButtons(Manager gui) { int i = 0; if (MenuButtons != null && MenuButtons.Count > 0) { foreach (var Button in MenuButtons) { MainMenuBackground.Remove(Button); gui.Remove(Button); } MenuButtons.Clear(); } MenuButtons = new List <Button>(); foreach (var Item in GetMenuItems().Where(it => it.IsVisible())) { var MenuButton = new MenuButton(gui, ClickSound, FocusSound, GameSettings); MenuButton.Init(); MenuButton.Text = Item.Text; if (Item.OnClick != null) { MenuButton.Click += (s, e) => { Item.OnClick(); }; } MenuButton.Width = 120; MenuButton.Height = 24; MenuButton.Left = (MainMenuBackground.ClientWidth) - (MenuButton.Width) - 6; MenuButton.Top = MainMenuBackground.ClientHeight - MenuButton.Height - 6 - (30 * i); MenuButton.Anchor = Anchors.Top; MainMenuBackground.Add(MenuButton); MenuButtons.Add(MenuButton); i++; } }
IEnumerable <Item> GetMenuItems() { // Quit var Item = new Item(GlblRes.Quit); Item.OnClick = () => { if (GameRunning) { ExitConfirmationWindow.ShowModal(); ShowLogo(false); ExitConfirmationWindow.Focused = true; } else { Engine.Exit(); } }; yield return(Item); // Credits Item = new Item(GlblRes.Credits); Item.OnClick = () => { CreditsWindow.Show(); ShowLogo(false); CreditsWindow.Focused = true; }; yield return(Item); // Settings Item = new Item(GlblRes.Settings); Item.OnClick = () => { SettingsWindow.ShowModal(); ShowLogo(false); SettingsWindow.Focused = true; }; yield return(Item); // Load Item = new Item(GlblRes.Load); Item.IsVisible = () => { return(SaveGames.Count > 0); }; Item.OnClick = () => { LoadGameWindow.ShowModal(); ShowLogo(false); LoadGameListbox.Focused = true; }; yield return(Item); // Save Item = new Item(GlblRes.Save); Item.IsVisible = () => { return(GameRunning); }; Item.OnClick = () => { ShowLogo(false); SaveGameWindow.ShowModal(); }; yield return(Item); // Continue Item = new Item(GlblRes.Continue); Item.OnClick = () => { ContinueGame(); }; Item.IsVisible = () => { return(GameRunning); }; yield return(Item); // New Game Item = new Item(GlblRes.New_Game); Item.OnClick = () => { MainMenuBackground.Hide(); Engine.Renderer.GUIManager.ShowSoftwareCursor = false; Engine.StartGame(); }; yield return(Item); }
private void ContinueGame() { MainMenuBackground.Hide(); Engine.Resume(); Engine.Renderer.GUIManager.ShowSoftwareCursor = false; }
public MainMenuManager(NogardGame game) { Game = game; MainMenuBackground = new MainMenuBackground(game.Window); }
void AddLoadGameWindow(Manager gui) { var LoadButton = new MenuButton(gui, ClickSound, FocusSound, GameSettings); LoadGameWindow = new Window(gui); LoadGameWindow.Width = 300; LoadGameWindow.Height = 200; LoadGameWindow.CloseButtonVisible = false; LoadGameWindow.Text = GlblRes.Load_Savegame; LoadGameWindow.Parent = MainMenuBackground; LoadGameWindow.Init(); LoadGameWindow.Center(new Point(Game.VIRTUAL_WIDTH, Game.VIRTUAL_HEIGHT)); LoadGameWindow.Visible = false; LoadGameWindow.Resizable = false; LoadGameWindow.IconVisible = false; LoadGameWindow.DragAlpha = 255; LoadGameWindow.Movable = false; var SaveGameScreenshot = new ImageBox(gui); SaveGameScreenshot.Parent = MainMenuBackground; SaveGameScreenshot.Width = MainMenuBackground.Width; SaveGameScreenshot.Height = MainMenuBackground.Height; SaveGameScreenshot.Visible = false; SaveGameScreenshot.SizeMode = SizeMode.Stretched; LoadGameWindow.Closed += (s, e) => { LoadGameListbox.ItemIndex = -1; }; LoadGameListbox = new ListBox(gui); LoadGameListbox.Width = LoadGameWindow.ClientWidth; LoadGameListbox.Parent = LoadGameWindow; LoadGameListbox.Height = LoadGameWindow.ClientHeight - 35; LoadGameListbox.ItemIndexChanged += (s, e) => { ClickSound.Play(GameSettings.SoundEffectVolume, 0f, 0f); MainMenuLabel.Text = string.Empty; if (LoadGameListbox.ItemIndex > -1) { if (SaveGameScreenshot.Image != null) { SaveGameScreenshot.Image.Dispose(); } var Screenshot = SaveGames[SaveGames.Keys.ElementAt(LoadGameListbox.ItemIndex)].Screenshot; if (Screenshot != null) { using (Stream ScreenshotStream = new MemoryStream(Screenshot)) { SaveGameScreenshot.Image = Texture2D.FromStream(Engine.Renderer.GraphicsDevice, ScreenshotStream); } } SaveGameScreenshot.Show(); LoadButton.Enabled = true; } else { SaveGameScreenshot.Hide(); LoadButton.Enabled = false; } }; var Bevel = new Bevel(gui); Bevel.Parent = LoadGameWindow; Bevel.Anchor = Anchors.Bottom | Anchors.Left | Anchors.Right; Bevel.Height = 35; Bevel.Style = BevelStyle.Raised; Bevel.Top = LoadGameWindow.ClientHeight - Bevel.Height; Bevel.Width = LoadGameWindow.ClientWidth; LoadButton.Init(); LoadButton.Parent = Bevel; LoadButton.Enabled = false; LoadButton.Text = GlblRes.Load_Savegame; LoadButton.Click += (s, e) => { MainMenuLabel.Text = string.Empty; try { Engine.LoadState(SaveGames.Keys.ElementAt(LoadGameListbox.ItemIndex)); } catch { MainMenuLabel.Text = GlblRes.Could_not_load_save_game_Maybe_it_was_created_in_an_earlier_game_version; return; } LoadGameWindow.Close(); MainMenuBackground.Hide(); Engine.Resume(); Engine.Renderer.GUIManager.ShowSoftwareCursor = false; }; LoadButton.Width = 130; LoadButton.Left = 5; LoadButton.Top = 5; var CancelButton = new MenuButton(gui, ClickSound, FocusSound, GameSettings); CancelButton.Init(); CancelButton.Parent = Bevel; CancelButton.Text = GlblRes.Cancel; CancelButton.Click += (s, e) => { LoadGameWindow.Close(); ShowLogo(true); }; CancelButton.Width = 130; CancelButton.Left = 150; CancelButton.Top = 5; gui.Add(LoadGameWindow); }