private static void DropDown(this AutomationElement element) { element.Clear(); Wait.Sleep(TimeSpan.FromMilliseconds(100)); KeyboardExtensions.PressBackspace(); Wait.Sleep(TimeSpan.FromMilliseconds(500)); }
public static void Clear(this AutomationElement element) { element.SetFocus(); element.ClickCenter(); Wait.Sleep(TimeSpan.FromMilliseconds(100)); KeyboardExtensions.CtrlADel(); }
public override void Update(GameTime gameTime, TeeEngine engine) { Hero player = (Hero)engine.GetEntity("Player"); KeyboardState keyboardState = Keyboard.GetState(); if (KeyboardExtensions.GetKeyDownState(keyboardState, Keys.S, this, true) && Entity.IntersectsWith(this, null, player, "Shadow", gameTime)) { if (CurrentDrawableState != "Open") { Random random = new Random(); CurrentDrawableState = "Open"; Drawables.ResetState("Open", gameTime); for (int i = 0; i < 10; i++) { Coin coin = new Coin(this.Pos.X, this.Pos.Y, 100, (CoinType)random.Next(3)); coin.Pos.X += (float)((random.NextDouble() - 0.5) * 100); coin.Pos.Y += (float)((random.NextDouble() - 0.5) * 100); engine.AddEntity(coin); } } } }
void MapEntrance_MapZoneHit(MapZone sender, Entity entity, TeeEngine engine, GameTime gameTime) { if (KeyboardExtensions.GetKeyDownState(Keyboard.GetState(), ACTIVATE_KEY, engine, true) && entity == engine.GetEntity("Player")) { MapEventArgs mapArgs = new MapEventArgs(); mapArgs.SetProperty("Target", Target); engine.ClearEntities(); engine.LoadMap(Destination, mapArgs); } }
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); }
protected override void Update(GameTime gameTime) { Helper.PrevCursorToSet = Helper.CursorToSet; Helper.CursorToSet = MouseCursor.Arrow; KeyboardExtensions.Update(); overlayScene.Update(gameTime); if (activeScene.GetType() != typeof(LoadingScene)) { simulation.Update(gameTime); } activeScene.Update(gameTime); base.Update(gameTime); }
public void EnterTextNoCheck(string value) { if (value == null) { throw new ArgumentNullException( "String parameter must not be null."); } if (Element == null) { throw new ArgumentNullException( "AutomationElement parameter must not be null"); } if (!Element.Current.IsEnabled) { throw new InvalidOperationException( $"The control with an AutomationID of {AutomationId} is not enabled."); } Element.SetFocus(); Wait.Sleep(TimeSpan.FromMilliseconds(100)); KeyboardExtensions.CtrlADel(); KeyboardExtensions.EnterText(value); }
protected override void Update(GameTime gameTime) { // F1 = Show/Hide Bounding Boxes // F2 = Show/Hide Debug Info // F3 = Enable/Disable LightShader // F4 = Change Current SamplerState // F5 = Show/Hide Tile Grid // F6 = Show/Hide Quad Tree // F7 = Show Performance Diagnostics // F8 = Show Entity Debug Info // F10 = Toggle Fullscreen Mode // F11 = Show/Hide Player Helmet // F12 = Disable Player Collision Detection KeyboardState keyboardState = Keyboard.GetState(); if (KeyboardExtensions.GetKeyDownState(keyboardState, Keys.F1, this, true)) { Engine.DrawingOptions.ShowBoundingBoxes = !Engine.DrawingOptions.ShowBoundingBoxes; } if (KeyboardExtensions.GetKeyDownState(keyboardState, Keys.F2, this, true)) { showDebugInfo = !showDebugInfo; } if (KeyboardExtensions.GetKeyDownState(keyboardState, Keys.F3, this, true)) { LightShader.Enabled = !LightShader.Enabled; } if (KeyboardExtensions.GetKeyDownState(keyboardState, Keys.F4, this, true)) { CurrentSampler = SamplerStates[++SamplerIndex % SamplerStates.Length]; } if (KeyboardExtensions.GetKeyDownState(keyboardState, Keys.F5, this, true)) { Engine.DrawingOptions.ShowTileGrid = !Engine.DrawingOptions.ShowTileGrid; } if (KeyboardExtensions.GetKeyDownState(keyboardState, Keys.F6, this, true)) { Engine.DrawingOptions.ShowColliderDebugInfo = !Engine.DrawingOptions.ShowColliderDebugInfo; } if (KeyboardExtensions.GetKeyDownState(keyboardState, Keys.F7, this, true)) { showDiagnostics = !showDiagnostics; } if (KeyboardExtensions.GetKeyDownState(keyboardState, Keys.F8, this, true)) { Engine.DrawingOptions.ShowEntityDebugInfo = !Engine.DrawingOptions.ShowEntityDebugInfo; } if (KeyboardExtensions.GetKeyDownState(keyboardState, Keys.F10, this, true)) { Engine.DrawingOptions.ShowDrawableComponents = !Engine.DrawingOptions.ShowDrawableComponents; } if (KeyboardExtensions.GetKeyDownState(keyboardState, Keys.F11, this, true)) { helmetVisible = !helmetVisible; //CurrentPlayer.Drawables.SetGroupProperty("Head", "Visible", helmetVisible); if (helmetVisible) { CurrentPlayer.Drawables.SetGroupProperty("Head", "Offset", Vector2.Zero); } else { CurrentPlayer.Drawables.SetGroupProperty("Head", "Offset", new Vector2(0, -40)); } } if (KeyboardExtensions.GetKeyDownState(keyboardState, Keys.F12, this, true)) { CurrentPlayer.CollisionDetection = !CurrentPlayer.CollisionDetection; } // INCREASE ZOOM LEVEL if (KeyboardExtensions.GetKeyDownState(keyboardState, Keys.OemPlus, this, true)) { Zoom += 0.1f; } // DECREASE ZOOM LEVEL if (KeyboardExtensions.GetKeyDownState(keyboardState, Keys.OemMinus, this, true)) { Zoom -= 0.1f; } base.Update(gameTime); }
public override void Update(GameTime gameTime, TeeEngine engine) { KeyboardState keyboardState = Keyboard.GetState(); Vector2 movement = Vector2.Zero; float prevX = Pos.X; float prevY = Pos.Y; Tile prevTile = engine.Map.GetPxTopMostTile(Pos.X, Pos.Y); float moveSpeedModifier = prevTile.GetProperty <float>("MoveSpeed", 1.0f); // ATTACK KEY. if (keyboardState.IsKeyDown(Keys.A)) { bool reset = !CurrentDrawableState.StartsWith("Slash"); CurrentDrawableState = "Slash_" + Direction; if (reset) { Drawables.ResetState(CurrentDrawableState, gameTime); } } else { // MOVEMENT BASED KEYBOARD EVENTS. if (keyboardState.IsKeyDown(Keys.Up)) { CurrentDrawableState = "Walk_Up"; Direction = Direction.Up; movement.Y--; } if (keyboardState.IsKeyDown(Keys.Down)) { CurrentDrawableState = "Walk_Down"; Direction = Direction.Down; movement.Y++; } if (keyboardState.IsKeyDown(Keys.Left)) { CurrentDrawableState = "Walk_Left"; Direction = Direction.Left; movement.X--; } if (keyboardState.IsKeyDown(Keys.Right)) { CurrentDrawableState = "Walk_Right"; Direction = Direction.Right; movement.X++; } if (KeyboardExtensions.GetKeyDownState(keyboardState, Keys.T, this, true)) { if (IsEquiped(ItemRepository.GameItems["RobeShirt"])) { Equip(ItemRepository.GameItems["PlateChest"]); } else { Equip(ItemRepository.GameItems["RobeShirt"]); } } // Set animation to idle of no movements where made. if (movement.Length() == 0) { CurrentDrawableState = "Idle_" + Direction; } else { movement.Normalize(); Pos += movement * MOVEMENT_SPEED * moveSpeedModifier; } LightSource.Pos = this.Pos; } base.Update(gameTime, engine); }