Esempio n. 1
0
        public void OnGUI()
        {
            if (!enable)
            {
                instructor_Werner.Instructor.enabled = false;
                instructor_Linus.Instructor.enabled  = false;
                return;
            }
            instructor_Werner.Instructor.enabled = true;
            instructor_Linus.Instructor.enabled  = true;
            try
            {
                if (!Textures.StylesSet)
                {
                    Textures.SetupStyles();
                }
            }
            catch (Exception ex)
            {
                RSTLogWriter.Log("Unable to set GUI Styles to draw the GUI");
                RSTLogWriter.Log("Exception: {0}", ex);
            }

            GUI.skin = Textures.ObsSkin;
            #if DEBUGFACILITY
            if (showObsdebugUI)
            {
                observRect = GUILayout.Window(_RBwindowId + 1, observRect, DrawObservDebug, "Research Bodies");
            }
            #endif

            if (!showGUI)
            {
                return;
            }

            if (PSystemSetup.Instance.GetSpaceCenterFacility("TrackingStation").GetFacilityDamage() > 0)
            {
                ScreenMessages.PostScreenMessage(Locales.FmtLocaleString("#autoLOC_RBodies_00018"), 3.0f, ScreenMessageStyle.UPPER_CENTER);
                return;
            }

            try
            {
                windowRect.ClampInsideScreen();
                windowRect = GUILayout.Window(_RBwindowId, windowRect, DrawWindow, "Research Bodies");
                Utilities.DrawToolTip();
            }
            catch (Exception ex)
            {
                RSTLogWriter.Log("Unable to draw GUI");
                RSTLogWriter.Log("Exception: {0}", ex);
            }
        }
Esempio n. 2
0
 public void OnGUI()
 {
     if (HighLogic.LoadedSceneIsFlight && !sceneChangeRequested)
     {
         if (showGUI && ResearchBodies.Enabled)
         {
             try
             {
                 if (!Textures.StylesSet)
                 {
                     Textures.SetupStyles();
                 }
             }
             catch (Exception ex)
             {
                 RSTLogWriter.Log("Unable to set GUI Styles to draw the GUI");
                 RSTLogWriter.Log("Exception: {0}", ex);
             }
             GUI.skin = HighLogic.Skin;
             windowRect.ClampToScreen();
             windowRect = GUILayout.Window(_partwindowID, windowRect, DrawWindow, Localizer.Format("#autoLOC_RBodies_00026"));
         }
     }
 }
        public void OnGUI()
        {
            if (!enable)
            {
                return;
            }
            try
            {
                if (!Textures.StylesSet)
                {
                    Textures.SetupStyles();
                }
            }
            catch (Exception ex)
            {
                RSTLogWriter.Log("Unable to set GUI Styles to draw the GUI");
                RSTLogWriter.Log("Exception: {0}", ex);
            }

            GUI.skin = HighLogic.Skin;

            if (RBMenuAppLToolBar.ShowHoverText)
            {
                hoverwindow.xMin = Input.mousePosition.x - 200;
                hoverwindow.yMin = (Screen.height - Input.mousePosition.y) - 100;
                hoverwindow.xMax = Input.mousePosition.x;
                hoverwindow.yMax = (Screen.height - Input.mousePosition.y);
                hoverwindow.ClampInsideScreen();
                hoverwindow = GUI.Window(_hoverwindowId, hoverwindow, DrawHoverwin, "Research Bodies", HighLogic.Skin.window);
            }

            if (showStartUI)
            {
                startWindow.ClampInsideScreen();
                startWindow = GUILayout.Window(_startwindowId, startWindow, DrawStartWindow, "ResearchBodies " + Locales.currentLocale.Values["misc_settings"]);
            }

            if (!RBMenuAppLToolBar.GuiVisible || RBMenuAppLToolBar.gamePaused || RBMenuAppLToolBar.hideUI)
            {
                return;
            }

            if (PSystemSetup.Instance.GetSpaceCenterFacility("TrackingStation").GetFacilityDamage() > 0)
            {
                ScreenMessages.PostScreenMessage(Locales.currentLocale.Values["trackingStation_isDestroyed"], 3.0f, ScreenMessageStyle.UPPER_CENTER);
                return;
            }


            try
            {
                if (RBMenuAppLToolBar.GuiVisible)
                {
                    windowRect.ClampInsideScreen();
                    windowRect = GUILayout.Window(_RBwindowId, windowRect, DrawWindow, "Research Bodies");
                }

                if (showSettings)
                {
                    settingsRect.ClampInsideScreen();
                    settingsRect = GUILayout.Window(_settingswindowId, settingsRect, DrawSettings, Locales.currentLocale.Values["misc_settings"]);
                }



                Utilities.DrawToolTip();
            }
            catch (Exception ex)
            {
                RSTLogWriter.Log("Unable to draw GUI");
                RSTLogWriter.Log("Exception: {0}", ex);
            }
        }
        public void OnGUI()
        {
            if (!enable || !showGUI)
            {
                if (instructor_Werner != null && instructor_Werner.Instructor != null)
                {
                    Destroy(instructor_Werner.Instructor.gameObject);
                }
                if (instructor_Werner != null)
                {
                    instructor_Werner.Destroy();
                    instructor_Werner = null;
                }
                if (instructor_Linus != null && instructor_Linus.Instructor != null)
                {
                    Destroy(instructor_Linus.Instructor.gameObject);
                }
                if (instructor_Linus != null)
                {
                    instructor_Linus.Destroy();
                    instructor_Linus = null;
                }
                return;
            }
            //Create Instructor
            if (instructor_Werner == null || instructor_Werner != null && instructor_Werner.Instructor == null)
            {
                instructor_Werner = new ResearchBodiesInstructor("Instructor_Wernher");
            }
            if (instructor_Werner != null && instructor_Werner.Instructor != null)
            {
                instructor_Werner.Instructor.enabled = true;
            }
            if (instructor_Linus == null || instructor_Linus != null && instructor_Linus.Instructor == null)
            {
                instructor_Linus = new ResearchBodiesInstructor("Strategy_ScienceGuy");
            }
            if (instructor_Linus != null && instructor_Linus.Instructor != null)
            {
                instructor_Linus.Instructor.enabled = true;
            }
            try
            {
                if (!Textures.StylesSet)
                {
                    Textures.SetupStyles();
                }
            }
            catch (Exception ex)
            {
                RSTLogWriter.Log("Unable to set GUI Styles to draw the GUI");
                RSTLogWriter.Log("Exception: {0}", ex);
            }

            GUI.skin = Textures.ObsSkin;
#if DEBUGFACILITY
            if (showObsdebugUI)
            {
                observRect = GUILayout.Window(_RBwindowId + 1, observRect, DrawObservDebug, "Research Bodies");
            }
#endif

            if (PSystemSetup.Instance.GetSpaceCenterFacility("TrackingStation").GetFacilityDamage() > 0)
            {
                ScreenMessages.PostScreenMessage(Localizer.Format("#autoLOC_RBodies_00018"), 3.0f, ScreenMessageStyle.UPPER_CENTER);
                return;
            }

            try
            {
                windowRect.ClampInsideScreen();
                windowRect = GUILayout.Window(_RBwindowId, windowRect, DrawWindow, "Research Bodies");
                Utilities.DrawToolTip();
            }
            catch (Exception ex)
            {
                RSTLogWriter.Log("Unable to draw GUI");
                RSTLogWriter.Log("Exception: {0}", ex);
            }
        }