예제 #1
0
        /// <summary>
        /// Update the UINumberBox.
        /// </summary>
        public override void Update()
        {
            if (textBox.Focused)
            {
                if (KeyboardUtils.JustPressed(Keys.Up) || KeyboardUtils.HeldDown(Keys.Up))
                {
                    if (up == 0)
                    {
                        Increase();
                        up = frameDelay;
                    }
                    up--;
                }
                else if (KeyboardUtils.JustPressed(Keys.Down) || KeyboardUtils.HeldDown(Keys.Down))
                {
                    if (down == 0)
                    {
                        Decrease();
                        down = frameDelay;
                    }
                    down--;
                }

                textBox.SelectionStart = textBox.Text.Length;
            }

            base.Update();
        }
예제 #2
0
        private void Movimento()
        {
            BugsBLL.FullCombo();
            if (KeyboardUtils.GetKey("ui_select", Keystatus.Pressed) && personagemDTO.Municao != 0)
            {
                personagemDTO.Municao -= 1;
                ArmaSprite.Atirar(personagemDTO, personagemDTO.SpritePersonagem.FlipH);
            }
            if (KeyboardUtils.GetKey("ui_up", Keystatus.Pressed))
            {
                SingleMonophonicEmiterBLL.Reproduzir(JumpSound);
                BugsBLL.FlyBug = false;
                GravidadeBLL.Pular(personagemDTO);
                BugsBLL.NoCombo();
            }

            personagemDTO.Direcao.x = (Convert.ToInt32(KeyboardUtils.GetKey("ui_right", Keystatus.Hold)) - Convert.ToInt32(KeyboardUtils.GetKey("ui_left", Keystatus.Hold)));
            if (KeyboardUtils.GetKey("ui_right", Keystatus.Pressed) || KeyboardUtils.GetKey("ui_left", Keystatus.Pressed))
            {
                if (!BugsBLL.FlyBug)
                {
                    BugsBLL.Combo += 1;
                }
                Combo.Start(1);
            }

            MovimentoKinematicoBLL.Move2D(personagemDTO);
        }
예제 #3
0
 public override void _PhysicsProcess(float delta)
 {
     if (KeyboardUtils.GetKey("ui_select", Keystatus.Pressed))
     {
         PulaTexto();
     }
 }
예제 #4
0
        private static void SetDirection(int direction)
        {
            switch (direction)
            {
            case Direction.W:
                KeyboardUtils.KeyPress(Keys.A);
                goto case Direction.NW;

            case Direction.NW:
                KeyboardUtils.KeyPress(Keys.A);
                goto case Direction.NE;

            case Direction.NE:
                KeyboardUtils.KeyPress(Keys.A);
                break;

            case Direction.SW:
                KeyboardUtils.KeyPress(Keys.D);
                goto case Direction.SE;

            case Direction.SE:
                KeyboardUtils.KeyPress(Keys.D);
                break;
            }
        }
예제 #5
0
        public void PresssKeyOnElementWith(KeyboardActionType keyName, SelectorPathType selector, string path)
        {
            var elementBy = WebElementUtils.GetElementAsBy(selector, path);
            var element   = _driver.FindElement(elementBy);

            KeyboardUtils.EnterKeyToWebElement(element, keyName);
        }
예제 #6
0
 public void CanGetDisplayText3()
 {
     Assert.AreEqual("ALT+A",
                     KeyboardUtils.GetDisplayText(
                         KeyboardUtils.CreateShortcut(Keys.A, false, false,
                                                      true)));
 }
예제 #7
0
        public void ProcessKeyDown(object args)
        {
            var pv = App.MainPages.View.ActivePanelView;
            var e  = args as KeyEventArgs;

            if (pv == null || e == null)
            {
                return;
            }
            var panelItem = pv.Presenter.GetFocusedPanelItem(true);

            if (panelItem == null)
            {
                return;
            }
            var typeId = panelItem.GetType().Name;

            if (!PanelItems.ContainsKey(typeId))
            {
                return;
            }
            var item     = PanelItems[typeId];
            var shortcut = KeyboardUtils.KeyEventToString(e);

            foreach (var menuItem in item.ContextMenu)
            {
                if (menuItem.ShortcutPresent && menuItem.ShortcutKeys.Equals(shortcut) && menuItem.Enabled)
                {
                    new AddonCommandStarter(menuItem, panelItem).Start();
                    e.Handled = true;
                    break;
                }
            }
        }
