public override void Update(GameTime gameTime) { base.Update(gameTime); for (int i = 0; i < text.Length; i++) { menuItems[i].Update(gameTime); } background.Update(gameTime); sign.Update(gameTime); poster.Update(gameTime); test_text.Update(gameTime); if (background.Alpha > 0.0f) { IsVisible = true; } if (InputManager.Instance.KeyPressed(Keys.Down)) { menuItems[currentSelected].Selected = false; currentSelected++; if (currentSelected == text.Length) { currentSelected = 0; } menuItems[currentSelected].Selected = true; } if (InputManager.Instance.KeyPressed(Keys.Up)) { menuItems[currentSelected].Selected = false; currentSelected--; if (currentSelected == -1) { currentSelected = text.Length - 1; } menuItems[currentSelected].Selected = true; } if (menuItems[currentSelected].ItemID == 2 && InputManager.Instance.KeyPressed(Keys.Enter)) { Game1.ExitGame = true; } }
public void Update(GameTime gameTime) { title.Update(gameTime); SetTitlePosition(); }
public virtual void Update(GameTime gameTime) { background.Update(gameTime); if (currentSelectedMainControl != selection.fieldactive) { currentSelectedItemControl = selection.arrow_left; CurrentActiveItem = 0; } #region "Seleced Update" switch (currentSelectedMainControl) { case selection.buttonup: mainbuttonup.Update(gameTime); break; case selection.buttonmiddle: mainbuttonmiddle.Update(gameTime); break; case selection.buttondown: mainbuttondown.Update(gameTime); break; case selection.fieldactive: field_active.Update(gameTime); break; case selection.buttonback: buttonback.Update(gameTime); break; case selection.buttoncontinue: buttoncontinue.Update(gameTime); break; } #endregion #region "Navigation of the control" if (currentSelectedMainControl == selection.fieldactive) { if (InputManager.Instance.KeyPressed(Keys.Left) || ScreenManager.Instance.Controllers[0].Left(true)) { if (currentSelectedItemControl == selection.arrow_right) { currentSelectedItemControl = selection.arrow_left; } else if (currentSelectedItemControl == selection.arrow_left) { currentSelectedMainControl = selection.buttonup; } } if (InputManager.Instance.KeyPressed(Keys.Right) || ScreenManager.Instance.Controllers[0].Right(true)) { if (currentSelectedItemControl == selection.arrow_right) { currentSelectedItemControl = selection.arrow_left; } else if (currentSelectedItemControl == selection.arrow_left) { currentSelectedItemControl = selection.arrow_right; } } if (InputManager.Instance.KeyPressed(Keys.Down) || ScreenManager.Instance.Controllers[0].Down(true)) { if (CurrentActiveItem + 1 >= CurrentNumberControlItems) { currentSelectedMainControl = selection.buttoncontinue; CurrentActiveItem = 10; } else { CurrentActiveItem++; //if (currentSelectedItemControl == selection.buttonleft) //currentSelectedItemControl = selection.arrow_left; //if (currentSelectedItemControl == selection.buttonright) //currentSelectedItemControl = selection.arrow_right; } } if (InputManager.Instance.KeyPressed(Keys.Up) || ScreenManager.Instance.Controllers[0].Up(true)) { if (CurrentActiveItem == 10) { CurrentActiveItem = CurrentNumberControlItems - 1; //if (currentSelectedItemControl == selection.buttonleft) //currentSelectedItemControl = selection.arrow_left; //if (currentSelectedItemControl == selection.buttonright) //currentSelectedItemControl = selection.arrow_right; } else if (CurrentActiveItem != 0) { CurrentActiveItem--; } } } else { if (InputManager.Instance.KeyPressed(Keys.Up) || ScreenManager.Instance.Controllers[0].Up(true)) { if (currentSelectedMainControl == selection.buttonmiddle) { currentSelectedMainControl = selection.buttonup; } else if (currentSelectedMainControl == selection.buttondown) { currentSelectedMainControl = selection.buttonup; } else if (currentSelectedMainControl == selection.buttonback) { currentSelectedMainControl = selection.buttondown; } else if (currentSelectedMainControl == selection.buttoncontinue) { currentSelectedMainControl = selection.fieldactive; currentSelectedItemControl = selection.arrow_right; } } if (InputManager.Instance.KeyPressed(Keys.Down) || ScreenManager.Instance.Controllers[0].Down(true)) { if (currentSelectedMainControl == selection.buttonmiddle) { currentSelectedMainControl = selection.buttondown; } else if (currentSelectedMainControl == selection.buttonup) { currentSelectedMainControl = selection.buttondown; } else if (currentSelectedMainControl == selection.buttondown) { currentSelectedMainControl = selection.buttonback; } } if (InputManager.Instance.KeyPressed(Keys.Right) || ScreenManager.Instance.Controllers[0].Right(true)) { if (currentSelectedMainControl == selection.buttondown || currentSelectedMainControl == selection.buttonup) { currentSelectedMainControl = selection.fieldactive; } else if (currentSelectedMainControl == selection.buttonback) { currentSelectedMainControl = selection.buttoncontinue; } } if (InputManager.Instance.KeyPressed(Keys.Left) || ScreenManager.Instance.Controllers[0].Left(true)) { if (currentSelectedMainControl == selection.buttoncontinue) { currentSelectedMainControl = selection.buttonback; } } } #endregion #region "Actions" if (InputManager.Instance.KeyPressed(Keys.Enter) || ScreenManager.Instance.Controllers[0].A_Button(true)) { switch (currentSelectedMainControl) { case selection.buttondown: if (CurrentActiveField == numberControlFields - 1) { CurrentActiveField = 0; } else { CurrentActiveField++; } break; case selection.buttonup: if (CurrentActiveField == 0) { CurrentActiveField = numberControlFields - 1; } else { CurrentActiveField--; } break; case selection.buttonback: ScreenManager.Instance.ChangeScreen("MenuScreen"); break; } } #endregion //mainbuttonup_pressed.Update(gameTime); //mainbuttondown_pressed.Update(gameTime); }
public void Update(GameTime gameTime) { itemtitle.Update(gameTime); itemsetting.Update(gameTime); arrow_left.Update(gameTime); arrow_right.Update(gameTime); arrow_right.Position = new Vector2(tempPosition + ((itemsetting.GetTextSize(itemsetting.Text).X) + (10 * x_scale)), arrow_right.Position.Y); itemtitle.Color = Color.Black; arrow_left.Color = Color.Black; arrow_right.Color = Color.Black; if (IsSelected) { var temp = fadeeffect.Update(gameTime); itemtitle.Alpha = temp; itemsetting.Alpha = temp; arrow_left.Alpha = temp; arrow_right.Alpha = temp; switch (currentSelected) { case selection.arrowleft: arrow_left.Color = Color.White; break; case selection.arrowright: arrow_right.Color = Color.White; break; } if (InputManager.Instance.KeyPressed(Keys.Enter) || ScreenManager.Instance.Controllers[0].A_Button(true)) { if (currentSelected == selection.arrowleft) { currentIndex--; if (currentIndex < 0) { currentIndex = maxIndex - 1; } } if (currentSelected == selection.arrowright) { currentIndex++; if (currentIndex >= maxIndex) { currentIndex = 0; } } } } else { itemtitle.Alpha = 1.0f; itemsetting.Alpha = 1.0f; arrow_left.Alpha = 1.0f; arrow_right.Alpha = 1.0f; itemtitle.Color = Color.Black; arrow_left.Color = Color.Black; arrow_right.Color = Color.Black; } }