Exemplo n.º 1
0
        private void OnGUI()
        {
            // GUI.skin = HighLogic.Skin;
            if (!fontInitted)
            {
                boldLabelFont           = new GUIStyle(GUI.skin.label);
                boldLabelFont.fontStyle = FontStyle.Bold;

                horizOffset = GUI.skin.horizontalSlider.padding;
                // horizOffset.top += 5;
                fontInitted = true;
            }
            if (_toggleOn)
            {
                if (Event.current.type == EventType.Layout)
                {
                    _windowPosition.height = 100;
                    _windowPosition.width  = 425;
                }

                if (drawTooltip /* && HighLogic.CurrentGame.Parameters.CustomParams<JanitorsClosetSettings>().buttonTooltip*/ && tooltip != null && tooltip.Trim().Length > 0)
                {
                    SetupTooltip();
                    ClickThruBlocker.GUIWindow(1234, tooltipRect, TooltipWindow, "");
                }


                _windowPosition = ClickThruBlocker.GUILayoutWindow(_windowId, _windowPosition, RenderWindowContent, "Fill It Up", _windowStyle);
            }
        }
Exemplo n.º 2
0
        public void OnGUI()
        {
            if (windowStyle == null)
            {
                GUI.color   = Color.grey;
                windowStyle = new GUIStyle(HighLogic.Skin.window);
                windowStyle.active.background = windowStyle.normal.background;
                Texture2D tex    = windowStyle.normal.background;
                var       pixels = tex.GetPixels32();

                for (int i = 0; i < pixels.Length; ++i)
                {
                    pixels[i].a = 255;
                }

                tex.SetPixels32(pixels); tex.Apply();
                windowStyle.active.background         =
                    windowStyle.focused.background    =
                        windowStyle.normal.background = tex;
            }

            if (!showHelp)
            {
                return;
            }
            introWindow = ClickThruBlocker.GUILayoutWindow(introWindowId, introWindow, IntroWindow, "Toolbar Controller Intro", windowStyle);
            if (automoved < 2)
            {
                introWindow.x = (Screen.width - introWindow.width) / 2;
                introWindow.y = (Screen.height - introWindow.height) / 2;

                automoved++;
            }
        }
Exemplo n.º 3
0
 /// <summary>
 /// Styled window
 /// </summary>
 /// <param name="id">Identifier.</param>
 /// <param name="screenRect">Screen rect.</param>
 /// <param name="func">Func.</param>
 /// <param name="title">Title.</param>
 /// <param name="options">Options.</param>
 public static Rect Window(int id, Rect screenRect, GUI.WindowFunction func, string title, params GUILayoutOption[] options)
 {
     // Fix rect width and height not being integers to avoid blurry font rendering
     screenRect.width  = (float)Math.Floor(screenRect.width);
     screenRect.height = (float)Math.Floor(screenRect.height);
     return(ClickThruBlocker.GUILayoutWindow(id, screenRect, func, title, Styles.window, options));
 }
Exemplo n.º 4
0
        void OnGUI()
        {
            if (!GUIEnabled)
            {
                return;
            }
            if (!initted)
            {
                InitGUIStuff();
            }
            if (windowStyle == null)
            {
                GUI.color   = Color.grey;
                windowStyle = new GUIStyle(HighLogic.Skin.window);
                windowStyle.active.background = windowStyle.normal.background;
                Texture2D tex    = windowStyle.normal.background;
                var       pixels = tex.GetPixels32();

                for (int i = 0; i < pixels.Length; ++i)
                {
                    pixels[i].a = 255;
                }

                tex.SetPixels32(pixels); tex.Apply();
                windowStyle.active.background         =
                    windowStyle.focused.background    =
                        windowStyle.normal.background = tex;
            }
            WindowRect = ClickThruBlocker.GUILayoutWindow(4946386, WindowRect, DoWindow, "Toolbar Controller", windowStyle);
        }
 public void draw()
 {
     if (windowShown)
     {
         windowPosition = ClickThruBlocker.GUILayoutWindow(baseWindowID, windowPosition, drawWindow, "Civilian Population UI");
     }
 }
