/// <summary>
        /// A player looking for a new color will call this; they'll swap
        /// their current texture for a different available texture.
        /// </summary>
        /// <param name="texturetobeswitched">The texture the player currently has</param>
        /// <returns></returns>
        public SelectionContent GetColor(SelectionContent texturetobeswitched, bool l)
        {
            if (availableSelections.Count > 0)
            {
                soundMenuC.Play();
                int pop  = 0;
                int push = availableSelections.Count - 1;

                if (l)
                {
                    pop  = push;
                    push = 0;
                }

                SelectionContent t = availableSelections[pop];
                availableSelections.RemoveAt(pop);

                availableSelections.Insert(push, texturetobeswitched);

                return(t);
            }
            else
            {
                return(null);
            }
        }
 public void ChangeIndex(int playerIndex, KeyPressed key)
 {
     if (!ready)
     {
         if (key == KeyPressed.Left)
             selection = popup.GetColor(selection, true);
         else if (key == KeyPressed.Right)
             selection = popup.GetColor(selection, false);
     }
 }
示例#3
0
 public void ChangeIndex(int playerIndex, KeyPressed key)
 {
     if (!ready)
     {
         if (key == KeyPressed.Left)
         {
             selection = popup.GetColor(selection, true);
         }
         else if (key == KeyPressed.Right)
         {
             selection = popup.GetColor(selection, false);
         }
     }
 }
        /// <summary>
        /// A player looking for a new color will call this; they'll swap
        /// their current texture for a different available texture.
        /// </summary>
        /// <param name="texturetobeswitched">The texture the player currently has</param>
        /// <returns></returns>
        public SelectionContent GetColor(SelectionContent texturetobeswitched, bool l)
        {
            if (availableSelections.Count > 0)
            {
                soundMenuC.Play();
                int pop = 0;
                int push = availableSelections.Count - 1;

                if (l)
                {
                    pop = push;
                    push = 0;
                }

                SelectionContent t = availableSelections[pop];
                availableSelections.RemoveAt(pop);

                availableSelections.Insert(push, texturetobeswitched);

                return t;
            }
            else
                return null;
        }