/// <summary>
        /// Fill in the UI style elements using the default KSP skin elements
        /// </summary>
        /// <param name="style"></param>
        private void processComponents(BasicStyle style)
        {
            if (style == null)
            {
                return;
            }

            UISkinDef skin = UISkinManager.defaultSkin;

            if (skin == null)
            {
                return;
            }

            switch (style.ElementType)
            {
            case BasicStyle.ElementTypes.Window:
                style.setImage(panelSprite, Image.Type.Sliced);
                break;

            case BasicStyle.ElementTypes.Box:
                style.setImage(windowSprite, Image.Type.Sliced);
                break;

            case BasicStyle.ElementTypes.Button:
                style.setButton(skin.button.normal.background, skin.button.highlight.background, skin.button.active.background, skin.button.disabled.background);
                break;

            case BasicStyle.ElementTypes.Toggle:
                style.setToggle(buttonSprite, null, null);
                break;

            case BasicStyle.ElementTypes.Slider:
                style.setSlider(skin.horizontalSlider.normal.background, skin.horizontalSliderThumb.normal.background, skin.horizontalSliderThumb.highlight.background, skin.horizontalSliderThumb.active.background, skin.horizontalSliderThumb.disabled.background);
                break;

            case BasicStyle.ElementTypes.Header:
                style.setImage(titleSprite, Image.Type.Sliced);
                break;

            case BasicStyle.ElementTypes.Footer:
                style.setImage(footerSprite, Image.Type.Sliced);
                break;

            case BasicStyle.ElementTypes.Content:
                style.setImage(componentSprite, Image.Type.Sliced);
                break;

            case BasicStyle.ElementTypes.ContentFooter:
                style.setImage(contentFooterSprite, Image.Type.Sliced);
                break;

            case BasicStyle.ElementTypes.ContentToggle:
                style.setToggle(componentSprite, selectedSprite, unselectedSprite);
                break;

            default:
                break;
            }
        }
Esempio n. 2
0
        /// <summary>
        /// Fill in the UI style elements using the default KSP skin elements
        /// </summary>
        /// <param name="style"></param>
        private void processComponents(BasicStyle style)
        {
            if (style == null)
            {
                return;
            }

            UISkinDef skin = UISkinManager.defaultSkin;

            if (skin == null)
            {
                return;
            }

            switch (style.ElementType)
            {
            case BasicStyle.ElementTypes.Window:
                style.setImage(skin.window.normal.background, Image.Type.Sliced);
                break;

            case BasicStyle.ElementTypes.Box:
                style.setImage(skin.box.normal.background, Image.Type.Sliced);
                break;

            case BasicStyle.ElementTypes.Button:
                style.setButton(skin.button.normal.background, skin.button.highlight.background, skin.button.active.background, skin.button.disabled.background);
                break;

            case BasicStyle.ElementTypes.Toggle:
                style.setToggle(skin.button.normal.background, skin.button.highlight.background, skin.button.active.background, skin.button.disabled.background);
                break;

            case BasicStyle.ElementTypes.Slider:
                style.setSlider(skin.horizontalSlider.normal.background, skin.horizontalSliderThumb.normal.background, skin.horizontalSliderThumb.highlight.background, skin.horizontalSliderThumb.active.background, skin.horizontalSliderThumb.disabled.background);
                break;

            default:
                break;
            }
        }