Exemplo n.º 6
0
        public void drawGUI()
        {
            if (HideFMRSUI)
            {
                return;
            }
            if (!skin_init)
            {
                init_skin();
            }
            GUI.skin = HighLogic.Skin;

            if (main_ui_active)
            {
                windowPos   = GUILayout.Window(baseWindowID + 1, windowPos, MainGUI, "FMRS " /* + mod_vers */, GUILayout.MinWidth(100));
                windowPos.x = Mathf.Clamp(windowPos.x, 0, Screen.width - windowPos.width);
                windowPos.y = Mathf.Clamp(windowPos.y, 0, Screen.height - windowPos.height);

#if BETA && !DEBUG //**************************
                beta_windowPos.x = windowPos.x;
                beta_windowPos.y = windowPos.y + windowPos.height;
                beta_windowPos   = ClickThruBlocker.GUILayoutWindow(baseWindowID = 3, beta_windowPos, BetaGUI, "FMRS Beta");
#endif //**************************
            }

#if DEBUG //**************************
            if (main_ui_active)
            {
                debug_windowPos.x = windowPos.x;
                debug_windowPos.y = windowPos.y + windowPos.height;
                debug_windowPos   = GUILayout.Window(baseWindowID + 2, debug_windowPos, DebugGUI, "FMRS Debug Info");
            }
#endif //**************************
        }
Exemplo n.º 7
0
 void OnGUI()
 {
     if (isVisible)
     {
         winRect = ClickThruBlocker.GUILayoutWindow(12342312, winRect, DisplayWin, "Vessel Notes & Logs");
     }
 }
 public void OnGUI()
 {
     planetWin.height = GraphWindow.wnd_rect.height;
     planetWin.x      = GraphWindow.wnd_rect.x + GraphWindow.wnd_rect.width;
     planetWin.y      = GraphWindow.wnd_rect.y;
     ClickThruBlocker.GUILayoutWindow(565949, planetWin, planetSelWin, "Planetary Body Selection", winStyle);
 }
        /// <summary>
        /// This is the Code that draws the window and sets the skin
        /// !!!! You have to set the skin before drawing the window or you will scratch your head for ever
        /// </summary>
        private void DrawGUI()
        {
            //this sets the skin on each draw loop
            GUI.skin = SkinsLibrary.CurrentSkin;

            //keep the window locked to the screen if its supposed to be
            if (ClampToScreen)
            {
                WindowRect = WindowRect.ClampToScreen(ClampToScreenOffset);
            }

            //Are we using a custom style of the skin style for the window
            if (WindowStyle == null)
            {
                WindowRect = ClickThruBlocker.GUILayoutWindow(WindowID, WindowRect, DrawWindowInternal, WindowCaption, WindowOptions);
            }
            else
            {
                WindowRect = ClickThruBlocker.GUILayoutWindow(WindowID, WindowRect, DrawWindowInternal, WindowCaption, WindowStyle, WindowOptions);
            }

            //Draw the tooltip of its there to be drawn
            if (TooltipsEnabled)
            {
                DrawToolTip();
            }
        }
Exemplo n.º 10
0
        void OnGUI()
        {
            if (HighLogic.CurrentGame == null)
            {
                return;
            }
            if (!HighLogic.CurrentGame.Parameters.CustomParams <Big_Ben>().useAlternateSkin)
            {
                GUI.skin = HighLogic.Skin;
            }
            if (!initted)
            {
                labelTextColor           = new GUIStyle("Label");
                labelTextColor.fontStyle = FontStyle.Bold;
                //labelTextColor.fontSize++;
                origTextColor       = labelTextColor.normal.textColor;
                origBackgroundColor = GUI.backgroundColor;


                initted = true;
            }
            if (visible)
            {
                posBigBenWindow = ClickThruBlocker.GUILayoutWindow(56783457, posBigBenWindow, DrawList, "Big Ben",
                                                                   GUILayout.Width(WIDTH), GUILayout.MinHeight(MIN_HEIGHT), GUILayout.MaxHeight(MAX_HEIGHT));
            }
        }
