Esempio n. 1
0
        public void AddInspectorTab(InspectorBase parent)
        {
            var tabContent = InspectorManager.m_tabBarContent;

            var tabGroupObj = UIFactory.CreateHorizontalGroup(tabContent, "TabObject", true, true, true, true);

            UIFactory.SetLayoutElement(tabGroupObj, minWidth: 185, flexibleWidth: 0);
            tabGroupObj.AddComponent <Mask>();

            m_tabButton = UIFactory.CreateButton(tabGroupObj,
                                                 "TabButton",
                                                 "",
                                                 () => { InspectorManager.Instance.SetInspectorTab(parent); });

            UIFactory.SetLayoutElement(m_tabButton.gameObject, minWidth: 165, flexibleWidth: 0);

            m_tabText = m_tabButton.GetComponentInChildren <Text>();
            m_tabText.horizontalOverflow = HorizontalWrapMode.Overflow;
            m_tabText.alignment          = TextAnchor.MiddleLeft;

            var closeBtn = UIFactory.CreateButton(tabGroupObj,
                                                  "CloseButton",
                                                  "X",
                                                  parent.Destroy,
                                                  new Color(0.2f, 0.2f, 0.2f, 1));

            UIFactory.SetLayoutElement(closeBtn.gameObject, minWidth: 20, flexibleWidth: 0);

            var closeBtnText = closeBtn.GetComponentInChildren <Text>();

            closeBtnText.color = new Color(1, 0, 0, 1);
        }
        public void UnsetInspectorTab()
        {
            if (m_activeInspector == null)
            {
                return;
            }

            m_activeInspector.SetInactive();

            OnUnsetInspectorTab();

            m_activeInspector = null;
        }
        public void SetInspectorTab(InspectorBase inspector)
        {
            MainMenu.Instance.SetPage(HomePage.Instance);

            if (m_activeInspector == inspector)
            {
                return;
            }

            UnsetInspectorTab();

            m_activeInspector = inspector;
            inspector.SetActive();

            OnSetInspectorTab(inspector);
        }
        public void OnSetInspectorTab(InspectorBase inspector)
        {
            Color activeColor = new Color(0, 0.25f, 0, 1);

            RuntimeProvider.Instance.SetColorBlock(inspector.m_tabButton, activeColor, activeColor);
        }