public MainMenu(ContentManager content, string texturePrefix, string[] textures, Vector3[] positions, Vector2[] sizes) { _ButtonList = new List<PlanarButton>(); for(int i=0; i<textures.Length; i++) { PlanarButton planarButtonTemp = new PlanarButton(content, texturePrefix + textures[i], sizes[i], _Scale, positions[i], Matrix.Identity); planarButtonTemp.EnableAnimation(false); _ButtonList.Add(planarButtonTemp); } _nButton = _ButtonList.Count; this._MainMenuVideoPlayer = new MyVideoPlayer(); this._MainMenuVideoPlayer.SetVideoToPlay(BACKGROUND_VIDEO, content); _focusButton = 0; this._Title = new PlanarModel(content, TITLE, TITLE_SIZE, this._Scale, TITLE_POSITION, Matrix.Identity); this._Title.IsAnimate = false; }
public OptionMenu(ContentManager content, string texturePrefix, string[] textures, Vector3[] positions, Vector2[] sizes) { _ButtonList = new List<PlanarButton>(); _PlanarTitle = new PlanarModel(content, texturePrefix + textures[0], sizes[0], _Scale, positions[0], Matrix.Identity); this._PlanarTitle.IsAnimate = false; for(int i=1; i<textures.Length-1; i++) { PlanarButton planarButtonTemp = new PlanarButton(content, texturePrefix + textures[i], sizes[i], _Scale, positions[i], Matrix.Identity); planarButtonTemp.EnableAnimation(false); _ButtonList.Add(planarButtonTemp); } _PlanarPartOfBar = new PlanarModel(content, texturePrefix + textures[textures.Length - 1], sizes[textures.Length - 1], _Scale, positions[textures.Length - 1], Matrix.Identity); _PlanarPartOfBar.IsAnimate = false; _OriginalPositionBar = positions[textures.Length - 1]; _nButton = _ButtonList.Count; this._MainMenuVideoPlayer = new MyVideoPlayer(); this._MainMenuVideoPlayer.SetVideoToPlay(backgroundVideo, content); //Khoi tao _focusButton = 0; _volume = 3; _difficuty = 3; }
/// <summary> /// Allows the game to perform any initialization it needs to before starting to run. /// This is where it can query for any required services and load any non-graphic /// related content. Calling base.Initialize will enumerate through any components /// and initialize them as well. /// </summary> protected override void Initialize() { // TODO: Add your initialization logic here base.Initialize(); graphics.PreferredBackBufferWidth = 620; graphics.PreferredBackBufferHeight = 450; this.ASPECTRATIO = this.Window.ClientBounds.Width / this.Window.ClientBounds.Height; this._GameState = GAME_STATE.TRAILER; //Delegate this._MainMenu.NewGame += new EventHandler(mainMenu_NewGame); this._MainMenu.Option += new EventHandler(mainMenu_Option); this._MainMenu.ExitGame += new EventHandler(mainMenu_ExitGame); SkipTrailerEvent += new EventHandler(SkipTrailer); this._OptionMenus.BackToMainMenu += new EventHandler(optionMenus_BackToMainMenu); this._OptionMenus.DownVolume += new EventHandler(_OptionMenus_DownVolume); this._OptionMenus.UpVolume += new EventHandler(_OptionMenus_UpVolume); this._MyVideoPlayer = new MyVideoPlayer(); this._MyVideoPlayer.SetVideoToPlay(TRAILER_VIDEO, Content); this._Song = Content.Load<Song>("MainMenu\\SoundEff"); MediaPlayer.IsRepeating = true; MediaPlayer.Volume = GAME_VOLUME; graphics.ApplyChanges(); }