Exemplo n.º 11
0
        public void OnGUI()
        {
            if (HighLogic.LoadedSceneIsEditor)
            {
                return;
            }
            if (ToolbarInterface.Visible)
            {
                if (!HighLogic.CurrentGame.Parameters.CustomParams <OD3>().useAltSkin)
                {
                    GUI.skin = HighLogic.Skin;
                }
                MainwindowPosition = ClickThruBlocker.GUILayoutWindow(id, MainwindowPosition, MainWindow, "Orbital Decay Manager", windowStyle);
            }
            if (ToolbarInterface.DecayBreakdownVisible)
            {
                if (ToolbarInterface.Visible && (!DecayBreakdownwindowPositionInitted || HighLogic.CurrentGame.Parameters.CustomParams <OD3>().snapBreakdownWindow))
                {
                    DecayBreakdownwindowPosition.x      = MainwindowPosition.x + MainwindowPosition.width;
                    DecayBreakdownwindowPosition.y      = MainwindowPosition.y;
                    DecayBreakdownwindowPositionInitted = true;
                }
                DecayBreakdownwindowPosition = ClickThruBlocker.GUILayoutWindow(8989, DecayBreakdownwindowPosition, DecayBreakdownWindow, "Orbital Decay Breakdown Display", windowStyle);
            }

            /*
             * if (NBodyBreakdownVisible)
             * {
             *  NBodyManagerwindowPosition = ClickThruBlocker.GUILayoutWindow(8988, NBodyManagerwindowPosition, NBodyManagerWindow, "Orbital Decay N-Body Manager", windowStyle);
             * }
             */
        }
Exemplo n.º 12
0
        //Unity GUI loop
        void OnGUI()
        {
            if (drawTooltip && HighLogic.CurrentGame.Parameters.CustomParams <JanitorsClosetSettings>().buttonTooltip&& tooltip != null && tooltip.Trim().Length > 0)
            {
                SetupTooltip();
                GUI.Window(1234, tooltipRect, TooltipWindow, "");
            }

            //DrawTooltip();
            //Log.Info("Scene: " + HighLogic.LoadedScene.ToString());
            if ((_showPruneMenu == ShowMenuState.starting) || (_showPruneMenu == ShowMenuState.visible && _pruneMenuRect.Contains(Event.current.mousePosition)))
            {
                _pruneMenuRect = KSPUtil.ClampRectToScreen(ClickThruBlocker.GUILayoutWindow(pruneMenuID, _pruneMenuRect, _windowFunction, "Blocker Menu"));
            }
            else
            if (_showPruneMenu != ShowMenuState.hidden)
            {
                HidePruneMenu();
            }

            OnGUIToolbar();

            if (HighLogic.LoadedSceneIsEditor && (_showMenu || _menuRect.Contains(Event.current.mousePosition) || (Time.fixedTime - lastTimeShown < 0.5f)))
            {
                _menuRect = ClickThruBlocker.GUILayoutWindow(menuContentID, _menuRect, MenuContent, "Janitor's Closet");
            }
            else
            {
                _menuRect = new Rect();
            }
        }
            public static void DrawGUI()
            {
                if (popupOwner == null || rect.height == 0 || !popupActive)
                {
                    return;
                }

                // Make sure the rectangle is fully on screen
                rect.x = Math.Max(0, Math.Min(rect.x, Screen.width - rect.width));
                rect.y = Math.Max(0, Math.Min(rect.y, Screen.height - rect.height));

                rect = ClickThruBlocker.GUILayoutWindow(id, rect, identifier =>
                {
                    selectedItem = GUILayout.SelectionGrid(-1, entries, 1, YellowOnHover);
                    if (GUI.changed)
                    {
                        popupActive = false;
                    }
                }, "", style);

                //Cancel the popup if we click outside
                if (Event.current.type == EventType.MouseDown && !rect.Contains(Event.current.mousePosition))
                {
                    popupOwner = null;
                }
            }
