Ejemplo n.º 1
0
        internal override void OnGUIOnceOnly()
        {
            //Lets get some skins together
            GUISkin skinCustom = SkinsLibrary.CopySkin(SkinsLibrary.DefSkinType.Unity);

            skinCustom.button = SkinsLibrary.DefKSPSkin.button;
            SkinsLibrary.AddSkin("CustomSkin", skinCustom);

            GUIStyle redButton = new GUIStyle(SkinsLibrary.DefKSPSkin.button);

            redButton.name             = "RedButton";
            redButton.normal.textColor = Color.red;
            redButton.hover.textColor  = Color.red;
            SkinsLibrary.AddStyle(SkinsLibrary.DefSkinType.KSP, redButton);
            SkinsLibrary.AddStyle("CustomSkin", redButton);

            redButton                  = new GUIStyle(SkinsLibrary.DefUnitySkin.button);
            redButton.name             = "RedButton";
            redButton.normal.textColor = Color.red;
            redButton.hover.textColor  = Color.red;
            SkinsLibrary.AddStyle(SkinsLibrary.DefSkinType.Unity, redButton);

            GUIStyle CustomTooltip = new GUIStyle();

            CustomTooltip.name             = "Tooltip";
            CustomTooltip.normal.textColor = Color.yellow;
            SkinsLibrary.AddStyle("CustomSkin", CustomTooltip);
        }