예제 #8
0
        public void PasteToElement(SelectorPathType selector, string path)
        {
            var elementBy = WebElementUtils.GetElementAsBy(selector, path);
            var element   = _driver.FindElement(elementBy);

            KeyboardUtils.PasteToWebElement(element);
        }
 public override void _Process(float delta)
 {
     if (KeyboardUtils.GetKey("ui_cancel", Keystatus.Pressed))
     {
         Input.SetMouseMode(Input.MouseMode.Visible);
     }
 }
예제 #10
0
        public void Calibrate()
        {
            sm_log.Info("Calibrating center of hex grid");

            // Drag a glyph of equilibrium onto the center of the grid
            var toolLocation = m_sidebar.ScrollTo(m_sidebar.Glyphs, m_sidebar.Glyphs[GlyphType.Equilibrium]);
            var gridLocation = m_grid.GetScreenLocationForCell(new Vector2(0, 0));

            MouseUtils.LeftDrag(toolLocation, gridLocation);

            // Find where the glyph actually ended up on the screen - this will be the exact center of a hex
            // near the center of the screen.
            var actualCenter = FindGlyph(m_grid.CenterLocation);

            sm_log.Info(Invariant($"Actual hex center is {actualCenter}"));

            // Scroll the grid so this actual center is exactly where we want it
            var desiredCenter = m_grid.Rect.Location.Add(new Point(m_grid.Rect.Width / 2, m_grid.Rect.Height / 2)).Add(CenterOffset);

            MouseUtils.RightDrag(actualCenter, desiredCenter);
            m_grid.CenterLocation = desiredCenter;

            // Delete the glyph from the grid
            KeyboardUtils.KeyPress(Keys.Z);
        }
예제 #11
0
        protected void StartSelectionPhase()
        {
            SketchOutputMode = SelectionSettings.SketchOutputMode;

            // NOTE: CompleteSketchOnMouseUp must be set before the sketch geometry type,
            // otherwise it has no effect!
            CompleteSketchOnMouseUp = true;

            SketchType = SelectionSettings.SketchGeometryType;

            UseSnapping = false;

            GeomIsSimpleAsFeature = false;

            if (KeyboardUtils.IsModifierPressed(Keys.Shift, true))
            {
                SetCursor(SelectionCursorShift);
            }
            else
            {
                SetCursor(SelectionCursor);
            }

            OnSelectionPhaseStarted();
        }
예제 #12
0
        public void SelectAllInElement(SelectorPathType selector, string path)
        {
            var elementBy = WebElementUtils.GetElementAsBy(selector, path);
            var element   = _driver.FindElement(elementBy);

            KeyboardUtils.SelectAllFromWebElement(element);
        }
        public override void Execute(object parameter)
        {
            var  selMolecule = EditViewModel.SelectedItems[0] as Molecule;
            bool flipStereo  = KeyboardUtils.HoldingDownShift();

            EditViewModel.FlipMolecule(selMolecule, false, flipStereo);
        }
예제 #14
0
        protected override bool IsInSelectionPhase()
        {
            if (KeyboardUtils.IsModifierPressed(Keys.Shift, true))
            {
                return(true);
            }

            var task = QueuedTask.Run(
                () =>
            {
                bool result;

                IList <Feature> selection =
                    SelectionUtils.GetSelectedFeatures(ActiveMapView).ToList();

                if (!CanUseSelection(selection))
                {
                    result = true;
                }
                else
                {
                    result = !CanUseDerivedGeometries();
                }

                return(result);
            });

            return(task.Result);
        }
