Exemplo n.º 1
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.º 2
0
 private void OnGUI()
 {
     if (Visible)
     {
         windowPos = ClickThruBlocker.GUIWindow(windowID, windowPos, windowFunc, windowTitle, windowStyle);
     }
 }
Exemplo n.º 3
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();
            }
        }
Exemplo n.º 4
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.º 5
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);
            }
        }
 public void draw()
 {
     if (windowShown)
     {
         windowPosition = ClickThruBlocker.GUILayoutWindow(baseWindowID, windowPosition, drawWindow, "Civilian Population UI");
     }
 }
        private void OnGUI()
        {
            // Get the current skin
            GUI.skin = HighLogic.Skin;

            centeredStyle           = GUI.skin.GetStyle("Label");
            centeredStyle.alignment = TextAnchor.UpperCenter;
            centeredStyle.fontStyle = FontStyle.Bold;

            // Make sure the window isn't dragged off screen
            if (windowPos.x < 0)
            {
                windowPos.x = 0;
            }
            if (windowPos.y < 0)
            {
                windowPos.y = 0;
            }
            if (windowPos.x > Screen.width - windowPos.width)
            {
                windowPos.x = Screen.width - windowPos.width;
            }
            if (windowPos.y > Screen.height - windowPos.height)
            {
                windowPos.y = Screen.height - windowPos.height;
            }

            if (!hideGUI && draw)
            {
                windowPos = ClickThruBlocker.GUIWindow(641286, windowPos, DrawTime, "");
            }
        }
Exemplo n.º 8
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.º 9
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);
        }
Exemplo n.º 10
0
 internal void draw()
 {
     if (showWindow)
     {
         windowRect = ClickThruBlocker.GUILayoutWindow(windowId, windowRect, drawWindow, "");
     }
 }
Exemplo n.º 11
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));
                }
            }
        }
Exemplo n.º 12
0
 void OnGUI()
 {
     if (isVisible)
     {
         winRect = ClickThruBlocker.GUILayoutWindow(12342312, winRect, DisplayWin, "Vessel Notes & Logs");
     }
 }
Exemplo n.º 13
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.º 14
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.º 15
0
 public void OnGUI()
 {
     if (GUI.showGui)
     {
         GUI.windowPosition = ClickThruBlocker.GUILayoutWindow(winId, GUI.windowPosition, OnWindow, "", GUI.windowStyle);
     }
 }
Exemplo n.º 16
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.º 17
0
 private void OnGUI()
 {
     if (visible)
     {
         windowPosition = ClickThruBlocker.GUILayoutWindow(10, windowPosition, OnWindow, "Danger Alerts");
     }
 }
Exemplo n.º 18
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 //**************************
        }
 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);
 }
Exemplo n.º 20
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);
             * }
             */
        }
        /// <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();
            }
        }
            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.º 23
0
        void OnGUI()
        {
            if (windowEnabled)
            {
                if (toolbarControl != null)
                {
                    if (HighLogic.CurrentGame.Parameters.CustomParams <AR>().useKSPSkin)
                    {
                        GUI.skin = HighLogic.Skin;
                    }
                }

                if (anyresWinRect.x + anyresWinRect.width > Screen.width)
                {
                    anyresWinRect.x = Screen.width - anyresWinRect.width;
                }
                if (anyresWinRect.y + anyresWinRect.height > Screen.height)
                {
                    anyresWinRect.y = Screen.height - anyresWinRect.height;
                }


                anyresWinRect.x = Math.Max(anyresWinRect.x, 0);
                anyresWinRect.y = Math.Max(anyresWinRect.y, 0);

                anyresWinRect = ClickThruBlocker.GUIWindow(09271, anyresWinRect, GUIActive, "AnyRes");
            }
            if (confirmDeleteEnabled)
            {
                deleteRect = ClickThruBlocker.GUIWindow(09276, deleteRect, ConfirmDelete, "Confirm");
            }
        }
Exemplo n.º 24
0
        private void DrawWindow()
        {
            if (!HighLogic.CurrentGame.Parameters.CustomParams <Workshop_MiscSettings>().useAlternateSkin)
            {
                GUI.skin = HighLogic.Skin;
            }
            else
            {
                GUI.color = Color.grey;
            }

            if (!windowInitted && HighLogic.CurrentGame.Parameters.CustomParams <Workshop_MiscSettings>().useAlternateSkin)
            {
                windowInitted = true;
                window        = new GUIStyle(HighLogic.Skin.window);

                window.active.background = window.normal.background;

                Texture2D tex = window.normal.background; //.CreateReadable();

                //#if DEBUG
                //                Log.Debug("WindowOpacity set to " + value);
                //                tex.SaveToDisk("unmodified_window_bkg.png");
                //#endif

                var pixels = tex.GetPixels32();

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

                tex.SetPixels32(pixels); tex.Apply();
                //#if DEBUG
                //                tex.SaveToDisk("usermodified_window_bkg.png");
                //#endif
                // one of these apparently fixes the right thing
                // window.onActive.background =
                // window.onFocused.background =
                // window.onNormal.background =
                //window.onHover.background =
                window.active.background      =
                    window.focused.background =
                        //window.hover.background =
                        window.normal.background = tex;
            }

            GUI.skin.label.alignment  = TextAnchor.MiddleCenter;
            GUI.skin.button.alignment = TextAnchor.MiddleCenter;

            if (!HighLogic.CurrentGame.Parameters.CustomParams <Workshop_MiscSettings>().useAlternateSkin)
            {
                _windowPos = ClickThruBlocker.GUIWindow(GetInstanceID(), _windowPos, DrawWindowContents, "Recycler Menu");
            }
            else
            {
                _windowPos = ClickThruBlocker.GUIWindow(GetInstanceID(), _windowPos, DrawWindowContents, "Recycler Menu", window);
            }
        }
Exemplo n.º 25
0
 private void OnGUI()
 {
     if (HighLogic.LoadedSceneIsEditor && isVisible)
     {
         GUI.skin = HighLogic.Skin;
         winRect  = ClickThruBlocker.GUILayoutWindow(456789764, winRect, Window, "Part Information");
     }
 }
 void OnGUI()
 {
     if (Event.current.type == EventType.Layout)
     {
         //_windowRect.yMax = _windowRect.yMin;
         _windowRect = ClickThruBlocker.GUILayoutWindow(this.GetInstanceID(), _windowRect, WindowContent, _windowTitle);
     }
 }
Exemplo n.º 27
0
 public void DrawGUI(Transform transform)
 {
     if (transform != null)
     {
         currentTransform = transform;
         inspectorRect    = ClickThruBlocker.GUILayoutWindow(inspectorID, inspectorRect, InspectorWindow, "Inspector: " + transform.gameObject.name, HighLogic.Skin.window);
     }
 }
Exemplo n.º 28
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));
 }
 private void ShowNavigationWindow()
 {
     if (selectedWaypoint != null)
     {
         GUI.skin  = HighLogic.Skin;
         windowPos = ClickThruBlocker.GUILayoutWindow(10, windowPos, NavigationWindow, waypointName, GUILayout.MinWidth(224));
     }
 }
Exemplo n.º 30
0
 internal void OnGUI()
 {
     if (WindowSettings)
     {
         GUI.skin     = HighLogic.Skin;
         RectSettings = ClickThruBlocker.GUILayoutWindow(1584653, RectSettings, DrawSettings, RegisterToolbar.MOD + " " + RegisterToolbar.VERSION, GUILayout.ExpandHeight(true));
     }
 }