Ejemplo n.º 2
0
        protected override void OnGUI_FirstRun()
        {
            GUISkin skinCustom = SkinsLibrary.CopySkin("Unity");

            skinCustom.button = SkinsLibrary.DefKSPSkin.button;
            SkinsLibrary.AddSkin("CustomSkin", skinCustom);

            GUIStyle redButton = new GUIStyle(SkinsLibrary.DefKSPSkin.button);

            redButton.name             = "RedButton";
            redButton.normal.textColor = Color.red;
            redButton.hover.textColor  = Color.red;

            SkinsLibrary.AddStyle(redButton, "KSP");
            SkinsLibrary.AddStyle(redButton, "CustomSkin");

            redButton                  = new GUIStyle(SkinsLibrary.DefUnitySkin.button);
            redButton.name             = "RedButton";
            redButton.normal.textColor = Color.red;
            redButton.hover.textColor  = Color.red;
            //SkinsLibrary.AddStyle(redButton, SkinsLibrary.DefSkinType.Unity);
            SkinsLibrary.AddStyle(redButton, "Unity");

            GUIStyle CustomTooltip = new GUIStyle();

            CustomTooltip.name             = "Tooltip";
            CustomTooltip.normal.textColor = Color.yellow;
            SkinsLibrary.AddStyle(CustomTooltip, "CustomSkin");


            // let's try to manually fix VSlider and HScrollbar in KSP's skin
            var vs           = SkinsLibrary.DefKSPSkin.verticalSlider;
            var vst          = SkinsLibrary.DefKSPSkin.verticalSliderThumb;
            var hSlider      = SkinsLibrary.DefKSPSkin.horizontalSlider;
            var hSliderThumb = SkinsLibrary.DefKSPSkin.horizontalSliderThumb;

            vs.normal   = hSlider.normal;
            vs.border   = hSlider.border;
            vs.padding  = hSlider.padding;
            vs.margin   = hSlider.margin;
            vs.overflow = hSlider.overflow;

            vst.active        = hSliderThumb.active;
            vst.normal        = hSliderThumb.normal;
            vst.hover         = hSliderThumb.hover;
            vst.border        = hSliderThumb.border;
            vst.padding       = hSliderThumb.padding;
            vst.margin        = hSliderThumb.margin;
            vst.overflow      = hSliderThumb.overflow;
            vst.fixedWidth    = 12;
            vst.stretchWidth  = false;
            vst.fixedHeight   = 28.1975f;
            vst.stretchHeight = true;

            var hsb  = SkinsLibrary.DefKSPSkin.horizontalScrollbar;
            var hsbt = SkinsLibrary.DefKSPSkin.horizontalScrollbarThumb;

            hsb.normal   = hSlider.normal;
            hsb.border   = hSlider.border;
            hsb.padding  = hSlider.padding;
            hsb.margin   = hSlider.margin;
            hsb.overflow = hSlider.overflow;

            hsbt.active        = hSliderThumb.active;
            hsbt.normal        = hSliderThumb.normal;
            hsbt.hover         = hSliderThumb.hover;
            hsbt.border        = hSliderThumb.border;
            hsbt.padding       = hSliderThumb.padding;
            hsbt.margin        = hSliderThumb.margin;
            hsbt.overflow      = hSliderThumb.overflow;
            hsbt.fixedWidth    = 28.1975f;
            hsbt.stretchWidth  = true;
            hsbt.fixedHeight   = 12;
            hsbt.stretchHeight = false;

            var vsb  = SkinsLibrary.DefKSPSkin.verticalScrollbar;
            var vsbt = SkinsLibrary.DefKSPSkin.verticalScrollbarThumb;

            vsb.normal   = hSlider.normal;
            vsb.border   = hSlider.border;
            vsb.padding  = hSlider.padding;
            vsb.margin   = hSlider.margin;
            vsb.overflow = hSlider.overflow;

            vsbt.active        = hSliderThumb.active;
            vsbt.normal        = hSliderThumb.normal;
            vsbt.hover         = hSliderThumb.hover;
            vsbt.border        = hSliderThumb.border;
            vsbt.padding       = hSliderThumb.padding;
            vsbt.margin        = hSliderThumb.margin;
            vsbt.overflow      = hSliderThumb.overflow;
            vsbt.fixedWidth    = 12;
            vsbt.stretchWidth  = false;
            vsbt.fixedHeight   = 28.1975f;
            vsbt.stretchHeight = true;
        }
        /// <summary>
        /// This one creates the skins, adds em to the skins library and adds needed styles
        /// </summary>
        internal static void InitSkins()
        {
            //Default Skin
            GUISkin DefKSP = SkinsLibrary.CopySkin(SkinsLibrary.DefSkinType.KSP);

            DefKSP.window = stylePanel;
            DefKSP.font   = SkinsLibrary.DefUnitySkin.font;
            DefKSP.horizontalSlider.margin.top = 8;
            SkinsLibrary.AddSkin("Default", DefKSP);

            //Adjust Default Skins
            SkinsLibrary.List["Default"].button = new GUIStyle(styleButton);
            SkinsLibrary.List["Default"].label  = new GUIStyle(styleText);

            //Add Styles once skin is added
            SkinsLibrary.AddStyle("Default", styleTooltipStyle);
            SkinsLibrary.AddStyle("Default", styleButton);
            SkinsLibrary.AddStyle("Default", styleButtonMain);
            SkinsLibrary.AddStyle("Default", styleButtonSettings);
            SkinsLibrary.AddStyle("Default", styleButtonToggle);
            SkinsLibrary.AddStyle("Default", "DropDownButton", styleDropDownButton);
            SkinsLibrary.AddStyle("Default", "DropDownListBox", styleDropDownListBox);
            SkinsLibrary.AddStyle("Default", "DropDownListItem", styleDropDownListItem);

            //Now a Unity Style one
            GUISkin DefUnity = SkinsLibrary.CopySkin(SkinsLibrary.DefSkinType.Unity);

            DefUnity.window         = DefUnity.box;
            DefUnity.window.border  = new RectOffset(6, 6, 6, 6);
            DefUnity.window.padding = new RectOffset(8, 3, 7, 0);
            DefUnity.horizontalSlider.margin.top = 8;
            SkinsLibrary.AddSkin("Unity", DefUnity);

            //Adjust Default Skins
            SkinsLibrary.List["Unity"].button = new GUIStyle(styleButtonUnity);
            SkinsLibrary.List["Unity"].label  = new GUIStyle(styleText);

            //Add Styles once skin is added
            GUIStyle styleTooltipUnity = new GUIStyle(styleTooltipStyle);

            styleTooltipUnity.normal.background = GUI.skin.box.normal.background;
            styleTooltipUnity.normal.textColor  = Color.white;
            SkinsLibrary.AddStyle("Unity", styleTooltipUnity);
            SkinsLibrary.AddStyle("Unity", styleButtonUnity);
            SkinsLibrary.AddStyle("Unity", styleButtonMainUnity);
            SkinsLibrary.AddStyle("Unity", styleButtonSettingsUnity);
            SkinsLibrary.AddStyle("Unity", styleButtonToggleUnity);
            SkinsLibrary.AddStyle("Unity", "DropDownButton", styleDropDownButtonUnity);
            SkinsLibrary.AddStyle("Unity", "DropDownListBox", styleDropDownListBoxUnity);
            SkinsLibrary.AddStyle("Unity", "DropDownListItem", styleDropDownListItem);

            ////Now a Unity Style one with KSP buttons
            GUISkin UnityWKSPButtons = SkinsLibrary.CopySkin("Unity");

            UnityWKSPButtons.button = DefKSP.button;
            UnityWKSPButtons.toggle = DefKSP.toggle;
            SkinsLibrary.AddSkin("UnityWKSPButtons", UnityWKSPButtons);

            //Adjust Default Skins
            SkinsLibrary.List["UnityWKSPButtons"].button = new GUIStyle(styleButton);
            SkinsLibrary.List["UnityWKSPButtons"].label  = new GUIStyle(styleText);

            //Add Styles once skin is added
            SkinsLibrary.AddStyle("UnityWKSPButtons", styleTooltipUnity);
            SkinsLibrary.AddStyle("UnityWKSPButtons", styleButton);
            SkinsLibrary.AddStyle("UnityWKSPButtons", styleButtonMain);
            SkinsLibrary.AddStyle("UnityWKSPButtons", styleButtonSettings);
            SkinsLibrary.AddStyle("UnityWKSPButtons", styleButtonToggle);
            SkinsLibrary.AddStyle("UnityWKSPButtons", "DropDownButton", styleDropDownButton);
            SkinsLibrary.AddStyle("UnityWKSPButtons", "DropDownListBox", styleDropDownListBox);
            SkinsLibrary.AddStyle("UnityWKSPButtons", "DropDownListItem", styleDropDownListItem);
        }
