コード例 #1
0
ファイル: IInputCallbacker.cs プロジェクト: Jntz/jamipeli
 public KeyboardInputCallbacker(Keys key, InputEventArgs args,
     List<KeyboardInputCallback> callbacks)
 {
     this.key = key;
     this.args = args;
     this.callbacks = callbacks;
 }
コード例 #2
0
ファイル: SubGraphHandle.cs プロジェクト: JBTech/Dot.Utility
 public override bool OnSingleClick(InputEventArgs evt, DiagramView view)
 {
     SubGraphNode graph1 = base.Parent as SubGraphNode;
     if ((graph1 == null) || !graph1.Collapsible)
     {
         return false;
     }
     if (view != null)
     {
         view.StartTransaction();
     }
     string text1 = null;
     if (graph1.IsExpanded)
     {
         graph1.Collapse();
         text1 = "Collapsed SubGraph";
     }
     else if (evt.Control)
     {
         graph1.ExpandAll();
         text1 = "Expanded All SubGraphs";
     }
     else
     {
         graph1.Expand();
         text1 = "Expanded SubGraph";
     }
     if (view != null)
     {
         view.FinishTransaction(text1);
     }
     return true;
 }
コード例 #3
0
ファイル: Input.cs プロジェクト: bigbadrat/XnaGame
        public override void Update(GameTime gameTime)
        {
            base.Update(gameTime);
            input.Update();

            PlayerIndex aux;
            bool shoot = false;
            bool switchweapon = false;
            int x = 0, y = 0;
            if (input.IsKeyPressed(Keys.Left, null, out aux))
                x--;
            if (input.IsKeyPressed(Keys.Right, null, out aux))
                x++;
            if (input.IsKeyPressed(Keys.Up, null, out aux))
                y--;
            if (input.IsKeyPressed(Keys.Down, null, out aux))
                y++;
            if (input.IsNewKeyPress(Keys.Space, null, out aux))
                shoot = true;
            if (input.IsNewKeyPress(Keys.LeftControl, null, out aux))
                switchweapon = true;
            if ( x != 0 || y != 0 || shoot || switchweapon)
                if (InputEvent != null)
                {
                    InputEventArgs args = new InputEventArgs();
                    args.x = x;
                    args.y = y;
                    args.shoot = shoot;
                    args.switchWeapon = switchweapon;
                    args.elapsedTime = (float) gameTime.ElapsedGameTime.TotalSeconds;
                    InputEvent(args);
                }
        }
コード例 #4
0
ファイル: LinkLabel.cs プロジェクト: Jntz/jamipeli
        private void OnSelectedImpl(InputEventArgs args)
        {
            if (args.State != InputState.Released) return;
            if (!HasFocus) return;

            FireSelectedEvent(null);
        }
コード例 #5
0
        /// <summary>
        /// Triggered when the user presses a key or mouse button.
        /// </summary>
        public override bool OnInputActivated(InputEventArgs args)
        {
            // Switch to the main mode
            GameModeManager.Set(new MainMenuGameMode());

            // We are done processing modes
            return false;
        }
コード例 #6
0
ファイル: DiagramTool.cs プロジェクト: JBTech/Dot.Utility
 public virtual bool DoClick(InputEventArgs evt)
 {
     if (evt.DoubleClick)
     {
         return this.View.DoDoubleClick(evt);
     }
     return this.View.DoSingleClick(evt);
 }
コード例 #7
0
        internal void HandleInput()
        {
            while (true)
            {
                while (!Console.KeyAvailable) ;

                var key = Console.ReadKey(true);
                var eargs = new InputEventArgs(key);
                InputRead(this, eargs);
            }
        }
コード例 #8
0
        /// <summary>
        /// Triggered when the user presses a key or mouse button.
        /// </summary>
        public override bool OnInputActivated(InputEventArgs args)
        {
            // Figure out what to do
            switch (args.Token)
            {
                case InputTokens.Escape: // Quit
                    BooGame.Core.Exit();
                    return false;
            }

            GameModeManager.Set(new NewGameMode());
            return true;
        }
コード例 #9
0
ファイル: DiagramOverview.cs プロジェクト: JBTech/Dot.Utility
 public override bool DoMouseOver(InputEventArgs evt)
 {
     if ((this.OverviewRect != null) && this.OverviewRect.ContainsPoint(evt.DocPoint))
     {
         this.Cursor = Cursors.SizeAll;
     }
     else
     {
         this.Cursor = this.DefaultCursor;
     }
     Shapes.DiagramShape obj1 = this.Document.PickObject(evt.DocPoint, false);
     this.DoToolTipObject(obj1);
     return true;
 }
コード例 #10
0
        /// <summary>
        /// Triggered when the user presses a key or mouse button.
        /// </summary>
        public override bool OnInputActivated(InputEventArgs args)
        {
            // Make some noise
            //Log.Debug("OnInputActivated: {0}", args.Token);

            // Figure out what to do
            switch (args.Token)
            {
                case InputTokens.Escape: // Quit
                    GameModeManager.Push(new MainMenuGameMode());
                    break;
            }

            // Allow it to keep passing it on
            return true;
        }
コード例 #11
0
ファイル: ToolContext.cs プロジェクト: JBTech/Dot.Utility
 public override void DoSelect(InputEventArgs evt)
 {
     if ((this.SingleSelection || evt.Control) || evt.Shift)
     {
         base.DoSelect(evt);
     }
     else
     {
         base.CurrentObject = base.View.PickObject(true, false, evt.DocPoint, true);
         if (base.CurrentObject == null)
         {
             base.Selection.Clear();
         }
         else if (!base.Selection.Contains(base.CurrentObject))
         {
             base.Selection.Select(base.CurrentObject);
         }
     }
 }
コード例 #12
0
    public override void handleInput(object sender, InputEventArgs e)
    {
        input = e.input;
        switch (input)
        {
            case "w"://jump
                Person_ctrl.SetMoveState(2);
                Person_ctrl.GetNowMoveState().Start();

                break;
            case "a":

                break;
            case "s":

            case "d":

                   Person_ctrl.SetMoveState(1);
                    Person_ctrl.GetNowMoveState().Start();
                break;
        }
    }
コード例 #13
0
ファイル: DiagramTool.cs プロジェクト: JBTech/Dot.Utility
 public virtual void DoSelect(InputEventArgs evt)
 {
     this.CurrentObject = this.View.PickObject(true, false, evt.DocPoint, true);
     if (this.CurrentObject != null)
     {
         if (evt.Control)
         {
             this.Selection.Toggle(this.CurrentObject);
         }
         else if (evt.Shift)
         {
             this.Selection.Add(this.CurrentObject);
         }
         else
         {
             this.Selection.Select(this.CurrentObject);
         }
     }
     else if (!evt.Control && !evt.Shift)
     {
         this.Selection.Clear();
     }
 }
