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); }
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); }
internal override void OnGUIOnceOnly() { styleButton = new GUIStyle(HighLogic.Skin.button); styleButton.fontSize = 14; styleButton.padding.top = 2; styleButton.padding.bottom = -2; styleButton.normal.textColor = Color.white; WindowStyle = new GUIStyle(); WindowStyle.normal.background = mbTip.texBox; //Extra border to prevent bleed of color - actual border is only 1 pixel wide WindowStyle.border = new RectOffset(3, 3, 3, 3); styleTitle = new GUIStyle(HighLogic.Skin.label); styleTitle.fontStyle = FontStyle.Bold; styleTitle.normal.textColor = Color.white; styleTitle.fontSize = 14; styleTitle.padding.top = 3; styleTitle.padding.bottom = 4; stylePageNums = new GUIStyle(HighLogic.Skin.label); stylePageNums.normal.textColor = Color.white; stylePageNums.fontSize = 12; stylePageNums.padding.top = 4; stylePageNums.padding.bottom = 0; styleToggle = new GUIStyle(HighLogic.Skin.toggle); styleToggle.normal.textColor = Color.white; styleToggle.fontSize = 12; styleToggle.padding.top = 4; styleToggle.padding.bottom = 4; stylePage = new GUIStyle(); //stylePage.fixedWidth = mbTip.debugwin.intTest1; //stylePage.fixedHeight = mbTip.debugwin.intTest2;// stylePage.fixedWidth * 2 / 3 - 1; stylePage.padding.left = 1; stylePage.padding.right = -1; stylePage.padding.top = -1; stylePage.padding.bottom = 1; styleKeyMapTex = new GUIStyle(stylePage); styleKeyMapTex.fixedWidth = 2560; styleKeyMapTex.fixedHeight = 1810; styleDropDownGlyph = new GUIStyle(); styleDropDownGlyph.alignment = TextAnchor.MiddleCenter; styleSeparatorV = new GUIStyle(); Texture2D texDrop = new Texture2D(10, 10, TextureFormat.ARGB32, false), texSep = new Texture2D(2, 16, TextureFormat.ARGB32, false); KSPTips.ExtractToTexture(ref texDrop, "img_DropDown"); KSPTips.ExtractToTexture(ref texSep, "img_SeparatorVertical"); styleSeparatorV.normal.background = texSep; styleSeparatorV.border = new RectOffset(0, 0, 6, 6); styleSeparatorV.fixedWidth = 2; ddlManager.DropDownGlyphs = new GUIContentWithStyle(texDrop, styleDropDownGlyph); ddlManager.DropDownSeparators = new GUIContentWithStyle("", styleSeparatorV); styleDropDownButton = new GUIStyle(styleButton); styleDropDownButton.alignment = TextAnchor.MiddleLeft; styleDropDownButton.padding.right = 26; styleDropDownButton.padding.left = 10; styleDropDownButton.fixedWidth = 245; ddlGuide.styleButton = styleDropDownButton; styleDropDownWindowButton = new GUIStyle(styleDropDownButton); styleDropDownWindowButton.fixedWidth = 125; ddlWindowDisplay.styleButton = styleDropDownWindowButton; styleDropDownListBox = new GUIStyle(); styleDropDownListBox.normal.background = mbTip.texBox; //Extra border to prevent bleed of color - actual border is only 1 pixel wide styleDropDownListBox.border = new RectOffset(3, 3, 3, 3); ddlGuide.styleListBox = styleDropDownListBox; ddlWindowDisplay.styleListBox = styleDropDownListBox; styleDropDownListItem = new GUIStyle(); styleDropDownListItem.normal.textColor = new Color(207, 207, 207); Texture2D texBack = CreateColorPixel(new Color(207, 207, 207)); styleDropDownListItem.hover.background = texBack; styleDropDownListItem.onHover.background = texBack; styleDropDownListItem.hover.textColor = Color.black; styleDropDownListItem.onHover.textColor = Color.black; styleDropDownListItem.padding = new RectOffset(4, 4, 3, 4); ddlGuide.styleListItem = styleDropDownListItem; ddlWindowDisplay.styleListItem = styleDropDownListItem; SkinsLibrary.AddStyle("Default", "DropDownButton", styleDropDownButton); SkinsLibrary.AddStyle("Default", "DropDownListBox", styleDropDownListBox); SkinsLibrary.AddStyle("Default", "DropDownListItem", styleDropDownListItem); SetPageSize(); WindowRect.x = (Screen.width - WindowRect.width) / 2; WindowRect.y = (Screen.height - WindowRect.height) / 2; }
/// <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); }