public void RemoveOnReleased(Mouse.Button button, DeleHandler <MouseButtonEventArgs> bind)
        {
            // Throw if "count" is passed
            if (button == Mouse.Button.ButtonCount)
            {
                throw new Exception("Button.ButtonCount is not a valid button");
            }

            // Remove
            if (_onButtonReleased.ContainsKey(button))
            {
                // Remove keybinding
                if (!_onButtonReleased[button].Remove(bind))
                {
                    GameConsole.WriteLine(string.Format("InputMouse: Tried to remove non-exsiting keybinding (Button:{0}, OnReleased)", button), GameConsole.MessageType.Error); // Debug
                    return;
                }

                // Remove this key from the dictionary if there are no keybindings left
                if (_onButtonReleased[button].Count == 0)
                {
                    _onButtonReleased.Remove(button);
                    GameConsole.WriteLine(string.Format("InputMouse: No more keybindings to this button - therefore remove button (Button:{0}, OnReleased)", button), GameConsole.MessageType.Important); // Debug
                }
            }
            else
            {
                GameConsole.WriteLine(string.Format("InputMouse: Tried to remove keybinding from non-bound button (Button:{0}, OnReleased)", button), GameConsole.MessageType.Error); // Debug
            }
        }
        public void AddOnReleased(Keyboard.Key key, DeleHandler <KeyEventArgs> bind)
        {
            // Create if it doesnt exist
            if (!_onKeyReleased.ContainsKey(key))
            {
                _onKeyReleased.Add(key, new List <DeleHandler <KeyEventArgs> >());
            }

            // Add
            _onKeyReleased[key].Add(bind);
        }
        public void AddOnAnyReleased(DeleHandler <MouseButtonEventArgs> bind)
        {
            // Create if it doesnt exist
            if (!_onButtonReleased.ContainsKey(Mouse.Button.ButtonCount))
            {
                _onButtonReleased.Add(Mouse.Button.ButtonCount, new List <DeleHandler <MouseButtonEventArgs> >());
            }

            // Add
            _onButtonReleased[Mouse.Button.ButtonCount].Add(bind);
        }
 public void RemoveOnMoved(DeleHandler <MouseMoveEventArgs> bind)
 {
     // Remove
     if (_onMoved.Contains(bind))
     {
         _onMoved.Remove(bind);
     }
     else
     {
         GameConsole.WriteLine(string.Format("InputMouse: Tried to remove non-exsiting keybinding (OnMoved)"), GameConsole.MessageType.Error); // Debug
     }
 }
 // Remove
 public void RemoveOnPressed(Keyboard.Key key, DeleHandler <KeyEventArgs> bind)
 {
     // Remove
     if (_onKeyPressed.ContainsKey(key))
     {
         if (!_onKeyPressed[key].Remove(bind))
         {
             GameConsole.WriteLine("errir pls"); // Debug
         }
     }
     else
     {
         GameConsole.WriteLine(string.Format(this.GetType().Name + ": Tried to remove keybinding from non-bound key (Key:{0}, OnPressed)", key), GameConsole.MessageType.Error); // Debug
     }
 }
        public void AddOnReleased(Mouse.Button button, DeleHandler <MouseButtonEventArgs> bind)
        {
            // Throw if "count" is passed
            if (button == Mouse.Button.ButtonCount)
            {
                throw new Exception("Button.ButtonCount is not a valid button");
            }

            // Create if it doesnt exist
            if (!_onButtonReleased.ContainsKey(button))
            {
                _onButtonReleased.Add(button, new List <DeleHandler <MouseButtonEventArgs> >());
            }

            // Add
            _onButtonReleased[button].Add(bind);
        }
        public void RemoveOnAnyReleased(DeleHandler <MouseButtonEventArgs> bind)
        {
            // Remove
            if (_onButtonReleased.ContainsKey(Mouse.Button.ButtonCount))
            {
                // Remove keybinding
                if (!_onButtonReleased[Mouse.Button.ButtonCount].Remove(bind))
                {
                    GameConsole.WriteLine("InputMouse: Tried to remove non-exsiting keybinding (OnAnyReleased)", GameConsole.MessageType.Error); // Debug
                    return;
                }

                // Remove this key from the dictionary if there are no keybindings left
                if (_onButtonReleased[Mouse.Button.ButtonCount].Count == 0)
                {
                    _onButtonReleased.Remove(Mouse.Button.ButtonCount);
                    GameConsole.WriteLine("InputMouse: No more keybindings to this button - therefore remove button (OnAnyReleased)", GameConsole.MessageType.Important); // Debug
                }
            }
            else
            {
                GameConsole.WriteLine("InputMouse: Tried to remove keybinding from non-bound button (OnAnyReleased)", GameConsole.MessageType.Error); // Debug
            }
        }
示例#8
0
 public void RemoveOnMoved(DeleHandler <MouseMoveEventArgs> bind)
 {
     // Remove at the beginning of the next frame
     _beginFrame += delegate { _bindings.RemoveOnMoved(bind); };
 }
示例#9
0
 public void RemoveOnReleased(Button button, DeleHandler <MouseButtonEventArgs> bind)
 {
     // Remove at the beginning of the next frame
     _beginFrame += delegate { _bindings.RemoveOnReleased(button, bind); };
 }
示例#10
0
 public void AddOnWheelChanged(DeleHandler <MouseWheelEventArgs> bind)
 {
     // Add at the beginning of the next frame
     _beginFrame += delegate { _bindings.AddOnWheelChanged(bind); };
 }
示例#11
0
 // Add (to events)
 public void AddOnPressed(Button button, DeleHandler <MouseButtonEventArgs> bind)
 {
     // Add at the beginning of the next frame
     _beginFrame += delegate { _bindings.AddOnPressed(button, bind); };
 }
示例#12
0
 public void RemoveOnReleased(Key key, DeleHandler <KeyEventArgs> bind)
 {
     // Add at the beginning of the next frame
     _beginFrame += delegate { _bindings.RemoveOnReleased(key, bind); };
 }
示例#13
0
 // Add
 public void AddOnPressed(Key key, DeleHandler <KeyEventArgs> bind)
 {
     // Add at the beginning of the next frame
     _beginFrame += delegate { _bindings.AddOnPressed(key, bind); };
 }
 public void AddOnMoved(DeleHandler <MouseMoveEventArgs> bind)
 {
     // Add
     _onMoved.Add(bind);
 }
 public void AddOnWheelChanged(DeleHandler <MouseWheelEventArgs> bind)
 {
     // Add
     _onWheelMoved.Add(bind);
 }