Ejemplo n.º 1
0
 public override InputReturns MouseRightDown(StateControls stateControls)
 {
     //true if you click a gate
     if (new BoxCollider(stateControls.LocalMousePosition.X, stateControls.LocalMousePosition.Y, 0, 0).GetIntersections(stateControls.State, (true, true, true), out _, out var boardObjects, false))
     {
         BoardObject clickedBoardObject = boardObjects.First();
         selections.Clear();
         selections.Add(clickedBoardObject);
         //Load [CircuitActions]
         var actions = CircuitAttributes.GetActions(clickedBoardObject, RefreshSelections, stateControls.RegisterChange);
         stateControls.CircuitActionsOutput = actions;
         return(true, this);
     }
     return(false, this);
 }
Ejemplo n.º 2
0
        /// <summary>
        /// Propogates hotkey through all selected CircuitObjects and runs any valid [CircuitProperties]
        /// </summary>
        protected bool ExecuteHotkey(BoardState state, char?key, Modifier Modifiers, Action <string> registerChange, out CircuitPropertyCollection circuitProperties)
        {
            CircuitActionCollection actions = CircuitActionCollection.Empty;

            //Find all actions
            foreach (var selection in selections)
            {
                actions.UnionWith(CircuitAttributes.GetActions(selection, RefreshSelections, registerChange));
            }

            char hotkey = (char)key;
            //Execute matches
            bool toRefresh = actions.InvokeHotkeyActions(state, hotkey, Modifiers);

            circuitProperties = GetUpdatedCircuitProperties(registerChange);
            return(toRefresh);
        }