Exemple #1
0
        internal void UpdateGuidePage()
        {
            isPageImageLoaded = KSPTips.LoadImageFromFile(ref texPage, lstPages[CurrentPage].guide.Folder + "/" + lstPages[CurrentPage].Image, KSPTips.PathPluginGuideImages);

            if (ddlGuide.SelectedValue != lstPages[CurrentPage].guide.Title)
            {
                Int32 ddlIndex = ddlGuide.Items.IndexOf(lstPages[CurrentPage].guide.Title);
                ddlGuide.SelectedIndex = ddlIndex;
            }
        }
Exemple #2
0
        private void DrawWindow_Header_KeyboardMap()
        {
            //Flight or Build
            GUILayout.Label("Layout: ", styleTitle);
            BuildOrFlight = GUILayout.Toolbar(BuildOrFlight, new String[] { "Build Map", "Flight Map" }, styleButton);

            //LightOrDark
            GUILayout.Space(20);
            GUILayout.Label("Background: ", styleTitle);
            Int32 oldLorD = KSPTips.settings.LightOrDark;

            KSPTips.settings.LightOrDark = GUILayout.Toolbar(KSPTips.settings.LightOrDark, new String[] { "Light", "Dark" }, styleButton);
            if (oldLorD != KSPTips.settings.LightOrDark)
            {
                KSPTips.settings.Save();
            }

            //Zoom or not
            GUILayout.Space(20);
            GUILayout.Label("Zoom: ", styleTitle);
            Int32 oldZoom = KSPTips.settings.ZoomLevel;

            KSPTips.settings.ZoomLevel = GUILayout.Toolbar(KSPTips.settings.ZoomLevel, new String[] { "Scale", "Med", "High" }, styleButton);
            if (oldZoom != KSPTips.settings.ZoomLevel)
            {
                KSPTips.settings.Save();
            }

            String NewKeyboardMapTexture = "KeyboardLayout" +
                                           (BuildOrFlight == 0 ? "-Build" : "-Flight") +
                                           (KSPTips.settings.LightOrDark == 0 ? "" : "-Dark") +
                                           "_Hires.png";

            if (NewKeyboardMapTexture != KeyboardMapTexture)
            {
                KeyboardMapTexture = NewKeyboardMapTexture;

                if (!KSPTips.LoadImageFromFile(ref texKeyboardMap, "KeyboardMaps/" + KeyboardMapTexture, KSPTips.PathPluginGuideImages))
                {
                    LogFormatted("Unable to load Keyboard Map: {0}", KeyboardMapTexture);
                }
            }

            GUILayout.FlexibleSpace();
        }
Exemple #3
0
        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;
        }