Exemplo n.º 14
0
 private void OnGUI()
 {
     if (visible)
     {
         windowPosition = ClickThruBlocker.GUILayoutWindow(10, windowPosition, OnWindow, "Danger Alerts");
     }
 }
Exemplo n.º 15
0
 public void OnGUI()
 {
     if (_maneuverShow && !_hidden)
     {
         if (KartographSettings.Instance.UseKspSkin)
         {
             GUI.skin = HighLogic.Skin;
         }
         if (_maneuverShow && IsUsable())
         {
             _windowPos = ClickThruBlocker.GUILayoutWindow(_winID, _windowPos, OnWindow, "Maneuver Editor");
             if (_stored.Count > 0)
             {
                 _savedPos.x = _windowPos.x + _windowPos.width + 10.0f;
                 _savedPos.y = _windowPos.y;
                 _savedPos   = ClickThruBlocker.GUILayoutWindow(_savedWinID, _savedPos, SavedWindow, "Saved Maneuvers");
             }
         }
         if (_windowPos.Contains(Event.current.mousePosition) | _savedPos.Contains(Event.current.mousePosition))
         {
             ControlLock();
         }
         else
         {
             ControlUnlock();
         }
     }
 }
Exemplo n.º 16
0
 public void OnGUI()
 {
     if (GUI.showGui)
     {
         GUI.windowPosition = ClickThruBlocker.GUILayoutWindow(winId, GUI.windowPosition, OnWindow, "", GUI.windowStyle);
     }
 }
Exemplo n.º 17
0
 internal void draw()
 {
     if (showWindow)
     {
         windowRect = ClickThruBlocker.GUILayoutWindow(windowId, windowRect, drawWindow, "");
     }
 }
Exemplo n.º 18
0
        void OnGUI()
        {
            if (!guiHasStarted)
            {
                OnGUIStarter();
            }
            if (!hasStarted && (showActiveConnectWindow || showSelectCircleTypeWindow))
            {
                rectNotStartedWindow = ClickThruBlocker.GUILayoutWindow(485768, rectNotStartedWindow, NotStartedWindow, Localizer.Format("#autoLOC_AH_0001"));
                return;
            }
            if (showActiveConnectWindow)
            {
                rectActiveConnectWindow = ClickThruBlocker.GUILayoutWindow(434324, rectActiveConnectWindow, ActiveConnectWindow, Localizer.Format("#autoLOC_AH_0001"));
            }
            if (showSelectCircleTypeWindow)
            {
                rectSelectCircleTypeWindow = ClickThruBlocker.GUILayoutWindow(647886, rectSelectCircleTypeWindow, SelectCircleTypeWindow, Localizer.Format("#autoLOC_AH_0052"));
            }
            if (showPotentialRelaysWindow)
            {
                rectPotentialRelaysWindow.position = new Vector2(
                    rectActiveConnectWindow.position.x,
                    rectActiveConnectWindow.position.y + rectActiveConnectWindow.size.y);

                rectPotentialRelaysWindow = ClickThruBlocker.GUILayoutWindow(307428, rectPotentialRelaysWindow, PotentialRelaysWindow, Localizer.Format("#autoLOC_AH_0053"));
            }
            if (showLinkDetailWindow)
            {
                rectLinkDetailWindow.position = rectActiveConnectWindow.position - linkDetailPosOffset;
                rectLinkDetailWindow          = ClickThruBlocker.GUILayoutWindow(675752, rectLinkDetailWindow, LinkDetailWindow, Localizer.Format("#autoLOC_AH_0054", new string[] { selectedLink ["aName"], selectedLink ["bName"] }));
            }
        }