コード例 #14
0
ファイル: Program.cs プロジェクト: dmoonfire/boogame-cil
        /// <summary>
        /// Called when an input is deactivated (keyboard released).
        /// </summary>
        /// <param name="sender">The sender.</param>
        /// <param name="args">The <see cref="MfGames.Input.InputEventArgs"/> instance containing the event data.</param>
        private static void OnInputDeactivated(object sender, InputEventArgs args)
        {
            if (args.Token == InputTokens.Comma)
            {
                modeIndex--;

                if (modeIndex < 0)
                    modeIndex = modes.Count - 1;

                modeIndex = modeIndex % modes.Count;
                game.Modes.Set(modes[modeIndex]);
            }
            else if (args.Token == InputTokens.Period)
            {
                modeIndex++;

                if (modeIndex >= modes.Count)
                    modeIndex = 0;

                modeIndex = modeIndex % modes.Count;
                game.Modes.Set(modes[modeIndex]);
            }
        }
コード例 #15
0
    public override void handleInput(object sender, InputEventArgs e)
    {
        input = e.input;
        switch (input)
        {
            case "j":
                if (chargeTime > MaxTime - 0.1f)
                {
        
                    Person_ctrl.GetActState(1).Start();

                }
                break;
            case "i":
                if (chargeTime > MaxTime - 0.8f)
                {
                    Person_ctrl.SetActState(2);
                    Person_ctrl.GetNowActState().Start();

                }
                break;
        }
        
    }
コード例 #16
0
ファイル: DiagramText.cs プロジェクト: JBTech/Dot.Utility
 public override bool OnSingleClick(InputEventArgs evt, DiagramView view)
 {
     if (!this.CanEdit())
     {
         return false;
     }
     if (!view.CanEditObjects())
     {
         return false;
     }
     if (evt.Shift || evt.Control)
     {
         return false;
     }
     this.DoBeginEdit(view);
     return true;
 }
コード例 #17
0
ファイル: Hero.cs プロジェクト: wolf96/Game-Pattern-Unity3d
    void Start()
    {
        personCtrl = this.GetComponent<HeroCtrl>();
        heroStateActVer = new IdleStateActVer(this.gameObject);
        heroStateMoveVer = new IdleStateMoveVer(this.gameObject);
        inputArgs = new InputEventArgs("", "", "");
        hero_act_state[0] = new IdleStateActVer(this.gameObject);
        hero_act_state[1] = new ActState(this.gameObject);
        hero_act_state[2] = new DefenseState(this.gameObject);

        hero_move_state[0] = new IdleStateMoveVer(this.gameObject);
        hero_move_state[1] = new MoveState(this.gameObject);
        hero_move_state[2] = new JumpState(this.gameObject);

        InputTran += new InputEventHandler(heroStateActVer.handleInput);
        InputTran += new InputEventHandler(heroStateMoveVer.handleInput);
    }
コード例 #18
0
ファイル: HandleGraph.cs プロジェクト: JBTech/Dot.Utility
 public override bool OnMouseOver(InputEventArgs evt, DiagramView view)
 {
     DiagramShape obj1 = this.HandledObject;
     if (((obj1 == null) || !view.CanResizeObjects()) || (!obj1.CanResize() && !obj1.CanReshape()))
     {
         return false;
     }
     System.Windows.Forms.Cursor cursor1 = this.Cursor;
     if (cursor1 == null)
     {
         cursor1 = this.GetCursorForHandle(this.HandleID);
     }
     if (cursor1 == null)
     {
         return false;
     }
     if (view.Cursor != cursor1)
     {
         view.Cursor = cursor1;
     }
     return true;
 }
コード例 #19
0
ファイル: SimpleUI.cs プロジェクト: tommyettinger/AgateDemo
 public static bool OnKeyDown_Menu(InputEventArgs e)
 {
     if (isHidden)
     {
         return false;
     }
     else
     {
         if ((e.KeyCode == KeyCode.Up || (Demo.hjkl && e.KeyCode == KeyCode.K)) && currentUI.currentScreen.menu.Count > 1 && currentUI.currentScreen.currentMenuItem > 0)
             currentUI.currentScreen.currentMenuItem--;
         else if ((e.KeyCode == KeyCode.Down || (Demo.hjkl && e.KeyCode == KeyCode.J)) && currentUI.currentScreen.menu.Count > 1 && currentUI.currentScreen.currentMenuItem < currentUI.currentScreen.menu.Count - 1)
             currentUI.currentScreen.currentMenuItem++;
         else if (e.KeyCode == confirmKey && currentUI.currentScreen.menu[currentUI.currentScreen.currentMenuItem].enabled &&
                  (currentUI.currentScreen.menu[currentUI.currentScreen.currentMenuItem].linksTo != null ||
                   currentUI.currentScreen.menu[currentUI.currentScreen.currentMenuItem].eventLink != null
                || currentUI.currentScreen.menu[currentUI.currentScreen.currentMenuItem].actionLink != null))
         {
             menuItemForFinish = currentUI.currentScreen.menu[currentUI.currentScreen.currentMenuItem];
             menuItemsForRecall.Add(currentUI.currentScreen.menu[currentUI.currentScreen.currentMenuItem]);
             currentUI.currentScreen.menu[currentUI.currentScreen.currentMenuItem].enabled = false;
             currentUI.currentScreen.menu[currentUI.currentScreen.currentMenuItem].handleAction(e);
         }
         else if (e.KeyCode == backKey && currentUI.currentScreen.previousScreen != null && currentUI.currentScreen != currentUI.initialScreen)
         {
             currentUI.currentScreen.menu[currentUI.currentScreen.currentMenuItem].enabled = true;
             NavigateBackward(currentUI.currentScreen);
             HandleRecall();
         }
         return false;
     }
 }
コード例 #20
0
 public void OnInputEvent(object sender, InputEventArgs e)
 {
     InputEvent?.Invoke(sender, e);
 }
