public override void Update(UpdateEventArgs e) { if (this.isSelected) { List <Key> keyValues = InputManager.Keys.GetHitKeys(); this.EnterPressed = MenuItemTextbox.ManipulateString(keyValues, this.value, ref this.CursorPosition, InputManager.Keys.Down(Key.ShiftLeft) || InputManager.Keys.Down(Key.ShiftRight)); } base.Update(e); }
public FindGamesScreen(ScreenManager sM, BackgroundLevel bgLevel = null) : base(sM) { // Some settings if (bgLevel == null) { this.bgLevel = new BackgroundLevel(this.screenManager); } else { this.bgLevel = bgLevel; } this.errorMessages = ""; this.MenuSize = this.screenManager.ScreenResolution - 150 * Vector2.UnitX; this.PositionMenuScreen(MenuItem.HorizontalAlign.Center, MenuItem.VerticalAlign.Top); this.FavMenuItem.TextAlign = MenuItem.HorizontalAlign.Left; // IP and port this.miIP = new MenuItemTextbox("IP adress", this.screenManager.Graphics, 15); this.AddMenuItem(miIP); this.miPort = new MenuItemTextbox("Port", this.screenManager.Graphics, 7); this.AddMenuItem(miPort); // Create, join and back buttons MenuItem miCreate = new MenuItem("Create game", sM.Graphics); miCreate.OnClick += (o, e) => { this.Create(); }; this.AddMenuItem(miCreate); MenuItem miJoin = new MenuItem("Join game", sM.Graphics); miJoin.OnClick += (o, e) => { this.Join(); }; this.AddMenuItem(miJoin); this.miBack = new MenuItem("Back", sM.Graphics); this.miBack.OnClick += (o, e) => { this.Remove(); }; this.AddMenuItem(this.miBack); // Colour and position the menus this.FastLayout(this.FavMenuItem); miCreate.Size = new Vector2(290, miCreate.Size.Y); miJoin.Size = miCreate.Size; miBack.Size = miCreate.Size; miBack.TextAlign = MenuItem.HorizontalAlign.Right; this.miIP.Size += new Vector2(170, 0); this.positionMenuItems(miCreate, miJoin); // Load the values this.Load(); }
public OptionsScreen(ScreenManager sM, BackgroundLevel bgLevel = null) : base(sM) { // Some settings if (bgLevel == null) { this.bgLevel = new BackgroundLevel(this.screenManager); } else { this.bgLevel = bgLevel; } this.errorMessages = ""; this.MenuSize = this.screenManager.ScreenResolution - 150 * Vector2.UnitX; this.PositionMenuScreen(MenuItem.HorizontalAlign.Center, MenuItem.VerticalAlign.Top); this.FavMenuItem.TextAlign = MenuItem.HorizontalAlign.Left; // The options this.miName = new MenuItemTextbox("Name", this.screenManager.Graphics); this.AddMenuItem(miName); this.miGhostSpeed = new MenuItemYesNo("Fast ghosts", this.screenManager.Graphics); this.AddMenuItem(miGhostSpeed); // Save and back buttons MenuItem miSave = new MenuItem("Save", sM.Graphics); miSave.OnClick += (o, e) => { this.Save(); }; this.AddMenuItem(miSave); this.miBack = new MenuItem("Back", sM.Graphics); this.miBack.OnClick += (o, e) => { this.Remove(); }; this.AddMenuItem(this.miBack); // Colour the menus (and position them) this.FastLayout(this.FavMenuItem); miBack.TextAlign = MenuItem.HorizontalAlign.Right; // Position the menus (override previous positioning) this.positionMenuItems(miSave); // Load the values this.Load(); }