Esempio n. 1
0
        private bool RefreshStockButton()
        {
            bool result = false;

            //print("###RefreshStockButton");

            if (useStockToolBar)
            {
                //print("###RefreshStockButton, using stock tb");
                StockToolbar stb = (StockToolbar)StockToolbar.FindObjectOfType(typeof(StockToolbar));
                if (stb != null)
                {
                    //print("###RefreshStockButton, got stock tb");
                    result           = true;
                    stb.ButtonNeeded = true;
                    stb.CreateButton();
                    //print("###RefreshStockButton: stb.CreateButton() called, result " + stb.ButtonNeeded.ToString());
                    if (!stb.ButtonNeeded)
                    {
                        result           = false;
                        windowPos.height = 20;
                        lostToStaging    = true;
                        //print("###RefreshStockButton, set lostToStaging = true");
                    }
                }
            }

            return(result);
        }
Esempio n. 2
0
        private bool NeedsStockButton()
        {
            bool result = false;

            if (useStockToolBar)
            {
                StockToolbar stb = (StockToolbar)StockToolbar.FindObjectOfType(typeof(StockToolbar));
                if (stb != null)
                {
                    result = stb.ButtonNeeded;
                }
            }

            return(result);
        }
Esempio n. 3
0
        // show settings buttons / fields
        private void ShowSettings()
        {
            if (UseToolbar && toolbarShowSettings)
            {
                GUILayout.BeginHorizontal(GUILayout.Width(fixedwidth - margin));
                styleButton.normal.textColor = Color.white;
                if (GUILayout.Button("Remove " + ActiveVessel.mainBody.name + " biomes from list", styleButton, GUILayout.ExpandWidth(true)))
                {
                    RemoveCurrentBody();
                }
                GUILayout.EndHorizontal();

                // de-warp
                GUILayout.BeginHorizontal(GUILayout.Width(fixedwidth - margin));
                deWarp = GUILayout.Toggle(deWarp, " De-warp", styleToggle, null);

                //show hist
                bool oldShowHistory = showHistory;
                showHistory = GUILayout.Toggle(showHistory, " Show recent", styleToggle, null);
                GUILayout.EndHorizontal();

                // use altitude
                GUILayout.BeginHorizontal(GUILayout.Width(fixedwidth - margin));
                includeAlt = GUILayout.Toggle(includeAlt, " Altitude", styleToggle, null);

                // show description
                bool oldShowDescription = showDescription;
                showDescription = GUILayout.Toggle(showDescription, " Description", styleToggle, null);
                GUILayout.EndHorizontal();
                if (showDescription != oldShowDescription || oldShowHistory != showHistory)
                {
                    sizechange = true;
                }

                styleButton.normal.textColor = styleButton.focused.textColor = styleButton.hover.textColor = styleButton.active.textColor = systemOn ? Color.red: Color.green;
                styleValue.normal.textColor  = Color.white;

                // On / Off switch
                GUILayout.BeginHorizontal(GUILayout.Width(fixedwidth - margin));
                GUILayout.Label("Biomatic ", styleValue);
                styleValue.normal.textColor = systemOn ? Color.green: Color.red;
                GUILayout.Label(systemOn ? "ON ": "OFF ", styleValue);
                if (GUILayout.Button(systemOn ? "Switch off": "Switch on", styleButton, GUILayout.ExpandWidth(true)))
                {
                    systemOn = !systemOn;
                    if (!useStockToolBar)
                    {
                        RefreshBlizzyButton();
                    }
                    else
                    {
                        // here be twiddles
                        //RefreshStockButton();
                        //print("###ShowSettings, toggling on off");
                        StockToolbar stb = (StockToolbar)StockToolbar.FindObjectOfType(typeof(StockToolbar));
                        if (stb != null)
                        {
                            stb.RefreshButtonTexture();
                        }
                    }

                    sizechange = true;
                }
                GUILayout.EndHorizontal();

                styleValue.normal.textColor  = styleValue.focused.textColor = styleValue.hover.textColor = styleValue.active.textColor = Color.white;
                styleButton.normal.textColor = styleButton.focused.textColor = styleButton.hover.textColor = styleButton.active.textColor = Color.white;
            }
        }