Esempio n. 1
0
    private static void CustomizeDirectionsMenuAll(Func <string, bool> filter = null)
    {
        List <char> linesExist = new List <char>();

        foreach (string maneuverCode in GenericMovement.GetAllManeuvers())
        {
            string[] parameters    = maneuverCode.Split('.');
            char     maneuverSpeed = parameters[0].ToCharArray()[0];

            if (parameters[2] == "V")
            {
                switch (maneuverSpeed)
                {
                case '1':
                    maneuverSpeed = '-';
                    break;

                case '2':
                    maneuverSpeed = '=';
                    break;

                default:
                    break;
                }
            }

            GameObject button = DirectionsWindow.transform.Find("Directions").Find("Speed" + maneuverSpeed).Find(maneuverCode).gameObject;

            if (filter == null || filter(maneuverCode))
            {
                if (!linesExist.Contains(maneuverSpeed))
                {
                    linesExist.Add(maneuverSpeed);
                }

                SetManeuverColor(button, new KeyValuePair <string, MovementComplexity>(maneuverCode, MovementComplexity.Normal));
                button.SetActive(true);
                button.GetComponent <Button>().onClick.AddListener(
                    delegate { UI.AssignManeuverButtonPressed(button.name); }
                    );

                GameObject number = DirectionsWindow.transform.Find("Numbers").Find("Speed" + maneuverSpeed).Find("Number").gameObject;
                number.SetActive(true);
            }
        }

        HideExtraElements(linesExist);
    }