コード例 #1
0
        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
            }
        }
コード例 #2
0
        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);
        }
コード例 #3
0
        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);
        }
コード例 #4
0
 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
     }
 }
コード例 #5
0
 // 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
     }
 }
コード例 #6
0
        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);
        }
コード例 #7
0
        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
ファイル: Mouse.cs プロジェクト: TBubba/BubbasEngine
 public void RemoveOnMoved(DeleHandler <MouseMoveEventArgs> bind)
 {
     // Remove at the beginning of the next frame
     _beginFrame += delegate { _bindings.RemoveOnMoved(bind); };
 }
コード例 #9
0
ファイル: Mouse.cs プロジェクト: TBubba/BubbasEngine
 public void RemoveOnReleased(Button button, DeleHandler <MouseButtonEventArgs> bind)
 {
     // Remove at the beginning of the next frame
     _beginFrame += delegate { _bindings.RemoveOnReleased(button, bind); };
 }
コード例 #10
0
ファイル: Mouse.cs プロジェクト: TBubba/BubbasEngine
 public void AddOnWheelChanged(DeleHandler <MouseWheelEventArgs> bind)
 {
     // Add at the beginning of the next frame
     _beginFrame += delegate { _bindings.AddOnWheelChanged(bind); };
 }
コード例 #11
0
ファイル: Mouse.cs プロジェクト: TBubba/BubbasEngine
 // 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); };
 }
コード例 #14
0
 public void AddOnMoved(DeleHandler <MouseMoveEventArgs> bind)
 {
     // Add
     _onMoved.Add(bind);
 }
コード例 #15
0
 public void AddOnWheelChanged(DeleHandler <MouseWheelEventArgs> bind)
 {
     // Add
     _onWheelMoved.Add(bind);
 }