示例#1
0
文件: Tab.cs 项目: Atazir/EscapeOrDie
        private TabGroup FindTabGroup()
        {
            // The TabGroup is expected to be on the same object as the ToggleGroup.
            ToggleGroup toggleGroup = toggle.group;
            TabGroup    tabGroup    = toggleGroup.GetComponent <TabGroup>();

            return(tabGroup);
        }
示例#2
0
文件: Tab.cs 项目: Atazir/EscapeOrDie
 private void EnablePage()
 {
     // If the page already exists, just activate it,
     // otherwise create it.
     if (Page != null)
     {
         Page.SetActive(true);
     }
     else
     {
         Page = GameObject.Instantiate(pagePrefab);
         TabGroup tabGroup = FindTabGroup();
         Page.transform.SetParent(tabGroup.TabPageParent, false);
     }
 }
示例#3
0
文件: Tab.cs 项目: Atazir/EscapeOrDie
        void OnValidate()
        {
            // Awake probably hasn't been called yet, so set this here.
            toggle = GetComponent <Toggle>();

            // Make sure that this tab is part of a ToggleGroup.
            if (toggle.group == null)
            {
                Debug.LogError("Tab (" + gameObject.name + ") must be part of a ToggleGroup.");
            }

            // Make sure that the ToggleGroup has a TabGroup.
            TabGroup tabGroup = FindTabGroup();

            if (tabGroup == null)
            {
                Debug.LogError("Tab (" + gameObject.name + ")'s ToggleGroup must have a TabGroup.");
            }
        }