Ejemplo n.º 4
0
        /// <summary>
        /// This one creates the skins, adds em to the skins library and adds needed styles
        /// </summary>
        internal static void InitSkins()
        {
            //Default Skin
            GUISkin DefKSP = SkinsLibrary.CopySkin(SkinsLibrary.DefSkinType.KSP);

            DefKSP.window = stylePanel;
            DefKSP.font   = SkinsLibrary.DefUnitySkin.font;
            DefKSP.horizontalSlider.margin.top = 8;
            SkinsLibrary.AddSkin("Default", DefKSP);

            //Adjust Default Skins
            SkinsLibrary.List["Default"].button = new GUIStyle(styleButton);
            SkinsLibrary.List["Default"].label  = new GUIStyle(styleText);

            //Add Styles once skin is added
            SkinsLibrary.AddStyle("Default", styleTooltipStyle);
            SkinsLibrary.AddStyle("Default", styleButton);
            SkinsLibrary.AddStyle("Default", styleButtonMain);
            SkinsLibrary.AddStyle("Default", styleButtonSettings);
            SkinsLibrary.AddStyle("Default", "DropDownButton", styleDropDownButton);
            SkinsLibrary.AddStyle("Default", "DropDownListBox", styleDropDownListBox);
            SkinsLibrary.AddStyle("Default", "DropDownListItem", styleDropDownListItem);

            SkinsLibrary.AddStyle("Default", "SafeText", textStyleSafe);
            SkinsLibrary.AddStyle("Default", "WarningText", textStyleWarning);
            SkinsLibrary.AddStyle("Default", "CriticalText", textStyleCritical);


            //Now a Unity Style one
            GUISkin DefUnity = SkinsLibrary.CopySkin(SkinsLibrary.DefSkinType.Unity);

            DefUnity.window         = DefUnity.box;
            DefUnity.window.border  = new RectOffset(6, 6, 6, 6);
            DefUnity.window.padding = new RectOffset(8, 3, 7, 0);
            DefUnity.horizontalSlider.margin.top = 8;
            SkinsLibrary.AddSkin("Unity", DefUnity);

            //Adjust Default Skins
            SkinsLibrary.List["Unity"].button = new GUIStyle(styleButtonUnity);
            SkinsLibrary.List["Unity"].label  = new GUIStyle(styleText);

            //Add Styles once skin is added
            GUIStyle styleTooltipUnity = new GUIStyle(styleTooltipStyle);

            styleTooltipUnity.normal.background = GUI.skin.box.normal.background;
            styleTooltipUnity.normal.textColor  = Color.white;
            SkinsLibrary.AddStyle("Unity", styleTooltipUnity);
            SkinsLibrary.AddStyle("Unity", styleButtonUnity);
            SkinsLibrary.AddStyle("Unity", styleButtonMainUnity);
            SkinsLibrary.AddStyle("Unity", styleButtonSettingsUnity);
            SkinsLibrary.AddStyle("Unity", "DropDownButton", styleDropDownButtonUnity);
            SkinsLibrary.AddStyle("Unity", "DropDownListBox", styleDropDownListBoxUnity);
            SkinsLibrary.AddStyle("Unity", "DropDownListItem", styleDropDownListItem);

            SkinsLibrary.AddStyle("Unity", "SafeText", textStyleSafe);
            SkinsLibrary.AddStyle("Unity", "WarningText", textStyleWarning);
            SkinsLibrary.AddStyle("Unity", "CriticalText", textStyleCritical);

            // Solarized Dark theme
            // http://ethanschoonover.com/solarized
            GUISkin solarizedDarkSkin = SkinsLibrary.CopySkin("Unity");

            solarizedDarkSkin.window         = stylePanelSolarizedDark;
            solarizedDarkSkin.label.fontSize = 11;
            SkinsLibrary.AddSkin("SolarizedDark", solarizedDarkSkin);
            SkinsLibrary.AddStyle("SolarizedDark", "HUD", stylePanelSolarizedDarkHUD);
            SkinsLibrary.AddStyle("SolarizedDark", "Tooltip", styleTooltipRequirementsSolarizedDark);
            SkinsLibrary.AddStyle("SolarizedDark", "DropDownButton", styleDropDownButtonUnity);
            SkinsLibrary.AddStyle("SolarizedDark", "DropDownListBox", styleDropDownListBoxUnity);
            SkinsLibrary.AddStyle("SolarizedDark", "DropDownListItem", styleDropDownListItem);

            // Editor window is based on Kerbal Engineer's editor window to provide a more harmonious looks (because *I* use KER)
            GUISkin testFlightEditor = SkinsLibrary.CopySkin("Unity");

            testFlightEditor.window         = styleEditorPanel;
            testFlightEditor.label.fontSize = 11;
            testFlightEditor.label          = styleEditorText;
            SkinsLibrary.AddSkin("TestFlightEditor", testFlightEditor);
        }