Exemplo n.º 19
0
        public void displayWindows()
        {
            if (uiActive)
            {
                checkWinBounds();
                if (useSmokeSkin)
                {
                    GUI.skin = UnityEngine.GUI.skin;
                }
                else
                {
                    GUI.skin = HighLogic.Skin;
                }

                if (am_max > 0)
                {
                    mainWin = ClickThruBlocker.GUILayoutWindow(MAINWINID, mainWin, drawFusebox, "Fusebox", GUILayout.ExpandWidth(true), GUILayout.ExpandHeight(true));

                    if (showFilters)
                    {
                        filterWin = ClickThruBlocker.GUILayoutWindow(FILTWINID, filterWin, drawFilters, "Filters", GUILayout.ExpandWidth(true), GUILayout.ExpandHeight(true));
                    }

                    if (showSettings)
                    {
                        setWin = ClickThruBlocker.GUILayoutWindow(SETWINID, setWin, drawSettings, "Settings", GUILayout.ExpandWidth(true), GUILayout.ExpandHeight(true));
                    }

                    if (showDarkTime)
                    {
                        drkWin = ClickThruBlocker.GUILayoutWindow(DRKWINID, drkWin, drawDark, "Darkness Time", GUILayout.ExpandWidth(true), GUILayout.ExpandHeight(true));
                        if (pickBod)
                        {
                            GUIStyle listStyle = new GUIStyle(GUI.skin.label);
                            listStyle.fontStyle            = FSGlobal;
                            listStyle.normal.textColor     = OtherCol;
                            listStyle.hover.textColor      = Color.yellow;
                            listStyle.onHover.background   =
                                listStyle.hover.background = new Texture2D(2, 2);
                            listStyle.padding.top          = 1;
                            listStyle.padding.bottom       = 1;

                            pickShow = true;
                            pickBod  = !Popup.List(popupWin, ref pickShow, ref pickedBodIdx, new GUIContent("Pick Body"), allBodNames, "button", "box", listStyle);
                            if (allBodNames[pickedBodIdx] != pickedBod)
                            {
                                pickedBod = allBodNames[pickedBodIdx];
                            }
                        }
                    }
                }
            }
            else
            {
                if (mainWin.height > mainHeight)
                {
                    mainWin.height = mainHeight;
                }
            }
        }
Exemplo n.º 20
0
        protected virtual void DrawWindow()
        {
            if (visible)
            {
                bool paused = false;
                if (HideWhenPaused && HighLogic.LoadedSceneIsFlight)
                {
                    try
                    {
                        paused = PauseMenu.isOpen || FlightResultsDialog.isDisplaying;
                    }
                    catch (Exception)
                    {
                        // ignore the error and assume the pause menu is not open
                    }
                }

                if (!paused)
                {
                    GUI.skin = HighLogic.Skin;
                    ConfigureStyles();

                    windowPos = Utilities.EnsureVisible(windowPos);
                    windowPos = ClickThruBlocker.GUILayoutWindow(windowId, windowPos, PreDrawWindowContents, windowTitle, GUILayout.ExpandWidth(true),
                                                                 GUILayout.ExpandHeight(true), GUILayout.MinWidth(64), GUILayout.MinHeight(64));
                }
            }
        }
 private void ShowNavigationWindow()
 {
     if (selectedWaypoint != null)
     {
         GUI.skin  = HighLogic.Skin;
         windowPos = ClickThruBlocker.GUILayoutWindow(10, windowPos, NavigationWindow, waypointName, GUILayout.MinWidth(224));
     }
 }
Exemplo n.º 22
0
 private void OnGUI()
 {
     if (HighLogic.LoadedSceneIsEditor && isVisible)
     {
         GUI.skin = HighLogic.Skin;
         winRect  = ClickThruBlocker.GUILayoutWindow(456789764, winRect, Window, "Part Information");
     }
 }
