private void SetSelection(ButtonSprite selection) { if (null != selection && m_timerSelection < DateTime.Now) { m_timerSelection = DateTime.Now + TimeSpan.FromMilliseconds(DELAY_MS); SelectedButton = selection; } }
/// <summary> /// LoadContent will be called once per game and is the place to load /// all of your content. /// </summary> protected override void LoadContent() { // Create a new SpriteBatch, which can be used to draw textures. _spriteBatch = new SpriteBatch(GraphicsDevice); // TODO: use this.Content to load your game content here _font = Content.Load<SpriteFont>("spriteFont1"); _mpSound1 = new CustomMediaPlayer(); _mpSound2 = new CustomMediaPlayer(); int center = _graphics.PreferredBackBufferWidth/2; int y = 200; int offset = 75; _btnFadeIn1 = new ButtonSprite(); _btnFadeIn1.Initialize(_font, Content.Load<Texture2D>("Graphics\\ButtonActive"), Content.Load<Texture2D>("Graphics\\ButtonInactive")); _btnFadeIn1.Position = new Vector2(center, y += offset); _btnFadeIn1.TextureScale = new Vector2(2f, 0.5f); _btnFadeIn1.Text = "Fade In 1"; _btnFadeIn1.TextOffset = new Vector2(60, 20); _buttons.Add(_btnFadeIn1); _btnFadeIn2 = new ButtonSprite(); _btnFadeIn2.Initialize(_font, Content.Load<Texture2D>("Graphics\\ButtonActive"), Content.Load<Texture2D>("Graphics\\ButtonInactive")); _btnFadeIn2.Position = new Vector2(center, y += offset); _btnFadeIn2.TextureScale = new Vector2(2f, 0.5f); _btnFadeIn2.Text = "Fade In 2"; _btnFadeIn2.TextOffset = new Vector2(60, 20); _buttons.Add(_btnFadeIn2); _btnFadeOut1 = new ButtonSprite(); _btnFadeOut1.Initialize(_font, Content.Load<Texture2D>("Graphics\\ButtonActive"), Content.Load<Texture2D>("Graphics\\ButtonInactive")); _btnFadeOut1.Position = new Vector2(center, y += offset); _btnFadeOut1.TextureScale = new Vector2(2f, 0.5f); _btnFadeOut1.Text = "Fade Out 1"; _btnFadeOut1.TextOffset = new Vector2(60, 20); _buttons.Add(_btnFadeOut1); _btnFadeOut2 = new ButtonSprite(); _btnFadeOut2.Initialize(_font, Content.Load<Texture2D>("Graphics\\ButtonActive"), Content.Load<Texture2D>("Graphics\\ButtonInactive")); _btnFadeOut2.Position = new Vector2(center, y += offset); _btnFadeOut2.TextureScale = new Vector2(2f, 0.5f); _btnFadeOut2.Text = "Fade Out 2"; _btnFadeOut2.TextOffset = new Vector2(60, 20); _buttons.Add(_btnFadeOut2); _btnCrossFade1 = new ButtonSprite(); _btnCrossFade1.Initialize(_font, Content.Load<Texture2D>("Graphics\\ButtonActive"), Content.Load<Texture2D>("Graphics\\ButtonInactive")); _btnCrossFade1.Position = new Vector2(center, y += offset); _btnCrossFade1.TextureScale = new Vector2(2f, 0.5f); _btnCrossFade1.Text = "Cross Fade 1"; _btnCrossFade1.TextOffset = new Vector2(60, 20); _buttons.Add(_btnCrossFade1); _btnCrossFade2 = new ButtonSprite(); _btnCrossFade2.Initialize(_font, Content.Load<Texture2D>("Graphics\\ButtonActive"), Content.Load<Texture2D>("Graphics\\ButtonInactive")); _btnCrossFade2.Position = new Vector2(center, y += offset); _btnCrossFade2.TextureScale = new Vector2(2f, 0.5f); _btnCrossFade2.Text = "Cross Fade 2"; _btnCrossFade2.TextOffset = new Vector2(60, 20); _buttons.Add(_btnCrossFade2); _focusManager.SelectedButton = _btnFadeIn1; _focusManager.Mappings[_btnFadeIn1] = new FocusManager.ButtonMapping() { Down = _btnFadeIn2 }; _focusManager.Mappings[_btnFadeIn2] = new FocusManager.ButtonMapping() { Up = _btnFadeIn1, Down = _btnFadeOut1, }; _focusManager.Mappings[_btnFadeOut1] = new FocusManager.ButtonMapping() { Up = _btnFadeIn2, Down = _btnFadeOut2, }; _focusManager.Mappings[_btnFadeOut2] = new FocusManager.ButtonMapping() { Up = _btnFadeOut1, Down = _btnCrossFade1, }; _focusManager.Mappings[_btnCrossFade1] = new FocusManager.ButtonMapping() { Up = _btnFadeOut2, Down = _btnCrossFade2, }; _focusManager.Mappings[_btnCrossFade2] = new FocusManager.ButtonMapping() { Up = _btnCrossFade1, }; }
/// <summary> /// LoadContent will be called once per game and is the place to load /// all of your content. /// </summary> protected override void LoadContent() { // Create a new SpriteBatch, which can be used to draw textures. _spriteBatch = new SpriteBatch(GraphicsDevice); // TODO: use this.Content to load your game content here _font = Content.Load <SpriteFont>("spriteFont1"); _mpSound1 = new CustomMediaPlayer(); _mpSound2 = new CustomMediaPlayer(); int center = _graphics.PreferredBackBufferWidth / 2; int y = 200; int offset = 75; _btnFadeIn1 = new ButtonSprite(); _btnFadeIn1.Initialize(_font, Content.Load <Texture2D>("Graphics\\ButtonActive"), Content.Load <Texture2D>("Graphics\\ButtonInactive")); _btnFadeIn1.Position = new Vector2(center, y += offset); _btnFadeIn1.TextureScale = new Vector2(2f, 0.5f); _btnFadeIn1.Text = "Fade In 1"; _btnFadeIn1.TextOffset = new Vector2(60, 20); _buttons.Add(_btnFadeIn1); _btnFadeIn2 = new ButtonSprite(); _btnFadeIn2.Initialize(_font, Content.Load <Texture2D>("Graphics\\ButtonActive"), Content.Load <Texture2D>("Graphics\\ButtonInactive")); _btnFadeIn2.Position = new Vector2(center, y += offset); _btnFadeIn2.TextureScale = new Vector2(2f, 0.5f); _btnFadeIn2.Text = "Fade In 2"; _btnFadeIn2.TextOffset = new Vector2(60, 20); _buttons.Add(_btnFadeIn2); _btnFadeOut1 = new ButtonSprite(); _btnFadeOut1.Initialize(_font, Content.Load <Texture2D>("Graphics\\ButtonActive"), Content.Load <Texture2D>("Graphics\\ButtonInactive")); _btnFadeOut1.Position = new Vector2(center, y += offset); _btnFadeOut1.TextureScale = new Vector2(2f, 0.5f); _btnFadeOut1.Text = "Fade Out 1"; _btnFadeOut1.TextOffset = new Vector2(60, 20); _buttons.Add(_btnFadeOut1); _btnFadeOut2 = new ButtonSprite(); _btnFadeOut2.Initialize(_font, Content.Load <Texture2D>("Graphics\\ButtonActive"), Content.Load <Texture2D>("Graphics\\ButtonInactive")); _btnFadeOut2.Position = new Vector2(center, y += offset); _btnFadeOut2.TextureScale = new Vector2(2f, 0.5f); _btnFadeOut2.Text = "Fade Out 2"; _btnFadeOut2.TextOffset = new Vector2(60, 20); _buttons.Add(_btnFadeOut2); _btnCrossFade1 = new ButtonSprite(); _btnCrossFade1.Initialize(_font, Content.Load <Texture2D>("Graphics\\ButtonActive"), Content.Load <Texture2D>("Graphics\\ButtonInactive")); _btnCrossFade1.Position = new Vector2(center, y += offset); _btnCrossFade1.TextureScale = new Vector2(2f, 0.5f); _btnCrossFade1.Text = "Cross Fade 1"; _btnCrossFade1.TextOffset = new Vector2(60, 20); _buttons.Add(_btnCrossFade1); _btnCrossFade2 = new ButtonSprite(); _btnCrossFade2.Initialize(_font, Content.Load <Texture2D>("Graphics\\ButtonActive"), Content.Load <Texture2D>("Graphics\\ButtonInactive")); _btnCrossFade2.Position = new Vector2(center, y += offset); _btnCrossFade2.TextureScale = new Vector2(2f, 0.5f); _btnCrossFade2.Text = "Cross Fade 2"; _btnCrossFade2.TextOffset = new Vector2(60, 20); _buttons.Add(_btnCrossFade2); _focusManager.SelectedButton = _btnFadeIn1; _focusManager.Mappings[_btnFadeIn1] = new FocusManager.ButtonMapping() { Down = _btnFadeIn2 }; _focusManager.Mappings[_btnFadeIn2] = new FocusManager.ButtonMapping() { Up = _btnFadeIn1, Down = _btnFadeOut1, }; _focusManager.Mappings[_btnFadeOut1] = new FocusManager.ButtonMapping() { Up = _btnFadeIn2, Down = _btnFadeOut2, }; _focusManager.Mappings[_btnFadeOut2] = new FocusManager.ButtonMapping() { Up = _btnFadeOut1, Down = _btnCrossFade1, }; _focusManager.Mappings[_btnCrossFade1] = new FocusManager.ButtonMapping() { Up = _btnFadeOut2, Down = _btnCrossFade2, }; _focusManager.Mappings[_btnCrossFade2] = new FocusManager.ButtonMapping() { Up = _btnCrossFade1, }; }