コード例 #21
0
        public void checkUpdate()
        {
            //Get the updates for keyboard
            KeyboardState newState_kb = Keyboard.GetState();

            if (newState_kb.GetPressedKeys() != prevState_kb.GetPressedKeys())
            {
                List <Keys> Pressed   = new List <Keys>();
                List <Keys> UnPressed = new List <Keys>();
                foreach (Keys k in keys)
                {
                    bool prevPressed = prevState_kb.IsKeyDown(k);
                    bool nowPressed  = newState_kb.IsKeyDown(k);
                    if (nowPressed == true && prevPressed == false)
                    {
                        keyPressedState[k] = true;
                        Pressed.Add(k);
                    }
                    else if (nowPressed == false && prevPressed == true)
                    {
                        keyPressedState[k] = false;
                        UnPressed.Add(k);
                    }
                    InputEventArgs e = new InputEventArgs(Pressed, UnPressed, keyPressedState);
                    OnInput(e);
                }
                prevState_kb = newState_kb;
            }

            MouseState newState_m = Mouse.GetState();

            if (newState_m.LeftButton != prevState_m.LeftButton || newState_m.RightButton != prevState_m.RightButton)
            {
                List <string> justClicked   = new List <string>();
                List <string> justUnClicked = new List <string>();
                Point         clickLocation = Mouse.GetState().Position;
                if (prevState_m.Position != clickLocation)
                {
                    InputEventArgs eMouseMoved = new InputEventArgs(clickLocation);
                    OnMouseMoveM(eMouseMoved);
                }
                foreach (string b in mouseButtonState.Keys)
                {
                    if (b == "Left Click")
                    {
                        //They just left clicked
                        if (prevState_m.LeftButton == ButtonState.Released && newState_m.LeftButton == ButtonState.Pressed)
                        {
                            justClicked.Add("Left Click");
                        }
                        //They just un-leftclicked
                        if (prevState_m.LeftButton == ButtonState.Pressed && newState_m.LeftButton == ButtonState.Released)
                        {
                            justUnClicked.Add("Left Click");
                        }
                    }
                    if (b == "Right Click")
                    {
                        //They just left clicked
                        if (prevState_m.RightButton == ButtonState.Released && newState_m.RightButton == ButtonState.Pressed)
                        {
                            justClicked.Add("Right Click");
                        }
                        //They just un-leftclicked
                        if (prevState_m.RightButton == ButtonState.Pressed && newState_m.RightButton == ButtonState.Released)
                        {
                            justUnClicked.Add("Right Click");
                        }
                    }
                }
                InputEventArgs e = new InputEventArgs(clickLocation, justClicked, justUnClicked);

                if (justClicked.Count > 0)
                {
                    OnClickM(e);
                }
                if (justUnClicked.Count > 0)
                {
                    OnUnclickM(e);
                }
                prevState_m = newState_m;
            }
        }
コード例 #22
0
        /// <summary>
        ///   Determines whether this <see cref="System.Windows.Input.KeyGesture" /> matches the input associated with the specified <see
        ///    cref="System.Windows.Input.InputEventArgs" /> object.
        /// </summary>
        /// <param name="targetElement"> The target. </param>
        /// <param name="inputEventArgs"> The input event data to compare this gesture to. </param>
        /// <returns> true if the event data matches this <see cref="System.Windows.Input.KeyGesture" /> ; otherwise, false. </returns>
        public override bool Matches(object targetElement, InputEventArgs inputEventArgs)
        {
            var args = inputEventArgs as KeyEventArgs;

            if (args == null || args.IsRepeat)
            {
                return(false);
            }

            var key = args.Key != Key.System ? args.Key : args.SystemKey;

            //Check if the key identifies a gesture key...
            if (!IsDefinedKey(key))
            {
                return(false);
            }

            var currentSequence = keySequences[currentSequenceIndex];
            var currentKey      = currentSequence.Keys[currentKeyIndex];

            //Check if the key is a modifier...
            if (IsModifierKey(key))
            {
                //If the pressed key is a modifier, ignore it for now, since it is tested afterwards...
                return(false);
            }

            //Check if the current key press happened too late...
            if (currentSequenceIndex != 0 && ((DateTime.Now - lastKeyPress) > maximumDelay))
            {
                //The delay has expired, abort the match...
                ResetState();
#if DEBUG_MESSAGES
                System.Diagnostics.Debug.WriteLine("Maximum delay has elapsed", "[" + MultiKeyGestureConverter.Default.ConvertToString(this) + "]");
#endif
                return(false);
            }

            //Check if current modifiers match required ones...
            if (currentSequence.Modifiers != args.KeyboardDevice.Modifiers)
            {
                //The modifiers are not the expected ones, abort the match...
                ResetState();
#if DEBUG_MESSAGES
                System.Diagnostics.Debug.WriteLine("Incorrect modifier " + args.KeyboardDevice.Modifiers + ", expecting " + currentSequence.Modifiers, "[" + MultiKeyGestureConverter.Default.ConvertToString(this) + "]");
#endif
                return(false);
            }

            //Check if the current key is not correct...
            if (currentKey != key)
            {
                //The current key is not correct, abort the match...
                ResetState();
#if DEBUG_MESSAGES
                System.Diagnostics.Debug.WriteLine("Incorrect key " + key + ", expecting " + currentKey, "[" + MultiKeyGestureConverter.Default.ConvertToString(this) + "]");
#endif
                return(false);
            }

            //Move on the index, pointing to the next key...
            currentKeyIndex++;

            //Check if the key is the last of the current sequence...
            if (currentKeyIndex == keySequences[currentSequenceIndex].Keys.Length)
            {
                //The key is the last of the current sequence, go to the next sequence...
                currentSequenceIndex++;
                currentKeyIndex = 0;
            }

            //Check if the sequence is the last one of the gesture...
            if (currentSequenceIndex != keySequences.Length)
            {
                //If the key is not the last one, get the current date time, handle the match event but do nothing...
                lastKeyPress           = DateTime.Now;
                inputEventArgs.Handled = true;
#if DEBUG_MESSAGES
                System.Diagnostics.Debug.WriteLine("Waiting for " + (m_KeySequences.Length - m_CurrentSequenceIndex) + " sequences", "[" + MultiKeyGestureConverter.Default.ConvertToString(this) + "]");
#endif
                return(false);
            }

            //The gesture has finished and was correct, complete the match operation...
            ResetState();
            inputEventArgs.Handled = true;
#if DEBUG_MESSAGES
            System.Diagnostics.Debug.WriteLine("Gesture completed " + MultiKeyGestureConverter.Default.ConvertToString(this), "[" + MultiKeyGestureConverter.Default.ConvertToString(this) + "]");
#endif
            return(true);
        }
コード例 #23
0
 public void OnScroll(InputEventArgs args)
 {
     zoom = global::System.Math.Min((float)global::System.Math.Max(args.ScrollValue > 0 ? zoom - 0.1f : zoom + 0.1f, 0.1f), 1.5f);
 }
コード例 #24
0
 public void ProcessInputEvent(InputEventArgs e)
 {
 }
コード例 #25
0
 protected override void OnEnded(object sender, InputEventArgs e)
 {
     this.gestureStarted = false;
     base.OnEnded(sender, e);
 }
