Esempio n. 1
0
    private void FindButtons()
    {
        buttonsPlayerOne   = playerOne.FindState();
        buttonsPlayerTwo   = playerTwo.FindState();
        buttonsPlayerThree = playerThree.FindState();
        buttonsPlayerFour  = playerFour.FindState();

        if (buttonsPlayerOne == null)
        {
            CharacterMenu menuCharacter = playerOne.FindCharacterMenu();
            List <Button> buttons       = menuCharacter.FindButtons();

            buttonsPlayerOneLeft  = new List <Button>();
            buttonsPlayerOneRight = new List <Button>();

            int nr = 0;
            foreach (Button btn in buttons)
            {
                if (nr == 1)
                {
                    if (buttons.Count == 3)
                    {
                        buttonsPlayerOneLeft.Add(btn);
                    }
                    else
                    {
                        buttonsPlayerOneRight.Add(btn);
                    }
                }
                else if (nr < 1)
                {
                    buttonsPlayerOneRight.Add(btn);
                }
                else
                {
                    buttonsPlayerOneLeft.Add(btn);
                }

                nr++;
            }
        }

        if (buttonsPlayerTwo == null)
        {
            CharacterMenu menuCharacter = playerTwo.FindCharacterMenu();
            List <Button> buttons       = menuCharacter.FindButtons();

            buttonsPlayerTwoLeft  = new List <Button>();
            buttonsPlayerTwoRight = new List <Button>();

            int nr = 0;
            foreach (Button btn in buttons)
            {
                if (nr == 1)
                {
                    if (buttons.Count == 3)
                    {
                        buttonsPlayerTwoLeft.Add(btn);
                    }
                    else
                    {
                        buttonsPlayerTwoRight.Add(btn);
                    }
                }
                else if (nr < 1)
                {
                    buttonsPlayerTwoRight.Add(btn);
                }
                else
                {
                    buttonsPlayerTwoLeft.Add(btn);
                }

                nr++;
            }
        }

        if (buttonsPlayerThree == null)
        {
            CharacterMenu menuCharacter = playerThree.FindCharacterMenu();
            List <Button> buttons       = menuCharacter.FindButtons();

            buttonsPlayerThreeLeft  = new List <Button>();
            buttonsPlayerThreeRight = new List <Button>();

            int nr = 0;
            foreach (Button btn in buttons)
            {
                if (nr == 1)
                {
                    if (buttons.Count == 3)
                    {
                        buttonsPlayerThreeLeft.Add(btn);
                    }
                    else
                    {
                        buttonsPlayerThreeRight.Add(btn);
                    }
                }
                else if (nr < 1)
                {
                    buttonsPlayerThreeRight.Add(btn);
                }
                else
                {
                    buttonsPlayerThreeLeft.Add(btn);
                }

                nr++;
            }
        }

        if (buttonsPlayerFour == null)
        {
            CharacterMenu menuCharacter = playerFour.FindCharacterMenu();
            List <Button> buttons       = menuCharacter.FindButtons();

            buttonsPlayerFourLeft  = new List <Button>();
            buttonsPlayerFourRight = new List <Button>();

            int nr = 0;
            foreach (Button btn in buttons)
            {
                if (nr == 1)
                {
                    if (buttons.Count == 3)
                    {
                        buttonsPlayerFourLeft.Add(btn);
                    }
                    else
                    {
                        buttonsPlayerFourRight.Add(btn);
                    }
                }
                else if (nr < 1)
                {
                    buttonsPlayerFourRight.Add(btn);
                }
                else
                {
                    buttonsPlayerFourLeft.Add(btn);
                }

                nr++;
            }
        }
    }