Ejemplo n.º 1
0
        /// <summary>
        ///     Handles a change in PlayerKeyState.
        /// </summary>
        /// <param name="sender">Sender of the event.</param>
        /// <param name="e">Object containing information about the event.</param>
        public void Handle(object sender, KeyStateChangedEventArgs e)
        {
            var args = new CancelableEventArgs();

            OnHighPriority(sender, args);

            if (!args.IsCanceled)
                OnNormalPriority(sender, args);

            if (!args.IsCanceled)
                OnLowPriority(sender, args);
        }
Ejemplo n.º 2
0
 /// <summary>
 ///     Handles a change in PlayerKeyState.
 /// </summary>
 /// <param name="sender">Sender of the event.</param>
 /// <param name="e">Object containing information about the event.</param>
 public void Handle(object sender, KeyStateChangedEventArgs e)
 {
     if (Action != null && _check(e, Keys.Action)) Action.Handle(sender, e);
     if (Crouch != null && _check(e, Keys.Crouch)) Crouch.Handle(sender, e);
     if (Fire != null && _check(e, Keys.Fire)) Fire.Handle(sender, e);
     if (Sprint != null && _check(e, Keys.Sprint)) Sprint.Handle(sender, e);
     if (SecondaryAttack != null && _check(e, Keys.SecondaryAttack)) SecondaryAttack.Handle(sender, e);
     if (Jump != null && _check(e, Keys.Jump)) Jump.Handle(sender, e);
     if (LookRight != null && _check(e, Keys.LookRight)) LookRight.Handle(sender, e);
     if (Handbrake != null && _check(e, Keys.Handbrake)) Handbrake.Handle(sender, e);
     if (Aim != null && _check(e, Keys.Aim)) Aim.Handle(sender, e);
     if (LookLeft != null && _check(e, Keys.LookLeft)) LookLeft.Handle(sender, e);
     if (Submission != null && _check(e, Keys.Submission)) Submission.Handle(sender, e);
     if (Walk != null && _check(e, Keys.Walk)) Walk.Handle(sender, e);
     if (AnalogUp != null && _check(e, Keys.AnalogUp)) AnalogUp.Handle(sender, e);
     if (AnalogDown != null && _check(e, Keys.AnalogDown)) AnalogDown.Handle(sender, e);
     if (AnalogLeft != null && _check(e, Keys.AnalogLeft)) AnalogLeft.Handle(sender, e);
     if (AnalogRight != null && _check(e, Keys.AnalogRight)) AnalogRight.Handle(sender, e);
     if (Yes != null && _check(e, Keys.Yes)) Yes.Handle(sender, e);
     if (No != null && _check(e, Keys.No)) No.Handle(sender, e);
     if (CtrlBack != null && _check(e, Keys.CtrlBack)) CtrlBack.Handle(sender, e);
 }
Ejemplo n.º 3
0
 /// <summary>
 ///     Raises the <see cref="PlayerKeyStateChanged" /> event.
 /// </summary>
 /// <param name="player">The player triggering the event.</param>
 /// <param name="e">An <see cref="KeyStateChangedEventArgs" /> that contains the event data. </param>
 protected virtual void OnPlayerKeyStateChanged(GtaPlayer player, KeyStateChangedEventArgs e)
 {
     if (PlayerKeyStateChanged != null)
         PlayerKeyStateChanged(player, e);
 }
Ejemplo n.º 4
0
 /// <summary>
 ///     Handles a change in PlayerKeyState.
 /// </summary>
 /// <param name="sender">Sender of the event.</param>
 /// <param name="e">Object containing information about the event.</param>
 public void Handle(object sender, KeyStateChangedEventArgs e)
 {
     Pressed.Handle(sender, e);
     Released.Handle(sender, e);
 }
Ejemplo n.º 5
0
 /// <summary>
 ///     Checks if <see cref="Keys" /> are being hold.
 /// </summary>
 /// <param name="e">The <see cref="KeyStateChangedEventArgs" />.</param>
 /// <param name="keys">The <see cref="Keys" /> to check for.</param>
 /// <returns>Whether the <see cref="Keys" /> are being hold.</returns>
 public static bool IsHolding(KeyStateChangedEventArgs e, Keys keys)
 {
     return IsHolding(e.NewKeys, e.OldKeys, keys);
 }
Ejemplo n.º 6
0
 /// <summary>
 ///     Checks if <see cref="Keys" /> have been released.
 /// </summary>
 /// <param name="e">The <see cref="KeyStateChangedEventArgs" />.</param>
 /// <param name="keys">The <see cref="Keys" /> to check for.</param>
 /// <returns>Whether the <see cref="Keys" /> have been released.</returns>
 public static bool HasReleased(KeyStateChangedEventArgs e, Keys keys)
 {
     return HasReleased(e.NewKeys, e.OldKeys, keys);
 }
Ejemplo n.º 7
0
 /// <summary>
 ///     Raises the <see cref="PlayerKeyStateChanged" /> event.
 /// </summary>
 /// <param name="player">The player triggering the event.</param>
 /// <param name="e">An <see cref="KeyStateChangedEventArgs" /> that contains the event data. </param>
 protected virtual void OnPlayerKeyStateChanged(BasePlayer player, KeyStateChangedEventArgs e)
 {
     PlayerKeyStateChanged?.Invoke(player, e);
 }