コード例 #26
0
 private void OnMouseReleased(object sender, InputEventArgs args)
 {
     _isSlowingDown = false;
 }
コード例 #27
0
 private void OnHeld(object sender, InputEventArgs args)
 {
     SlowDown();
 }
コード例 #28
0
 private void SetHandled(InputEventArgs e, bool handled)
 {
     e.Handled = handled;
 }
コード例 #29
0
ファイル: DiagramOverview.cs プロジェクト: JBTech/Dot.Utility
 protected override void OnBackgroundSingleClicked(InputEventArgs evt)
 {
     base.OnBackgroundSingleClicked(evt);
     if (this.OverviewRect != null)
     {
         RectangleF ef1 = this.OverviewRect.Bounds;
         PointF tf1 = new PointF(evt.DocPoint.X - (ef1.Width / 2f), evt.DocPoint.Y - (ef1.Height / 2f));
         this.OverviewRect.Location = this.OverviewRect.ComputeMove(this.OverviewRect.Location, tf1);
     }
 }
コード例 #30
0
        private SKTouchAction GetTouchAction(SKTouchAction touchActionType, FrameworkElement view, InputEventArgs evt)
        {
            if (evt is TouchEventArgs touchEvent)
            {
                var action = touchEvent.GetTouchPoint(view).Action;
                switch (action)
                {
                case TouchAction.Down:
                    touchActionType = SKTouchAction.Pressed;
                    break;

                case TouchAction.Move:
                    touchActionType = SKTouchAction.Moved;
                    break;

                case TouchAction.Up:
                    touchActionType = SKTouchAction.Released;
                    break;
                }
            }

            return(touchActionType);
        }
コード例 #31
0
        /// <summary>
        /// Initializes a new instance of the DragInfo class.
        /// </summary>
        ///
        /// <param name="sender">
        /// The sender of the mouse event that initiated the drag.
        /// </param>
        ///
        /// <param name="e">
        /// The mouse event that initiated the drag.
        /// </param>
        public DragInfo(object sender, InputEventArgs e)
        {
            this.DragStartPosition = e.GetPosition((IInputElement)sender);
            this.Effects           = DragDropEffects.None;
            //this.MouseButton = e.ChangedButton;
            this.VisualSource         = sender as UIElement;
            this.DragDropCopyKeyState = DragDrop.GetDragDropCopyKeyState(this.VisualSource);

            if (sender is ItemsControl)
            {
                var itemsControl = (ItemsControl)sender;

                this.SourceGroup = itemsControl.FindGroup(this.DragStartPosition);
                this.VisualSourceFlowDirection = itemsControl.GetItemsPanelFlowDirection();

                var sourceItem = e.OriginalSource as UIElement; // If we can't cast object as a UIElement it might be a FrameworkContentElement, if so try and use its parent.
                if (sourceItem == null && e.OriginalSource is FrameworkContentElement)
                {
                    sourceItem = ((FrameworkContentElement)e.OriginalSource).Parent as UIElement;
                }
                UIElement item = null;
                if (sourceItem != null)
                {
                    item = itemsControl.GetItemContainer(sourceItem);
                }

                if (item == null)
                {
                    if (DragDrop.GetDragDirectlySelectedOnly(VisualSource))
                    {
                        item = itemsControl.GetItemContainerAt(e.GetPosition(itemsControl));
                    }
                    else
                    {
                        item = itemsControl.GetItemContainerAt(e.GetPosition(itemsControl), itemsControl.GetItemsPanelOrientation());
                    }
                }

                if (item != null)
                {
                    // Remember the relative position of the item being dragged
                    this.PositionInDraggedItem = e.GetPosition(item);

                    var itemParent = ItemsControl.ItemsControlFromItemContainer(item);

                    if (itemParent != null)
                    {
                        this.SourceCollection = itemParent.ItemsSource ?? itemParent.Items;
                        if (itemParent != itemsControl)
                        {
                            var tvItem = item as TreeViewItem;
                            if (tvItem != null)
                            {
                                var tv = tvItem.GetVisualAncestor <TreeView>();
                                if (tv != null && tv != itemsControl && !tv.IsDragSource())
                                {
                                    return;
                                }
                            }
                            else if (itemsControl.ItemContainerGenerator.IndexFromContainer(itemParent) < 0 && !itemParent.IsDragSource())
                            {
                                return;
                            }
                        }
                        this.SourceIndex = itemParent.ItemContainerGenerator.IndexFromContainer(item);
                        this.SourceItem  = itemParent.ItemContainerGenerator.ItemFromContainer(item);
                    }
                    else
                    {
                        this.SourceIndex = -1;
                    }
                    this.SourceItems = itemsControl.GetSelectedItems();

                    // Some controls (I'm looking at you TreeView!) haven't updated their
                    // SelectedItem by this point. Check to see if there 1 or less item in
                    // the SourceItems collection, and if so, override the control's
                    // SelectedItems with the clicked item.
                    if (this.SourceItems.Cast <object>().Count() <= 1)
                    {
                        this.SourceItems = Enumerable.Repeat(this.SourceItem, 1);
                    }

                    this.VisualSourceItem = item;
                }
                else
                {
                    this.SourceCollection = itemsControl.ItemsSource ?? itemsControl.Items;
                }
            }
            else
            {
                if (sender is UIElement)
                {
                    this.PositionInDraggedItem = e.GetPosition((UIElement)sender);
                }
            }

            if (this.SourceItems == null)
            {
                this.SourceItems = Enumerable.Empty <object>();
            }
        }
コード例 #32
0
ファイル: Element3D.cs プロジェクト: zhaoyipeng/helix-toolkit
 public Mouse3DEventArgs(RoutedEvent routedEvent, object source, HitTestResult hitTestResult, Point position, Viewport3DX viewport = null, InputEventArgs originalInputEventArgs = null)
     : base(routedEvent, source)
 {
     this.HitTestResult          = hitTestResult;
     this.Position               = position;
     this.Viewport               = viewport;
     this.OriginalInputEventArgs = originalInputEventArgs;
 }
コード例 #33
0
 private System.Int64 GetTimestamp(InputEventArgs e)
 {
     return(-1);
 }
コード例 #34
0
 public bool ProcessInput(InputEventArgs input)
 {
     throw new NotImplementedException();
 }
コード例 #35
0
 public virtual void handleInput(object sender, InputEventArgs e)
 {
 }
コード例 #36
0
 public virtual void ActionStarted(InputEventArgs action)
 {
 }
