Ejemplo n.º 1
0
        /// <summary>
        /// Attempts to select any hovered blueprints.
        /// </summary>
        /// <param name="e">The input event that triggered this selection.</param>
        private void beginClickSelection(MouseButtonEvent e)
        {
            Debug.Assert(!clickSelectionBegan);

            foreach (SelectionBlueprint blueprint in SelectionBlueprints.AliveChildren)
            {
                if (blueprint.IsHovered)
                {
                    SelectionHandler.HandleSelectionRequested(blueprint, e.CurrentState);
                    clickSelectionBegan = true;
                    break;
                }
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Attempts to select any hovered blueprints.
        /// </summary>
        /// <param name="e">The input event that triggered this selection.</param>
        /// <returns>Whether a selection was performed.</returns>
        private bool beginClickSelection(MouseButtonEvent e)
        {
            foreach (SelectionBlueprint blueprint in SelectionBlueprints.AliveChildren)
            {
                if (!blueprint.IsHovered)
                {
                    continue;
                }

                return(clickSelectionBegan = SelectionHandler.HandleSelectionRequested(blueprint, e));
            }

            return(false);
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Attempts to select any hovered blueprints.
        /// </summary>
        /// <param name="e">The input event that triggered this selection.</param>
        /// <returns>Whether a selection was performed.</returns>
        private bool beginClickSelection(MouseButtonEvent e)
        {
            // Iterate from the top of the input stack (blueprints closest to the front of the screen first).
            foreach (SelectionBlueprint blueprint in SelectionBlueprints.AliveChildren.Reverse())
            {
                if (!blueprint.IsHovered)
                {
                    continue;
                }

                return(clickSelectionBegan = SelectionHandler.HandleSelectionRequested(blueprint, e));
            }

            return(false);
        }
Ejemplo n.º 4
0
        /// <summary>
        /// Attempts to select any hovered blueprints.
        /// </summary>
        /// <param name="e">The input event that triggered this selection.</param>
        /// <returns>Whether a selection was performed.</returns>
        private bool beginClickSelection(MouseButtonEvent e)
        {
            Debug.Assert(!clickSelectionBegan);

            bool selectedPerformed = true;

            foreach (SelectionBlueprint blueprint in SelectionBlueprints.AliveChildren)
            {
                if (blueprint.IsHovered)
                {
                    selectedPerformed  &= SelectionHandler.HandleSelectionRequested(blueprint, e.CurrentState);
                    clickSelectionBegan = true;
                    break;
                }
            }

            return(selectedPerformed);
        }
Ejemplo n.º 5
0
        /// <summary>
        /// Attempts to select any hovered blueprints.
        /// </summary>
        /// <param name="e">The input event that triggered this selection.</param>
        private void beginClickSelection(MouseButtonEvent e)
        {
            Debug.Assert(!clickSelectionBegan);

            // Deselections are only allowed for control + left clicks
            bool allowDeselection = e.ControlPressed && e.Button == MouseButton.Left;

            // Todo: This is probably incorrectly disallowing multiple selections on stacked objects
            if (!allowDeselection && selectionHandler.SelectedBlueprints.Any(s => s.IsHovered))
            {
                return;
            }

            foreach (SelectionBlueprint blueprint in SelectionBlueprints.AliveChildren)
            {
                if (blueprint.IsHovered)
                {
                    selectionHandler.HandleSelectionRequested(blueprint, e.CurrentState);
                    clickSelectionBegan = true;
                    break;
                }
            }
        }