public override void HandleInput(InputState inputState)
 {
     if (inputState.MouseLeftClickUp())
     {
         var lCurrentMouseState = inputState.CurrentMouseState;
         if (this.HitTest(lCurrentMouseState.X, lCurrentMouseState.Y))
         {
             var lClickHandler = this.Click;
             if (lClickHandler != null) lClickHandler(this);
             inputState.MouseLeftClickUpHandled = true;
         }
     }
 }
Esempio n. 2
0
        public override void HandleInput(InputState inputState)
        {
            if (!this.IsVisible || !this.IsEnabled) return;

            if (inputState.MouseLeftClickUp())
            {
                var lCurrentMouseState = inputState.CurrentMouseState;
                if (this.HitTest(lCurrentMouseState.X, lCurrentMouseState.Y))
                {
                    var lClickHandler = this.Click;
                    if (lClickHandler != null)
                    {
                        lClickHandler(this);
                    }
                    inputState.MouseLeftClickUpHandled = true;
                }
            }
        }
        public override void HandleInput(InputState inputState)
        {
            if (inputState.MouseLeftClickUp())
            {
                if (!this.mBeeYard.IsUnlocked) return;

                var lCurrentMouseState = inputState.CurrentMouseState;

                var lNameIsClicked = VectorUtilities.HitTest(
                    this.mWorldYardInfo.NamePosition,
                    this.mWorldYardInfo.NameSize,
                    lCurrentMouseState.X, lCurrentMouseState.Y);

                if (lNameIsClicked)
                {
                    this.TravelToYard(this);
                }

                inputState.MouseLeftClickUpHandled = true;
            }
        }
        public override void HandleInput(InputState inputState)
        {
            if (!this.Visible) return;

            if (inputState.MouseLeftClickUp())
            {
                var lCurrentMouseState = inputState.CurrentMouseState;
                if (VectorUtilities.HitTest(Vector2.Zero, this.ScreenSize, lCurrentMouseState.X, lCurrentMouseState.Y)
                    && !VectorUtilities.HitTest(this.mPosition, this.mSize, lCurrentMouseState.X, lCurrentMouseState.Y))
                {
                    this.Close();
                    inputState.MouseLeftClickUpHandled = true;
                }
                else
                {
                    for (int lIndex = 0; lIndex < sItemsPerPage; lIndex++)
                    {
                        if (VectorUtilities.HitTest(this.mItemPositions[lIndex], this.mItemSize, lCurrentMouseState.X, lCurrentMouseState.Y))
                        {
                            this.mSelectedIndexOffset = lIndex;
                            this.mInfoRecalculationNeeded = true;
                            inputState.MouseLeftClickUpHandled = true;
                            break;
                        }
                    }
                }
            }

            this.mButtonClose.HandleInput(inputState);
            this.mButtonPrevious.HandleInput(inputState);
            this.mButtonNext.HandleInput(inputState);
        }
 public override void HandleInput(InputState inputState)
 {
     if (inputState.MouseLeftClickUp())
     {
         var lCurrentMouseState = inputState.CurrentMouseState;
         if (VectorUtilities.HitTest(this.mHivePosition, this.mHiveSize, lCurrentMouseState.X, lCurrentMouseState.Y))
         {
             this.TravelToHive(this);
             inputState.MouseLeftClickUpHandled = true;
         }
     }
 }
Esempio n. 6
0
        public override void HandleInput(InputState inputState)
        {
            base.HandleInput(inputState);

            this.mInventorySelectorComponent.HandleInput(inputState);

            // Must handle input backwards to make the topmost component
            // the first to have a change to handle the input.
            for (int lIndex = this.mComponents.Count - 1; lIndex >= 0; lIndex--)
            {
                var lComponent = this.mComponents[lIndex];
                lComponent.HandleInput(inputState);
            }

            if (this.mIsSelectionModeActive && inputState.MouseLeftClickUp())
            {
                var lCurrentMouseState = inputState.CurrentMouseState;
                for (int lIndex = 0; lIndex < this.mSuperComponents.Count; lIndex++)
                {
                    var lSuperComponent = this.mSuperComponents[lIndex];
                    if (VectorUtilities.HitTest(lSuperComponent.Position, lSuperComponent.Size, lCurrentMouseState.X, lCurrentMouseState.Y))
                    {
                        lSuperComponent.IsSelected = true;
                        if (this.mSelectedSuper != null) this.mSelectedSuper.IsSelected = false;
                        this.mSelectedSuper = lSuperComponent;
                        break;
                    }
                }
            }

            if (!this.mInventorySelectorComponent.Visible)
            {
                var lCurrentMouseState = inputState.CurrentMouseState;
                if (this.mVerticalScrollUpBounds.Contains(lCurrentMouseState.X, lCurrentMouseState.Y))
                {
                    this.mVerticalScrollPosition = Math.Min(
                        this.mVerticalScrollPosition + this.mVerticalScrollAmount,
                        this.mVerticalScrollHeight);
                }
                else if (this.mVerticalScrollDownBounds.Contains(lCurrentMouseState.X, lCurrentMouseState.Y))
                {
                    this.mVerticalScrollPosition = Math.Max(
                        this.mVerticalScrollPosition - this.mVerticalScrollAmount, 0);
                }
            }
        }
Esempio n. 7
0
        public override void HandleInput(InputState inputState)
        {
            if (!this.IsVisible) return;

            if (inputState.MouseLeftClickUp())
            {
                var lCurrentMouseState = inputState.CurrentMouseState;
                if (this.HitTest(lCurrentMouseState.X, lCurrentMouseState.Y))
                {
                    if (this.ParentMenuButton != null)
                    {
                        foreach (var lMenuButton in this.ParentMenuButton.ChildMenuButtons)
                        {
                            lMenuButton.CloseAllChildMenuButtons();
                        }
                    }
                    else
                    {
                        System.Diagnostics.Debug.Assert(this.ButtonMenuComponent != null);
                        this.ButtonMenuComponent.CloseAllMenuButtons();
                    }

                    if (this.ChildMenuButtons.Count == 0)
                    {
                        System.Diagnostics.Debug.Assert(this.ButtonMenuComponent != null);
                        this.ButtonMenuComponent.CloseAllMenuButtons();
                    }
                    else
                    {
                        this.AreChildMenuButtonsVisible = true;
                    }

                    var lClickHandler = this.Click;
                    if (lClickHandler != null) lClickHandler(this);
                    inputState.MouseLeftClickUpHandled = true;
                }
            }

            foreach (var lMenuButton in this.ChildMenuButtons)
            {
                lMenuButton.HandleInput(inputState);
            }
        }
        public override void HandleInput(InputState inputState)
        {
            if (!this.IsVisible) return;

            foreach (var lMenuButton in this.MenuButtons)
            {
                lMenuButton.HandleInput(inputState);
            }

            if (inputState.MouseLeftClickUp())
            {
                this.CloseAllMenuButtons();
            }
        }