コード例 #37
0
ファイル: GameConsole.cs プロジェクト: ckx/gameconsole_xna
        private void ReceiveCommandInput(char inputChar)
        {
            if (IsOpen && _inputEnabled) {
                if (inputChar == '\r') {
                    if (InputEntered != null) {
                        InputEventArgs inputEventArgs = new InputEventArgs(_input);
                        InputEntered(this, inputEventArgs);
                        if (inputEventArgs.Execute) {
                            Execute(_input, inputEventArgs.AddToLog);
                        }
                    }
                    else {
                        Execute(_input);
                    }

                    _input = "";
                    _cursorPosition = 0;

                    if (InputChanged != null) {
                        InputChanged(this, new InputEventArgs(_input));
                    }
                }
                else if (inputChar == '\b' && _cursorPosition > 0) {
                    _input = _input.Remove(--_cursorPosition, 1);

                    if (InputChanged != null) {
                        InputChanged(this, new InputEventArgs(_input));
                    }
                }
                else if (inputChar == '\t') // AutoComplete extension code
                {
                    IEnumerable<string> autoCollection = from c in _commands.Keys
                        where c.StartsWith(_input)
                        orderby c
                        select c;

                    if (autoCollection.Count() != 0) {
                        _cursorPosition +=
                            autoCollection.FirstOrDefault()
                                .Zip(autoCollection.LastOrDefault(), (c1, c2) => c1 == c2)
                                .TakeWhile(b => b)
                                .Count() - _input.Length;
                        int index =
                            autoCollection.FirstOrDefault()
                                .Zip(autoCollection.LastOrDefault(), (c1, c2) => c1 == c2)
                                .TakeWhile(b => b)
                                .Count();
                        _input = autoCollection.FirstOrDefault().Substring(0, index);
                        if (autoCollection.Count() > 1) {
                            if (!_mashTab) {
                                _mashTab = true;
                                Log(Prefix + _input);
                                foreach (string s in autoCollection) {
                                    Log(" -> " + s);
                                }
                            }
                            else if (_mashTab) {
                                if (_input == autoCollection.ElementAt(0)) {
                                    _cursorPosition += autoCollection.ElementAt(1).Length -
                                                      _input.Length;
                                    _input = autoCollection.ElementAt(1);
                                }
                                else {
                                    _cursorPosition += autoCollection.ElementAt(0).Length -
                                                      _input.Length;
                                    _input = autoCollection.ElementAt(0);
                                }
                            }
                        }
                    }
                }
                else {
                    _mashTab = false;
                }
            }
        }
コード例 #38
0
 public virtual void ActionEnded(InputEventArgs action)
 {
 }
コード例 #39
0
 private void MediaDoubleClick(object sender, InputEventArgs e)
 {
     AttachmentManager.RunViewer(((FrameworkElement)sender).DataContext as Attachment, true);
 }
コード例 #40
0
        /// <summary>
        /// Triggered when the user presses a key or mouse button.
        /// </summary>
        public override bool OnInputActivated(InputEventArgs args)
        {
            // Figure out what to do
            switch (args.Token)
            {
                case InputTokens.Up:
                case InputTokens.NumPad8:
                    index = GetIndex(index - 1);
                    break;
                case InputTokens.Down:
                case InputTokens.NumPad2:
                    index = GetIndex(index + 1);
                    break;
                case InputTokens.Right:
                case InputTokens.Enter:
                case InputTokens.Space:
                    switch (index)
                    {
                        case 0:
                            GameModeManager.Set(new NewGameMode());
                            break;
                        case 1:
                            GameModeManager.Push(new TextScrollGameMode(
                                    "help.txt", null));
                            break;
                        case 2:
                            GameModeManager.Push(new TextScrollGameMode(
                                    "story.txt", null));
                            break;
                        case 3:
                            GameModeManager.Push(new TextScrollGameMode(
                                    "credits.txt", null));
                            break;
                        case 4:
                            Core.Exit();
                            break;
                        case 5:
                            // Pop off the mode and resume the game
                            GameModeManager.Pop();
                            break;
                    }
                    break;
                case InputTokens.Escape: // Quit
                    Core.Exit();
                    break;
            }

            // Allow it to keep passing it on
            return true;
        }
コード例 #41
0
ファイル: SimpleUI.cs プロジェクト: tommyettinger/AgateDemo
 public void handleAction(InputEventArgs e)
 {
     if (linksTo != null)
         ScreenBrowser.Navigate(linksTo);
     else if (eventLink != null)
     {
         ScreenBrowser.Hide();
         Demo.mode = InputMode.Map;
         Keyboard.KeyDown -= eventLink;
         Keyboard.KeyDown += eventLink;
     }
     if (actionLink != null)
     {
         actionLink();
     }
 }
コード例 #42
0
ファイル: DiagramShape.cs プロジェクト: JBTech/Dot.Utility
 public virtual bool OnMouseOver(InputEventArgs evt, DiagramView view)
 {
     return false;
 }
コード例 #43
0
ファイル: Hero.cs プロジェクト: wolf96/Game-Pattern-Unity3d
 // Update is called once per frame
 void Input_events(InputEventArgs e)
 {
     if (e != null)
     {
         InputTran(this, e);
     }
 }
