public void ProcessInput(MouseGuru mouseGuru, KeyboardGuru keyboardGuru)
 {
     if (mouseGuru.OverLapped(GetHashCode(), Utils.ToScreen(Bounds), ReponseButtons))
     {
         Action(mouseGuru, keyboardGuru);
     }
 }
Esempio n. 2
0
        protected override void Action(MouseGuru mouseGuru, KeyboardGuru keyboardGuru)
        {
            _selector.Clear();
            _selector.Add(_gameObject);

            MoveCameraToSubject();
        }
Esempio n. 3
0
        /// <summary>
        /// Purpose: Moves the camera to the position in the game world relative
        /// to the MiniMap position
        /// <param name="mouseGuru"></param>
        protected override void Action(MouseGuru mouseGuru, KeyboardGuru keyboardGuru)
        {
            Rectangle newPostion = new Rectangle
                                   (
                Utils.FromBoundsToWorld(mouseGuru.RawPostion, Bounds),
                Utils.ScreenWidth(),
                Utils.ScreenHeight()
                                   );

            newPostion.X = Math.Abs(newPostion.X - Utils.ScreenWidth() / 2);
            newPostion.Y = Math.Abs(newPostion.Y - Utils.ScreenHeight() / 2);

            if (Utils.InsideGameBounds(newPostion))
            {
                Utils.SetCamreaPostion(newPostion);
            }
        }
        public void ProcessInput(MouseGuru mouesGuru, KeyboardGuru keyboardGuru)
        {
            foreach (UserInterlfaceContainer i in _userInterfaces)
            {
                i.ProcessInput(mouesGuru, keyboardGuru);
            }

            // Reason: Newer objects are on top thus should be processed first
            List <UserInputComponent> list = GetComponents <UserInputComponent>();

            list.Reverse();

            foreach (UserInputComponent j in list)
            {
                j.ProcessInput(mouesGuru, keyboardGuru);
            }

            _selector.ExcuteCommands();
        }
        protected override void Action(MouseGuru mouseGuru, KeyboardGuru keyboardGuru)
        {
            switch (_state)
            {
            case BoxSelectState.NotActive:
            {
                SetAction(InputAction.Nothing);

                if (mouseGuru.Down(GetHashCode(), MouseButton.LeftButton))
                {
                    _selector.Clear();
                    // Start Selcting
                    SwitchSelecting(mouseGuru.ScreenPostion);
                    _state = BoxSelectState.Active;
                }


                break;
            }

            case BoxSelectState.Active:
            {
                if (mouseGuru.Up(GetHashCode(), MouseButton.LeftButton))
                {
                    // Stop Selecting
                    SwitchSelecting(mouseGuru.ScreenPostion);
                    _state = BoxSelectState.NotActive;
                }
                else
                {
                    _graphics.UpdatePostion(mouseGuru.ScreenPostion);
                }

                break;
            }
            }
        }
 protected override void Action(MouseGuru mouseGuru, KeyboardGuru keyboardGuru)
 {
 }
 protected abstract void Action(MouseGuru mouseGuru, KeyboardGuru keyboardGuru);
 public void ProcessInput(MouseGuru mouseGuru, KeyboardGuru keyboardGuru)
 {
     _baseUI.ProcessInput(mouseGuru, keyboardGuru);
 }