예제 #15
0
파일: TextField.cs 프로젝트: gmich/Gem
        private void ProcessKeyInputs(double deltaTime)
        {
            var pressedKeys = appender.Input.GetPressedKeys();

            bool isShiftPressed = appender.Input.IsKeyPressed(Keys.LeftShift) ||
                                  appender.Input.IsKeyPressed(Keys.RightShift);


            foreach (Keys key in pressedKeys)
            {
                if (!ShouldHandleKey(key, deltaTime))
                {
                    continue;
                }

                char convertedChar;
                if (KeyboardUtils.KeyToString(key, isShiftPressed, out convertedChar))
                {
                    if (!appender.ShouldHandleKey(key, convertedChar))
                    {
                        continue;
                    }
                    InsertChar(convertedChar);
                }
                else
                {
                    switch (key)
                    {
                    case Keys.Back:
                        RemoveChar();
                        break;

                    case Keys.Delete:
                        if (cursorIndex < Text.Value.Length)
                        {
                            char charToRemove = Text.Value[cursorIndex];
                            Text.Value = Text.Value.Remove(cursorIndex, 1);
                            OnTextChangedAggregation(new TextFieldEventArgs(this.Text.Value, charToRemove));
                        }
                        break;

                    case Keys.Left:
                        if (cursorIndex > 0)
                        {
                            cursorIndex--;
                            AlignCursor();
                        }
                        break;

                    case Keys.Right:
                        if (cursorIndex < Text.Value.Length)
                        {
                            cursorIndex++;
                            AlignCursor();
                        }
                        break;
                    }
                }
            }
        }
예제 #16
0
        public void ProcessKeyInput(double deltaTime)
        {
            var pressedKeys = appender.Input.GetPressedKeys();

            bool isShiftPressed = appender.Input.IsKeyPressed(Keys.LeftShift) ||
                                  appender.Input.IsKeyPressed(Keys.RightShift);


            foreach (Keys key in pressedKeys)
            {
                if (!ShouldHandleKey(key, deltaTime))
                {
                    continue;
                }

                char convertedChar;
                if (KeyboardUtils.KeyToString(key, isShiftPressed, out convertedChar))
                {
                    if (!appender.ShouldHandleKey(key, convertedChar))
                    {
                        continue;
                    }
                    KeyPressed.RaiseEvent(this, convertedChar);
                }
                else
                {
                    switch (key)
                    {
                    case Keys.Back:
                        BackSpace.RaiseEvent(this, EventArgs.Empty);
                        break;

                    case Keys.Delete:
                        Delete.RaiseEvent(this, EventArgs.Empty);
                        break;

                    case Keys.Left:
                        Left.RaiseEvent(this, EventArgs.Empty);
                        break;

                    case Keys.Right:
                        Right.RaiseEvent(this, EventArgs.Empty);
                        break;

                    case Keys.Up:
                        Up.RaiseEvent(this, EventArgs.Empty);
                        break;

                    case Keys.Down:
                        Down.RaiseEvent(this, EventArgs.Empty);
                        break;

                    case Keys.Enter:
                        Insert.RaiseEvent(this, EventArgs.Empty);
                        break;
                    }
                }
            }
        }
예제 #17
0
        public void Update(GameTime gameTime)
        {
            if (SimulationGame.IsConsoleOpen)
            {
                KeyboardState state     = Keyboard.GetState();
                bool          shiftDown = state.CapsLock || state.IsKeyDown(Keys.LeftShift) || state.IsKeyDown(Keys.RightShift);

                for (int i = 0; i <= 255; i++)
                {
                    if (state.IsKeyDown((Keys)i))
                    {
                        if (!keysPressed.ContainsKey(i))
                        {
                            if (i == (int)Keys.Back)
                            {
                                if (!keysPressed.ContainsKey((int)Keys.Back))
                                {
                                    if (command.Length > 0)
                                    {
                                        command = command.Remove(command.Length - 1);
                                    }

                                    lastBackKeyPress            = TimeSpan.Zero;
                                    keysPressed[(int)Keys.Back] = true;
                                }
                                else
                                {
                                    lastBackKeyPress += gameTime.ElapsedGameTime;

                                    if (lastBackKeyPress >= TimeSpan.FromMilliseconds(150))
                                    {
                                        keysPressed.Remove((int)Keys.Back);
                                    }
                                }
                            }
                            else if (i == (int)Keys.Enter)
                            {
                                executeCommand();
                            }
                            else
                            {
                                char commandChar;

                                if (KeyboardUtils.KeyToString((Keys)i, shiftDown, out commandChar))
                                {
                                    command += commandChar;
                                }
                            }

                            keysPressed[i] = true;
                        }
                    }
                    else
                    {
                        keysPressed.Remove(i);
                    }
                }
            }
        }