コード例 #44
0
 void PlayRecord_Inputed(IFocusable sender, InputEventArgs args)
 {
     if (args.InputInfo.IsPressed(ButtonType.Cross))
     {
         FocusManager.RemoveFocus();
         sound.Play(PPDSetting.DefaultSounds[2], -1000);
     }
     else if (args.InputInfo.IsPressed(ButtonType.Left))
     {
         graphDrawType--;
         if (graphDrawType < 0)
         {
             graphDrawType = GraphDrawType.FinishTime;
         }
         ChangeGraphData();
         sound.Play(PPDSetting.DefaultSounds[3], -1000);
     }
     else if (args.InputInfo.IsPressed(ButtonType.Right))
     {
         graphDrawType++;
         if (graphDrawType > GraphDrawType.FinishTime)
         {
             graphDrawType = GraphDrawType.Score;
         }
         ChangeGraphData();
         sound.Play(PPDSetting.DefaultSounds[3], -1000);
     }
     else if (args.InputInfo.IsPressed(ButtonType.R))
     {
         Difficulty last = selectedDifficulty;
         selectedDifficulty++;
         int iter = 0;
         while (!CheckExist() && iter < 4)
         {
             selectedDifficulty++;
             if (selectedDifficulty >= Difficulty.Other)
             {
                 selectedDifficulty = Difficulty.Easy;
             }
             iter++;
         }
         selectedIndex = 0;
         ChangeResultTableDifficulty();
         ChangeGraphData();
         ChangeResultTable();
         if (last != selectedDifficulty)
         {
             sound.Play(PPDSetting.DefaultSounds[3], -1000);
         }
     }
     else if (args.InputInfo.IsPressed(ButtonType.L))
     {
         Difficulty last = selectedDifficulty;
         selectedDifficulty--;
         int iter = 0;
         while (!CheckExist() && iter < 4)
         {
             selectedDifficulty--;
             if (selectedDifficulty < Difficulty.Easy)
             {
                 selectedDifficulty = Difficulty.Extreme;
             }
             iter++;
         }
         selectedIndex = 0;
         ChangeResultTableDifficulty();
         ChangeGraphData();
         ChangeResultTable();
         if (last != selectedDifficulty)
         {
             sound.Play(PPDSetting.DefaultSounds[3], -1000);
         }
     }
     else if (args.InputInfo.IsPressed(ButtonType.Up))
     {
         if (currentDifficultyRecults.Count > 0)
         {
             selectedIndex--;
             if (selectedIndex < 0)
             {
                 selectedIndex = 0;
             }
             else
             {
                 SetResultInfo();
                 sound.Play(PPDSetting.DefaultSounds[0], -1000);
             }
         }
     }
     else if (args.InputInfo.IsPressed(ButtonType.Down))
     {
         if (currentDifficultyRecults.Count > 0)
         {
             selectedIndex++;
             if (selectedIndex >= currentDifficultyRecults.Count)
             {
                 selectedIndex = currentDifficultyRecults.Count - 1;
             }
             else
             {
                 SetResultInfo();
                 sound.Play(PPDSetting.DefaultSounds[0], -1000);
             }
         }
     }
     else if (args.InputInfo.IsPressed(ButtonType.Triangle))
     {
         if (graphDrawType == GraphDrawType.FinishTime && currentDifficultyRecults.Count > 0)
         {
             var ppd = new PreviewPlayDialog(device, resourceManager, sound)
             {
                 SongName   = songname.Text,
                 Difficulty = difficultyStrings[(int)selectedDifficulty],
                 StartTime  = FloatToFloatFormatter.Formatter.Format(currentDifficultyRecults[selectedIndex].FinishTime)
             };
             FocusManager.Focus(ppd);
             this.InsertChild(ppd, 0);
             ppd.LostFocused += ppd_LostFocused;
         }
     }
     else if (args.InputInfo.IsPressed(ButtonType.Square))
     {
         if (currentDifficultyRecults.Count > 0)
         {
             var drd = new GeneralDialog(device, resourceManager, sound, Utility.Language["DeleteRecordConfirm"], GeneralDialog.ButtonTypes.OkCancel);
             FocusManager.Focus(drd);
             this.InsertChild(drd, 0);
             drd.LostFocused += drd_LostFocused;
         }
     }
 }
コード例 #45
0
ファイル: getrectangle.cs プロジェクト: zdmta/openrpa
 private static void onMouseDown(InputEventArgs e)
 {
     mouseDown = true;
     start     = new System.Drawing.Point(e.X, e.Y);
 }
コード例 #46
0
 protected virtual void OnStarted(object sender, InputEventArgs e)
 {
     this.args.Clear();
     this.args.Add(new ArgsVm(e));
 }
コード例 #47
0
        private void ParseMouseUp(InputEventArgs e)
        {
            try
            {
                // if(string.IsNullOrEmpty(Thread.CurrentThread.Name)) Thread.CurrentThread.Name = "IE.Plugin.OnMouseUP";
                Log.Debug(string.Format("IE.Recording::OnMouseUp::begin"));
                var re = new RecordEvent
                {
                    Button = e.Button
                }; var a = new GetElement {
                    DisplayName = (e.Element.Name).Replace(Environment.NewLine, "").Trim()
                };

                var p = System.Diagnostics.Process.GetProcessById(e.Element.ProcessId);
                if (p.ProcessName != "iexplore" && p.ProcessName != "iexplore.exe")
                {
                    return;
                }

                var browser     = new Browser(e.Element.RawElement);
                var htmlelement = browser.ElementFromPoint(e.X, e.Y);
                if (htmlelement == null)
                {
                    return;
                }

                var sw = new System.Diagnostics.Stopwatch();
                sw.Start();
                IESelector sel = null;
                // sel = new IESelector(e.Element.rawElement, null, true);
                GenericTools.RunUI(() =>
                {
                    sel = new IESelector(browser, htmlelement, null, false, e.X, e.Y);
                });
                if (sel == null)
                {
                    return;
                }
                if (sel.Count < 2)
                {
                    return;
                }
                a.Selector   = sel.ToString();
                a.Image      = sel.Last().Element.ImageString();
                re.UIElement = e.Element;
                re.Element   = new IEElement(browser, htmlelement);
                re.Selector  = sel;
                re.X         = e.X;
                re.Y         = e.Y;

                Log.Debug(e.Element.SupportInput + " / " + e.Element.ControlType);
                re.a = new GetElementResult(a);
                //if (htmlelement.tagName.ToLower() == "input" && htmlelement.tagName.ToLower() == "select")
                if (htmlelement.tagName.ToLower() == "input")
                {
                    MSHTML.IHTMLInputElement inputelement = (MSHTML.IHTMLInputElement)htmlelement;
                    re.SupportInput = (inputelement.type.ToLower() == "text" || inputelement.type.ToLower() == "password");
                }
                re.SupportSelect = false;
                Log.Debug(string.Format("IE.Recording::OnMouseUp::end {0:mm\\:ss\\.fff}", sw.Elapsed));
                OnUserAction?.Invoke(this, re);
            }
            catch (Exception ex)
            {
                Log.Error(ex.ToString());
            }
        }
コード例 #48
0
 protected virtual void OnEnded(object sender, InputEventArgs e)
 {
     this.args.Add(new ArgsVm(e));
 }
コード例 #49
0
        // Draw and Update Handling
        public override void Update(GameTime time)
        {
            if (IsVisible && IsEnabled)
            {
                base.Update(time);

                // process child element updates
                if (Children.Count > 0)
                {
                    foreach (GuiElement child in Children)
                    {
                        child.Update(time);
                    }
                }

                // Check Mouse Event Handlers
                InputState.Update(Keyboard.GetState(), Mouse.GetState());
                InputEventArgs args = new InputEventArgs();
                args.InputState = InputState;

                // Mouse Enter
                if (!MouseEntered && MouseOver)
                {
                    MouseLeft    = false;
                    MouseEntered = true;
                    MouseDown    = false;
                    MouseUp      = false;
                    OnInputEvent(args, MouseEnter);
                }
                else
                // Mouse Leave
                if (MouseEntered && !MouseOver)
                {
                    MouseEntered = false;
                    MouseLeft    = true;
                    MouseDown    = false;
                    MouseUp      = false;
                    OnInputEvent(args, MouseLeave);
                }

                // Mouse Click
                if (IsMousePressed)
                {
                    MouseUp   = false;
                    MouseDown = true;
                    IsActive  = true;
                }

                if (MouseDown && Mouse.GetState().LeftButton == ButtonState.Released && MouseOver)
                {
                    MouseDown = false;
                    MouseUp   = true;
                    OnInputEvent(args, MouseClick);
                }

                if (!MouseOver && Mouse.GetState().LeftButton == ButtonState.Pressed)
                {
                    IsActive = false;
                }

                // Mouse Scroll
                if (MouseEntered && InputState.getMouseDeltaScrollWheelValue() != 0)
                {
                    OnInputEvent(args, MouseScroll);
                }
            }
        }
