示例#1
0
        internal void AddTab(ModTab cat, Type customControl, UITextureAtlas atlas, string fgTexture, string tooltip, PropertyChangedEventHandler <bool> onVisibilityChanged, float?width = null)
        {
            if (m_StripMain.Find <UIComponent>(cat.ToString()) != null)
            {
                return;
            }

            UIButton superTab = CreateTabTemplate();

            superTab.atlas                = atlas;
            superTab.normalFgSprite       = fgTexture;
            superTab.color                = Color.gray;
            superTab.focusedColor         = Color.white;
            superTab.hoveredColor         = Color.white;
            superTab.disabledColor        = Color.black;
            superTab.playAudioEvents      = true;
            superTab.tooltip              = tooltip;
            superTab.foregroundSpriteMode = UIForegroundSpriteMode.Stretch;

            KlyteUtils.createUIElement(out UIPanel content, null);
            content.name = "Container";
            content.area = new Vector4(0, 0, width ?? mainPanel.width, mainPanel.height);

            m_StripMain.AddTab(cat.ToString(), superTab.gameObject, content.gameObject, customControl);

            content.eventVisibilityChanged += onVisibilityChanged;
        }
示例#2
0
 public void OpenAt(ModTab cat)
 {
     m_StripMain.selectedIndex = m_StripMain.Find <UIComponent>(cat.ToString())?.zOrder ?? -1;
     KlyteCommonsMod.OpenKCPanel();
 }