예제 #18
0
 private void ExecuteGesture(Gesture g, bool keyboardEmulation = true)
 {
     if (keyboardEmulation)
     {
         KeyboardUtils.HitKey(g);
     }
     HighlightGestureOnList(g);
 }
예제 #19
0
        private void PlaybackKeyboard(Record record)
        {
            //pipeClient.SendRequest(record);
            //return;
            Keys   key    = record.EventKey.Key;
            string action = record.EventKey.Action;

            KeyboardUtils.PerformKeyEvent(key, action);
        }
예제 #20
0
        private bool CanStartSketchPhase(IList <Feature> selectedFeatures)
        {
            if (KeyboardUtils.IsModifierPressed(Keys.Shift, true))
            {
                return(false);
            }

            return(CanStartSketchPhaseCore(selectedFeatures));
        }
예제 #21
0
        private bool IsRegisterCallback(object sender, HuionKeyEventArgs hotKey)
        {
            bool flag = KeyboardUtils.CheckHotkey(Fixer4Main.MainForm.Handle, hotKey);

            if (sender == this.tvOpenMainForm)
            {
                this.pbOpenMainForm.Visible = !flag;
            }
            return(flag);
        }
예제 #22
0
        protected override void WndProc(ref Message m)
        {
            base.WndProc(ref m);
            switch (m.Msg)
            {
            case 126:
                break;

            case 512:
                TimerSession.userOperation();
                break;

            case 536:
                switch (m.WParam.ToInt32())
                {
                case 4:
                    this.timer3.Stop();
                    ThreadPool.QueueUserWorkItem(new WaitCallback(TabletConfigUtils.closeDevice));
                    break;

                case 7:
                    this.timer3.Start();
                    break;
                }

                MiddleModule.eventPost += new Post(this.MiddleModule_eventPost);
                break;

            case 1044:
                break;

            case 1054:
                if (this.Visible)
                {
                    break;
                }
                this.Show();
                this.WindowState = FormWindowState.Normal;
                break;

            case 1064:
                if (this.Visible)
                {
                    break;
                }
                KeyboardUtils.listenHotKey(this.Handle, new Void(this.KeyboardUtils_showFormEvent),
                                           SettingsUtil.ShowUIShortcut);
                break;

            default:
                Fixer4Main.onDeviceChanged(ref m);
                KeyboardUtils.onHotKey(ref m);
                break;
            }
        }
예제 #23
0
 protected override void OnKeyUpCore(MapViewKeyEventArgs k)
 {
     if (KeyboardUtils.IsModifierPressed(Keys.Shift, true))
     {
         SetCursor(SelectionCursorShift);
     }
     else
     {
         SetCursor(SelectionCursor);
     }
 }
        public override void RightClick(Item item, Player player)
        {
            if (!CanRightClick(item))
            {
                return;
            }

            WingSlotPlayer mp = player.GetModPlayer <WingSlotPlayer>();

            mp.EquipWings(KeyboardUtils.HeldDown(Keys.LeftShift), item);
        }
예제 #25
0
        private static void SetExtension(int extension)
        {
            if (extension > 1)
            {
                KeyboardUtils.KeyPress(Keys.W);

                if (extension > 2)
                {
                    KeyboardUtils.KeyPress(Keys.W);
                }
            }
        }
