public override void Update(BaseScene scene, GameTime gameTime) { if (!Visible) { return; } buttonAccept.Update(scene, gameTime); buttonCancel.Update(scene, gameTime); base.Update(scene, gameTime); }
public override void Update(BaseScene scene, GameTime gameTime) { this.Size = new Vector2(250, 300) * scene.GetRDMultiplier(); textBoxHeight = 50 * scene.GetRDMultiplier(); confirmButton.Position = new Vector2(this.Position.X + 1, this.Position.Y + this.Size.Y - confirmButton.Size.Y - (10 * scene.GetRDMultiplier())); confirmButton.Disabled = selectedEmployee == null; confirmButton.Update(scene, gameTime); var mouseState = Mouse.GetState(); if (!Disabled && this.State == WidgetState.MouseDown) { selected = true; } if (mouseState.NotHovering(this) && mouseState.LeftButton == ButtonState.Pressed) { selected = false; } if (selected) { var keys = Keyboard.GetState().GetPressedKeys(); foreach (var key in keys) { if (key == Keys.Back && KeyboardExtensions.IsKeyPressed(Keys.Back)) { if (text.Length != 0) { text = text.Remove(text.Length - 1, 1); } } if (text.Length >= 7) { continue; } else if (KeyboardExtensions.IsKeyDown(Keys.LeftShift) && key == Keys.D3 && KeyboardExtensions.IsKeyPressed(Keys.D3)) { text += "#"; } else if (key >= Keys.D0 && key <= Keys.D9 && KeyboardExtensions.IsKeyPressed(key)) { text += (char)key; } selectedEmployee = WorldState.GetEmployeeById(text); } } base.Update(scene, gameTime); }