コード例 #50
0
ファイル: State.cs プロジェクト: wolf96/Game-Pattern-Unity3d
 public virtual void handleInput(object sender, InputEventArgs e)
 {
 }
コード例 #51
0
 private void TangramTable_OnInputReceived(InputEventArgs args)
 {
     if (args is MultiTouchEventArgs && !args.Handled)
     {
         TangramTable_OnMultiTouchReceived(args as MultiTouchEventArgs);
     }
 }
コード例 #52
0
        private void _OnMouseMove(InputEventArgs e)
        {
            if (isMouseDown)
            {
                return;
            }
            if (CurrentProcessId == 0)
            {
                CurrentProcessId = System.Diagnostics.Process.GetCurrentProcess().Id;
            }
            var thread = new Thread(new ThreadStart(() =>
            {
                try
                {
                    lock (_lock)
                    {
                        if (_processing)
                        {
                            return;
                        }
                        _processing = true;
                    }
                    try
                    {
                        if (e.Element == null)
                        {
                            var Element = AutomationHelper.GetFromPoint(e.X, e.Y);
                            if (Element != null)
                            {
                                e.SetElement(Element);
                            }
                        }
                    }
                    catch (Exception ex)
                    {
                        Log.Error(ex, "");
                    }
                    lock (_lock)
                    {
                        _processing = false;
                    }
                    if (e.Element == null)
                    {
                        return;
                    }

                    if (e.Element.RawElement.Properties.ProcessId.IsSupported && e.Element.RawElement.Properties.ProcessId.ValueOrDefault == CurrentProcessId)
                    {
                        return;
                    }
                    var re = new RecordEvent
                    {
                        Button    = e.Button,
                        OffsetX   = e.X - e.Element.Rectangle.X,
                        OffsetY   = e.Y - e.Element.Rectangle.Y,
                        Element   = e.Element,
                        UIElement = e.Element,
                        X         = e.X,
                        Y         = e.Y
                    }; OnMouseMove?.Invoke(this, re);
                }
                catch (Exception ex)
                {
                    Log.Error(ex, "");
                }
            }));

            thread.IsBackground = true;
            thread.Start();
        }
コード例 #53
0
ファイル: KeyInputBindProvider.cs プロジェクト: Jntz/jamipeli
        public IEnumerable<IInputCallbacker> Update(Dictionary<Type, IInputStateProvider> providers, GameTime gt)
        {
            KeyboardStateProvider keyInput = (KeyboardStateProvider)providers[typeof (KeyboardStateProvider)];
            //Console.WriteLine(keyInput.IsKeyDown(Keys.Space));

            Keys[] newKeys = keyInput.CurrentState.GetPressedKeys();
            Keys[] oldKeys = keyInput.OldState.GetPressedKeys();

            IEnumerable<Keys> toCheck = oldKeys.Union(newKeys);
            List<String> calls = new List<string>();

            foreach (Keys key in toCheck)
            {
                foreach (var bind in keyBinds.Where(bind => bind.Value.Contains(key)))
                {
                    if (calls.Contains(bind.Key)) continue;

                    KeyboardBinding binding = Bindings[bind.Key];

                    InputState inputState = InputState.Up;
                    // koska key on down useimmiten, niin parempi tarkastaa eka
                    if (keyInput.IsKeyDown(key))
                    {
                        inputState = InputState.Down;
                        binding.HoldTime += gt.ElapsedGameTime.TotalMilliseconds;
                    }
                        // just tällä framella
                    else if (keyInput.IsKeyPressed(key))
                    {
                        inputState = InputState.Pressed;

                        binding.HoldTime = 0;
                    }
                        // just löysätty
                    else if (keyInput.IsKeyReleased(key))
                    {
                        inputState = InputState.Released;
                    }

                    if ((inputState & binding.Condition) != inputState) continue;

                    InputEventArgs args = new InputEventArgs(binding.HoldTime, inputState, gt);
                    KeyboardInputCallbacker cb = new KeyboardInputCallbacker(key, args, binding.Callbacks);

                    calls.Add(bind.Key);
                    yield return cb;
                }

            }
        }
コード例 #54
0
        public void MakeStep(object sender, InputEventArgs e)
        {
            var inputKey = e.KeyNumber;

            game.MakeMove(inputKey);
        }
コード例 #55
0
 private void OnMouseUp(InputEventArgs e)
 {
     try
     {
         if (e.Element == null)
         {
             return;
         }
         if (Entity == null || string.IsNullOrEmpty(Selector))
         {
             return;
         }
         var pathToRoot            = new List <AutomationElement>();
         AutomationElement element = e.Element.RawElement;
         while (element != null)
         {
             if (pathToRoot.Contains(element))
             {
                 break;
             }
             try
             {
                 if (element.Parent != null)
                 {
                     pathToRoot.Add(element);
                 }
             }
             catch (Exception)
             {
             }
             try
             {
                 element = element.Parent;
             }
             catch (Exception ex)
             {
                 element = null;
                 Log.Error(ex, "");
                 // return;
             }
         }
         WindowsSelector selector = new WindowsSelector(Selector);
         if (pathToRoot.Count < (selector.Count - 1))
         {
             return;
         }
         if (pathToRoot.Count > (selector.Count - 1))
         {
             return;
         }
         pathToRoot.Reverse();
         for (var i = 0; i < pathToRoot.Count; i++)
         {
             element = pathToRoot[i];
             WindowsSelectorItem s = new WindowsSelectorItem(selector[(i + 1)]);
             if (!s.Match(element))
             {
                 Log.Debug("Element " + i + " does not match with selector");
                 return;
             }
         }
         var _e = new DetectorEvent(e.Element);
         OnDetector?.Invoke(this, _e, EventArgs.Empty);
     }
     catch (Exception ex)
     {
         Log.Error(ex.ToString());
     }
 }