예제 #26
0
        private Molecule AnalyzeMolecule(Point location)
        {
            // Make sure the molecule is visible in the sidebar
            var screenLocation = m_sidebar.ScrollTo(m_palette, location);

            Molecule molecule;
            bool     edgeChanged;

            using (var captures = new DisposableList <ScreenCapture>())
            {
                var sidebarCapture1 = captures.Add(new ScreenCapture(m_sidebar.Rect));

                // To analyze the molecule, drag it onto the grid. This will expand it to full size and make it much easier to analyze.
                sm_log.Info("Centering grid");
                m_grid.ScrollTo(new Vector2(0, 0));

                sm_log.Info("Dragging molecule onto grid");
                MouseUtils.LeftDrag(screenLocation, m_grid.GetScreenLocationForCell(new Vector2(0, 0)));
                molecule = new MoleculeAnalyzer(m_grid, m_type).Analyze();
                sm_log.Info("Analyzed molecule:" + Environment.NewLine + molecule.ToString());

                var sidebarCapture2 = captures.Add(new ScreenCapture(m_sidebar.Rect));
                edgeChanged = ExcludeChangedPixels(sidebarCapture1, sidebarCapture2);
                sm_log.Info("edgeChanged: " + edgeChanged);
            }

            using (var captures = new DisposableList <ScreenCapture>())
            {
                if (edgeChanged)
                {
                    // A pixel on the bottom edge of the visible part of the sidebar changed, which means
                    // the molecule probably extends onto the next page. So we scroll down and then exclude
                    // any pixels that change there when we delete the molecule.
                    m_sidebar.Area.ScrollBy(new Point(0, m_sidebar.Rect.Height));
                    var sidebarCapture1 = captures.Add(new ScreenCapture(m_sidebar.Rect));

                    // Delete the molecule from the grid
                    KeyboardUtils.KeyPress(Keys.Z);

                    var sidebarCapture2 = captures.Add(new ScreenCapture(m_sidebar.Rect));
                    ExcludeChangedPixels(sidebarCapture1, sidebarCapture2);

                    // Technically the molecule could overlap a third page but we'll ignore that for now.
                }
                else
                {
                    // Delete the molecule from the grid
                    KeyboardUtils.KeyPress(Keys.Z);
                }
            }

            return(molecule);
        }
예제 #27
0
        /// <summary>
        /// Update the UICheckBox.
        /// </summary>
        public override void Update()
        {
            if (Focused)
            {
                if (KeyboardUtils.JustPressed(Keys.Enter))
                {
                    Toggle();
                }
            }

            base.Update();
        }
예제 #28
0
        protected override void OnKeyDownCore(MapViewKeyEventArgs k)
        {
            if (KeyboardUtils.IsModifierPressed(Keys.Shift, true))
            {
                SetCursor(SelectionCursorShift);
            }
            else
            {
                SetCursor(SelectionCursor);
            }

            _msg.VerboseDebug($"Key {k.Key} was pressed.");
        }
예제 #29
0
    public void SetChineseFirstEnteredText()
    {
        string textStr = GetFirstChineseWord();

        textStr = string.IsNullOrEmpty(textStr) ? string.Empty : textStr;
        Text  chineseAlreadyInput = enteredRect.GetComponentInChildren <Text>();
        float sizeY = enteredRect.sizeDelta.y;
        float sizeX = KeyboardUtils.CaculateTextLength(textStr, enteredRect.GetComponentInChildren <Text>());

        enteredRect.sizeDelta = new Vector2(sizeX + 160, sizeY);
        LayoutRebuilder.ForceRebuildLayoutImmediate(enteredRect);
        chineseAlreadyInput.text = textStr;
    }
예제 #30
0
        protected override void OnKeyDown(KeyEventArgs e)
        {
            e.Handled          = true;
            e.SuppressKeyPress = true;

            if (e.KeyData == Keys.Delete || e.KeyData == Keys.Back)
            {
                Shortcut = null;
            }
            else if (KeyboardUtils.IsValidShortcutKey(e.KeyCode))
            {
                Shortcut = KeyboardUtils.CreateShortcut(e);
            }
        }