示例#1
0
    // Use this for initialization
    void Start()
    {
        a = gameObject.transform.GetComponentInChildren <TabComponent>();
        b = gameObject.transform.GetComponentInChildren <ButtonComponent>();

        if (a != null)
        {
            // print(a.tab.data.name);
            //TypeGeneric.Component ge = GetGen(a.tab);
            GenericType.Component ge = TabType.Generic(a.tab);

            print(ge.data.name + "_____");
        }
        else
        {
            print("No Tabs Found");
        }



        if (b != null)
        {
            print(b.button.data.name);
        }



        //parent
    }
        // Get parent



        public GenericValues(Component _ele)
        {
            //Get parent
            TabComponent _parent = _ele.transform.parent.GetComponent <TabComponent>();

            if (_parent != null)
            {
                parent = _parent.tab;
            }
            else
            {
                parent.geometry = new TabType.Geometry();
                parent.geometry.tabContainer.rect.width  = Screen.width;
                parent.geometry.tabContainer.rect.height = Screen.height;
                parent.geometry.tabBody.rect.width       = Screen.width;
                parent.geometry.tabBody.rect.height      = Screen.height;
                parent.data      = new TabType.Data();
                parent.data.type = SubType.TabType.Panel;
            }

            //Get values by component
            BranchValuesComponent _branchValues = _ele.GetComponentInParent <BranchValuesComponent>();

            if (_ele.GetType() == typeof(TabComponent))
            {
                ele = TabType.Generic(_ele.GetComponents <TabComponent>()[0].tab);
                componentPosition = ele.geometry.tabContainer.position;
                branchPosition    = _branchValues.tab.geometry.tabContainer.position;
                componentSize     = ele.geometry.tabContainer.size;
                branchSize        = _branchValues.tab.geometry.tabContainer.size;
            }
            else if (_ele.GetType() == typeof(ButtonComponent))
            {
                ele = ButtonType.Generic(_ele.GetComponents <ButtonComponent>()[0].button);
                componentPosition = ele.geometry.buttonBody.position;
                branchPosition    = _branchValues.button.geometry.buttonBody.position;
                componentSize     = ele.geometry.buttonBody.size;
                branchSize        = _branchValues.button.geometry.buttonBody.size;
            }
            else if (_ele.GetType() == typeof(TextareaComponent))
            {
                ele = TextareaType.Generic(_ele.GetComponents <TextareaComponent>()[0].textarea);
                componentPosition = ele.geometry.textareaBody.position;
                branchPosition    = _branchValues.textarea.geometry.textareaBody.position;
                componentSize     = ele.geometry.textareaBody.size;
                branchSize        = _branchValues.textarea.geometry.textareaBody.size;
            }
        }