public cMenuOptionsWindowButton(GraphicsDeviceManager gd, ContentManager cm) { _instance = this; _graphics = gd; _contentManager = cm; mouseState = new MouseState(); _tabFont = cFontManager.Instance.getFont("Treb8"); _optionsbuttons = new List<cMenuButton>(); cSpriteManager.Instance.addTexture("Resources/Menu/optionswindowtab", "controls_tab"); _tcontrolsTab = new cMenuButton("controls_tab"); _tcontrolsTab.setOnClickListener(this); _tcontrolsTab.Position = new Vector2(800 / 5 + 62, 600 / 2 - 157); _optionsbuttons.Add(_tcontrolsTab); cSpriteManager.Instance.addTexture("Resources/Menu/optionswindowtab", "sound_tab"); _tsoundTab = new cMenuButton("sound_tab"); _tsoundTab.setOnClickListener(this); _tsoundTab.Position = new Vector2(800 / 5 + 132, 600 / 2 - 157); _optionsbuttons.Add(_tsoundTab); cSpriteManager.Instance.addTexture("Resources/Menu/optionswindowtab", "display_tab"); _tdisplayTab = new cMenuButton("display_tab"); _tdisplayTab.setOnClickListener(this); _tdisplayTab.Position = new Vector2(800 / 5 + 202, 600 / 2 - 157); _optionsbuttons.Add(_tdisplayTab); cSpriteManager.Instance.addTexture("Resources/Menu/optionswindowtab", "cancel_button"); _tcancelButton = new cMenuButton("cancel_button"); _tcancelButton.setOnClickListener(this); _tcancelButton.Position = new Vector2(_screenWidth - 231, _screenHeight / 2 + 183); _optionsbuttons.Add(_tcancelButton); }
public void onButtonClicked(cMenuButton button) { GraphicsDevice gd = _graphics.GraphicsDevice; if (button == _tcontrolsTab) { Portal2D.Instance._optionsSelection = 1; Debug.WriteLine(Portal2D.Instance._optionsSelection); } else if (button == _tsoundTab) { Portal2D.Instance._optionsSelection = 2; //Debug.WriteLine(Portal2D.Instance._optionsSelection); } else if (button == _tdisplayTab) { Portal2D.Instance._optionsSelection = 3; //Debug.WriteLine(Portal2D.Instance._optionsSelection); } else if (button == _tcancelButton) { cMenu.Instance._drawOptionsWindow = !cMenu.Instance._drawOptionsWindow; //Debug.WriteLine(Portal2D.Instance._optionsSelection); } }
public void update(GameTime gameTime, int _optionsSelection, cMenuButton button) { mouseState = Mouse.GetState(); for( int i = 0; i < 4; i++) { _optionsbuttons[i].update(gameTime); _optionsbuttons[i].Tint = new Color(255, 255, 255, _windowTint); } onButtonClicked(button); _optionsSelection = Portal2D.Instance._optionsSelection; }
public cMenuWindowButton(GraphicsDeviceManager gd, ContentManager cm) { _instance = this; _graphics = gd; _contentManager = cm; mouseState = new MouseState(); _tabFont = cFontManager.Instance.getFont("Treb8"); _aLevel = new string[6]; _aLevel[0] = "Training"; _aLevel[1] = "level flame"; _aLevel[2] = "level platforms"; _aLevel[3] = "Training"; _aLevel[4] = "Training"; _aLevel[5] = "Training"; _quickgamebuttons = new List<cMenuButton>(); cSpriteManager.Instance.addTexture("Resources/Menu/button2", "button1"); _tButton1 = new cMenuButton("button1"); _tButton1.setOnClickListener(this); _tButton1.Position = new Vector2(_screenWidth - 231, _screenHeight / 2 + 115); _quickgamebuttons.Add(_tButton1); cSpriteManager.Instance.addTexture("Resources/Menu/button2", "button2"); _tButton2 = new cMenuButton("button2"); _tButton2.setOnClickListener(this); _tButton2.Position = new Vector2(_screenWidth - 231, _screenHeight / 2 + 115); _quickgamebuttons.Add(_tButton2); cSpriteManager.Instance.addTexture("Resources/Menu/button2", "button3"); _tButton3 = new cMenuButton("button3"); _tButton3.setOnClickListener(this); _tButton3.Position = new Vector2(_screenWidth - 231, _screenHeight / 2 + 115); _quickgamebuttons.Add(_tButton3); cSpriteManager.Instance.addTexture("Resources/Menu/button1", "nextbutton"); _tButton4 = new cMenuButton("nextbutton"); _tButton4.setOnClickListener(this); _tButton4.Position = new Vector2(_screenWidth - 120, _screenHeight / 2 + 64); _quickgamebuttons.Add(_tButton4); cSpriteManager.Instance.addTexture("Resources/Menu/button2", "button5"); _tButton5 = new cMenuButton("button5"); _tButton5.setOnClickListener(this); _tButton5.Position = new Vector2(_screenWidth - 231, _screenHeight / 2 + 115); _quickgamebuttons.Add(_tButton5); cSpriteManager.Instance.addTexture("Resources/Menu/button2", "button6"); _tButton6 = new cMenuButton("button6"); _tButton6.setOnClickListener(this); _tButton6.Position = new Vector2(_screenWidth - 231, _screenHeight / 2 + 115); _quickgamebuttons.Add(_tButton6); cSpriteManager.Instance.addTexture("Resources/Menu/button2", "button7"); _tButton7 = new cMenuButton("button7"); _tButton7.setOnClickListener(this); _tButton7.Position = new Vector2(_screenWidth - 231, _screenHeight / 2 + 115); _quickgamebuttons.Add(_tButton7); cSpriteManager.Instance.addTexture("Resources/Menu/button1", "previousbutton"); _tButton8 = new cMenuButton("previousbutton"); _tButton8.setOnClickListener(this); _tButton8.Position = new Vector2(478 / 2 - 35, _screenHeight / 2 + 64); _quickgamebuttons.Add(_tButton8); cSpriteManager.Instance.addTexture("Resources/Menu/button1", "cancelbutton"); _tButton9 = new cMenuButton("cancelbutton"); _tButton9.setOnClickListener(this); _tButton9.Position = new Vector2(_screenWidth - 120, _screenHeight / 2 + 115); _quickgamebuttons.Add(_tButton9); }
public void onButtonClicked(cMenuButton button) { // If the start menu button was clicked if (button==_startButton) { cEngine.Instance.startLevel(); } else if (button==_continueButton) { if (cEngine.GameTimer / 1000 < _levelFastestTime || _levelFastestTime == -1) { saveRecord(); } Console.WriteLine(_nextLevel); cEngine.Instance.loadLevel(_nextLevel); } }
public void update(GameTime gameTime, int _quickgameSelection, int _levelSelect, cMenuButton button) { mouseState = Mouse.GetState(); for (int i = 0; i <= 8; i++) { _quickgamebuttons[i].update(gameTime); _quickgamebuttons[i].Tint = new Color(255, 255, 255, _windowTint); } //onButtonClicked(button); _levelSelect = Portal2D.Instance._levelselect; _quickgameSelection = Portal2D.Instance._quickgameSelection; }
public void onButtonClicked(cMenuButton button) { GraphicsDevice gd = _graphics.GraphicsDevice; if (button == _tButton1) { //Portal2D.Instance.launchGame(_aLevel[0]); Portal2D.Instance.launchGame("Training"); } else if (button == _tButton2) { Portal2D.Instance.launchGame(_aLevel[1]); } else if (button == _tButton3) { Portal2D.Instance.launchGame(_aLevel[2]); } else if (button == _tButton4) { Portal2D.Instance._quickgameSelection = 2; Portal2D.Instance._levelselect = 1; } else if (button == _tButton5) { Portal2D.Instance.launchGame(_aLevel[3]); } else if (button == _tButton6) { Portal2D.Instance.launchGame(_aLevel[4]); } else if (button == _tButton7) { Portal2D.Instance.launchGame(_aLevel[5]); } else if (button == _tButton8) { Portal2D.Instance._quickgameSelection = 1; Portal2D.Instance._levelselect = 1; //Portal2D.Instance.launchGame(_aLevel[5]); } else if (button == _tButton9) { cMenu.Instance._drawQuickGameWindow = !cMenu.Instance._drawQuickGameWindow; } }
public void update(GameTime gameTime, int _quickgameSelection, int _optionsSelection, int _levelselect, cMenuButton button) { _MenuWindowButton.update(gameTime, _quickgameSelection, _levelselect, button); _MenuOptionsWindowButton.update(gameTime, _optionsSelection, button); }
/// <summary> /// Load graphics /// </summary> /// <param name="gd">the graphics device</param> private void LoadGraphicsContent() { GraphicsDevice gd = _graphics.GraphicsDevice; Color c = new Color(17, 194, 253); cSpriteManager.Instance.addTexture("Resources/Menu/PortalLogoHiRes", "portal_logo"); _tPortalLogo = new cSprite("portal_logo"); cSpriteManager.Instance.addTexture("Resources/Menu/textnewgame", "new_game"); _tNewGame = new cMenuButton("new_game"); _tNewGame.setHoverOverColor(c); _tNewGame.setOnClickListener(this); _tNewGame.Position = new Vector2(800 / 5 - 73, 600 / 2+39); _buttons.Add(_tNewGame); cSpriteManager.Instance.addTexture("Resources/Menu/textcontinue", "continue"); _tContinue = new cMenuButton("continue"); _tContinue.setHoverOverColor(c); _tContinue.setOnClickListener(this); _tContinue.Position = new Vector2(800 / 5 - 73, 600 / 2 + 59); _buttons.Add(_tContinue); cSpriteManager.Instance.addTexture("Resources/Menu/textquickgame", "quick_game"); _tQuickGame = new cMenuButton("quick_game"); _tQuickGame.setHoverOverColor(c); _tQuickGame.setOnClickListener(this); _tQuickGame.Position = new Vector2(800 / 5 - 73, 600 / 2 + 79); _buttons.Add(_tQuickGame); cSpriteManager.Instance.addTexture("Resources/Menu/textoptions", "options"); _tOptions = new cMenuButton("options"); _tOptions.setHoverOverColor(c); _tOptions.setOnClickListener(this); _tOptions.Position = new Vector2(800 / 5 - 73, 600 / 2 + 99); _buttons.Add(_tOptions); cSpriteManager.Instance.addTexture("Resources/Menu/textquit", "quit"); _tQuit = new cMenuButton("quit"); _tQuit.setHoverOverColor(c); _tQuit.setOnClickListener(this); _tQuit.Position = new Vector2(800 / 5 - 73, 600 / 2 + 119); _buttons.Add(_tQuit); cSpriteManager.Instance.addTexture("Resources/Menu/half-life2_pointer", "mouse_pointer"); _tMousePointer = new cSprite("mouse_pointer"); }
public void onButtonClicked(cMenuButton button) { GraphicsDevice gd = _graphics.GraphicsDevice; if (button == _tNewGame) { Portal2D.Instance.launchGame("Training"); } else if (button == _tContinue) { Portal2D.Instance.continueGame(); } else if (button == _tOptions) { if (!_drawQuickGameWindow) { _drawOptionsWindow = !_drawOptionsWindow; } } else if (button == _tQuickGame) { //if (!_drawOptionsWindow) { _drawQuickGameWindow = !_drawQuickGameWindow; } _drawQuickGameWindow = !_drawQuickGameWindow; } else if (button == _tQuit) { Portal2D.Instance.Exit(); } }