Ejemplo n.º 1
0
 /// <summary>
 /// Returns true if there is an InputItem that matches the passed Identifier.
 /// </summary>
 /// <param name="identifier"></param>
 /// <returns></returns>
 public bool Has(IInputIdentifier identifier)
 {
     foreach (InputItem input in inputs)
     {
         if (identifier.Matches(input))
         {
             return(true);
         }
     }
     return(false);
 }
Ejemplo n.º 2
0
 /// <summary>
 /// Returns the first InputItem that matches the passed Identifier without removing it from the InputSet.
 /// Not recommended for most uses.
 /// </summary>
 /// <param name="match"></param>
 /// <param name="identifier"></param>
 /// <returns>If a match was found</returns>
 public bool View(out InputItem match, IInputIdentifier identifier)
 {
     foreach (InputItem input in inputs)
     {
         if (identifier.Matches(input))
         {
             match = input;
             return(true);
         }
     }
     match = null;
     return(false);
 }
Ejemplo n.º 3
0
        public bool ViewAllMatches(out List <InputItem> items, IInputIdentifier identifier)
        {
            bool foundAny = false;

            items = new List <InputItem>();
            foreach (InputItem input in inputs)
            {
                if (identifier.Matches(input))
                {
                    items.Add(input);
                    foundAny = true;
                }
            }
            return(foundAny);
        }
Ejemplo n.º 4
0
 /// <summary>
 /// Removes the first input item that matches the Identifier from the list and returns it, thus preventing its use on other screens.
 /// </summary>
 /// <param name="identifier"></param>
 /// <returns>The first InputItem that matches, or null if none does.</returns>
 public bool Consume(out InputItem match, IInputIdentifier identifier)
 {
     for (int i = 0; i < inputs.Count; i++)
     {
         if (identifier.Matches(inputs[i]))
         {
             InputItem item = inputs[i];
             inputs.RemoveAt(i);
             match = item;
             return(true);
         }
     }
     match = null;
     return(false);
 }
Ejemplo n.º 5
0
        public bool ConsumeAllMatches(out List <InputItem> items, IInputIdentifier identifier)
        {
            bool foundAny = false;

            items = new List <InputItem>();
            for (int i = 0; i < inputs.Count; i++)
            {
                if (identifier.Matches(inputs[i]))
                {
                    items.Add(inputs[i]);
                    inputs.RemoveAt(i);
                    i--;
                    foundAny = true;
                }
            }
            return(foundAny);
        }
Ejemplo n.º 6
0
 public bool Matches(IInputIdentifier identifier)
 {
     return(identifier.Matches(this));
 }
Ejemplo n.º 7
0
 /// <summary>
 /// Creates a new PauseScreen with the defined parameters.
 /// </summary>
 /// <param name="_overlay">The overlay to use.  For pure tint, pass a pure white pixel.</param>
 /// <param name="_tint">The color to tint the overlay.</param>
 /// <param name="endPause">The input that will cause the screen to close.</param>
 public PauseScreen(Texture2D _overlay, Color _tint, IInputIdentifier endPause)
 {
     overlay      = _overlay;
     tint         = _tint;
     closingInput = endPause;
 }