예제 #1
0
    public void ChangeCurrentFormation()
    {
        string name       = EventSystem.current.currentSelectedGameObject.transform.GetChild(0).GetComponent <Text>().text;
        string parentName = GetSuperParentName(EventSystem.current.currentSelectedGameObject.transform);

        if (parentName.Contains("ControlA"))
        {
            TabControl.TabData tabDataA = tabControlA.FindTab(name);
            if (tabDataA != null)
            {
                string formationCallsign = tabDataA.tabTitle;
                foreach (Formation formation in sideA)
                {
                    if (formation.CallSign.Equals(formationCallsign))
                    {
                        currentFormation = formation;
                    }
                }
            }
        }
        else if (parentName.Contains("ControlB"))
        {
            TabControl.TabData tabDataB = tabControlB.FindTab(name);
            if (tabControlB != null)
            {
                string formationCallsign = tabDataB.tabTitle;
                foreach (Formation formation in sideB)
                {
                    if (formation.CallSign.Equals(formationCallsign))
                    {
                        currentFormation = formation;
                    }
                }
            }
        }
    }