Exemplo n.º 23
0
 internal static void DrawSetKey()
 {
     if (setKey == Key.None)
     {
         return;
     }
     RectSetKey = ClickThruBlocker.GUILayoutWindow(1545156, RectSetKey, DrawSetKey, Localizer.Format("quickstart_setKey", GetText(setKey)), GUILayout.ExpandHeight(true));
 }
 void OnGUI()
 {
     GUI.skin = HighLogic.Skin;
     if (visible)
     {
         windowPosition = ClickThruBlocker.GUILayoutWindow(baseWindowID, windowPosition, DrawWindow, "NavBall Texture Changer");
     }
 }
 internal void draw()
 {
     if (showWindow)
     {
         GUI.skin   = modStyle.skin;
         windowRect = ClickThruBlocker.GUILayoutWindow(windowId, windowRect, drawWindow, "");
     }
 }
Exemplo n.º 26
0
 internal void OnGUI()
 {
     if (WindowSettings)
     {
         GUI.skin     = HighLogic.Skin;
         RectSettings = ClickThruBlocker.GUILayoutWindow(1584653, RectSettings, DrawSettings, RegisterToolbar.MOD + " " + RegisterToolbar.VERSION, GUILayout.ExpandHeight(true));
     }
 }
Exemplo n.º 27
0
 void OnGUI()
 {
     GUI.skin = HighLogic.Skin;
     if (windowShown)
     {
         windowPosition = ClickThruBlocker.GUILayoutWindow(baseWindowID, windowPosition, drawWindow, "4kSP");
     }
 }
Exemplo n.º 28
0
 public void DrawGUI(Transform transform)
 {
     if (transform != null)
     {
         currentTransform = transform;
         inspectorRect    = ClickThruBlocker.GUILayoutWindow(inspectorID, inspectorRect, InspectorWindow, "Inspector: " + transform.gameObject.name, HighLogic.Skin.window);
     }
 }
 void OnGUI()
 {
     if (Event.current.type == EventType.Layout)
     {
         //_windowRect.yMax = _windowRect.yMin;
         _windowRect = ClickThruBlocker.GUILayoutWindow(this.GetInstanceID(), _windowRect, WindowContent, _windowTitle);
     }
 }
Exemplo n.º 30
0
        private void Display()
        {
            string step = string.Empty;

            try
            {
                step = "0 - Start";
                if ( /* (HighLogic.LoadedScene == GameScenes.SPACECENTER || HighLogic.LoadedSceneIsFlight) && */
                    ShowUi && !Utils.IsPauseMenuOpen())
                {
                    step = "2 - Can show settings window - true";
                    if (WindowSettings.showWindow)
                    {
                        step = "3 - Show settings window";
                        WindowSettings.position = ClickThruBlocker.GUILayoutWindow(settingsID, WindowSettings.position, WindowSettings.Display, WindowSettings.title, GUILayout.MinHeight(20));
                    }
                    else
                    {
                        step = "3 - Hide settings window";
                        WindowSettings.showWindow = false;
                    }
                }
                else
                {
                    step = "2 - Can show settings window - false";
                }

#if false
                step = "1 - Show Interface";
                if (Utils.CanShowSkylab())
                {
                    step = "4 - Can show Skylab window - true";
                    if (WindowSkylab.showWindow)
                    {
                        step = "5 - Show Skylab window";
                        WindowSkylab.position = ClickThruBlocker.GUILayoutWindow(windowSkylabID, WindowSkylab.position, WindowSkylab.Display, WindowSkylab.title, GUILayout.MinHeight(20));
                    }
                    else
                    {
                        step = "5 - Hide Skylab window";
                        WindowSkylab.showWindow = false;
                    }
                }
                else
                {
                    step = "4 - Can show Skylab window - false";
                }
#endif
            }
            catch (Exception ex)
            {
                if (!FrameErrTripped)
                {
                    Log.Error($"Addon.Display at or near step: {step}. Error: {ex.Message}\r\n\r\n{ex.StackTrace}");
                    FrameErrTripped = true;
                }
            }
        }