コード例 #56
0
ファイル: Element3D.cs プロジェクト: zhaoyipeng/helix-toolkit
 public MouseMove3DEventArgs(object source, HitTestResult hitTestResult, Point position, Viewport3DX viewport = null, InputEventArgs originalInputEventArgs = null)
     : base(Element3D.MouseMove3DEvent, source, hitTestResult, position, viewport, originalInputEventArgs)
 {
 }
コード例 #57
0
ファイル: DiagramShape.cs プロジェクト: JBTech/Dot.Utility
 public virtual bool OnDoubleClick(InputEventArgs evt, DiagramView view)
 {
     return false;
 }
コード例 #58
0
ファイル: Plugin.cs プロジェクト: shudingcai/openrpa
        private void OnMouseUp(InputEventArgs e)
        {
            isMouseDown = false;
            var thread = new Thread(new ThreadStart(() =>
            {
                try
                {
                    Log.Debug(string.Format("Windows.Recording::OnMouseUp::begin"));
                    var re = new RecordEvent
                    {
                        Button = e.Button
                    }; var a = new GetElement {
                        DisplayName = e.Element.Name
                    };
                    var sw = new System.Diagnostics.Stopwatch();
                    sw.Start();
                    WindowsSelector sel = null;
                    // sel = new WindowsSelector(e.Element.rawElement, null, true);
                    sel = new WindowsSelector(e.Element.RawElement, null, PluginConfig.enum_selector_properties);
                    if (sel.Count < 2)
                    {
                        return;
                    }
                    if (sel == null)
                    {
                        return;
                    }
                    a.Selector   = sel.ToString();
                    a.MaxResults = 1;
                    a.Image      = e.Element.ImageString();
                    re.OffsetX   = e.X - e.Element.Rectangle.X;
                    re.OffsetY   = e.Y - e.Element.Rectangle.Y;
                    re.UIElement = e.Element;
                    re.Element   = e.Element;
                    re.Selector  = sel;
                    re.X         = e.X;
                    re.Y         = e.Y;
                    if (sel.Count > 3)
                    {
                        var p1 = sel[1].Properties.Where(x => x.Name == "ClassName").FirstOrDefault();
                        var p2 = sel[2].Properties.Where(x => x.Name == "AutomationId").FirstOrDefault();
                        if (p1 != null && p2 != null)
                        {
                            if (p1.Value.StartsWith("Windows.UI") && p2.Value == "SplitViewFrameXAMLWindow")
                            {
                                re.SupportVirtualClick = false;
                            }
                        }
                    }
                    re.a             = new GetElementResult(a);
                    re.SupportInput  = e.Element.SupportInput;
                    re.SupportSelect = e.Element.SupportSelect;
                    Log.Debug(string.Format("Windows.Recording::OnMouseUp::end {0:mm\\:ss\\.fff}", sw.Elapsed));
                    OnUserAction?.Invoke(this, re);
                }
                catch (Exception ex)
                {
                    Log.Error(ex.ToString());
                }
            }));

            thread.IsBackground = true;
            thread.Start();
        }
コード例 #59
0
ファイル: Game1.cs プロジェクト: ckx/gameconsole_xna
 // handle all input from the game console
 void console_InputEntered(object sender, InputEventArgs e)
 {
     Console.WriteLine(e.Time + ": " + e.Input);
 }
コード例 #60
0
ファイル: GameState.cs プロジェクト: nicolas-repiquet/Granite
        public void Input(InputEventArgs e)
        {
            var mouseButtonDownEvent = e as MouseButtonDownEventArgs;

            if (mouseButtonDownEvent != null)
            {
                if (mouseButtonDownEvent.Button == MouseButton.Left)
                {
                    m_mouseLeftPressed = true;
                    m_mousePosition    = mouseButtonDownEvent.Position;
                }

                if (mouseButtonDownEvent.Button == MouseButton.Right)
                {
                    m_world.Player.NextWeapon();
                }
            }

            var mouseButtonUpEvent = e as MouseButtonUpEventArgs;

            if (mouseButtonUpEvent != null)
            {
                if (mouseButtonUpEvent.Button == MouseButton.Left)
                {
                    m_mouseLeftPressed = false;
                }
            }

            var mouseMoveEvent = e as MouseMoveEventArgs;

            if (mouseMoveEvent != null)
            {
                m_mousePosition = mouseMoveEvent.Position;
            }

            var mouseButtonWheelEvent = e as MouseWheelEventArgs;

            if (mouseButtonWheelEvent != null)
            {
                World.Instance.Camera.Zoom -= mouseButtonWheelEvent.Ticks;
            }

            var keyboardKeyDownEvent = e as KeyboardKeyDownEventArgs;

            if (keyboardKeyDownEvent != null)
            {
                if (keyboardKeyDownEvent.Key == Key.F1)
                {
                    StateManager.Instance.SetGameState(EGameState.MAINMENU);
                }

                if (keyboardKeyDownEvent.Key == Key.F4)
                {
                    StateManager.Instance.SetGameState(EGameState.PAUSE);
                }

                if (keyboardKeyDownEvent.Key == Key.Up || keyboardKeyDownEvent.Key == Key.Z)
                {
                    m_keyUpPressed = true;
                }

                if (keyboardKeyDownEvent.Key == Key.Down || keyboardKeyDownEvent.Key == Key.S)
                {
                    m_keyDownPressed = true;
                }

                if (keyboardKeyDownEvent.Key == Key.Left || keyboardKeyDownEvent.Key == Key.Q)
                {
                    m_keyLeftPressed = true;
                }

                if (keyboardKeyDownEvent.Key == Key.Right || keyboardKeyDownEvent.Key == Key.D)
                {
                    m_keyRightPressed = true;
                }

                if (keyboardKeyDownEvent.Key == Key.R)
                {
                    m_world.Player.Weapon.ReloadCharger();
                }
            }

            var keyboardKeyUpEvent = e as KeyboardKeyUpEventArgs;

            if (keyboardKeyUpEvent != null)
            {
                if (keyboardKeyUpEvent.Key == Key.Up || keyboardKeyUpEvent.Key == Key.Z)
                {
                    m_keyUpPressed = false;
                }

                if (keyboardKeyUpEvent.Key == Key.Down || keyboardKeyUpEvent.Key == Key.S)
                {
                    m_keyDownPressed = false;
                }

                if (keyboardKeyUpEvent.Key == Key.Left || keyboardKeyUpEvent.Key == Key.Q)
                {
                    m_keyLeftPressed = false;
                }

                if (keyboardKeyUpEvent.Key == Key.Right || keyboardKeyUpEvent.Key == Key.D)
                {
                    m_keyRightPressed = false;
                }
            }
        }