Inheritance: UnityEngine.MonoBehaviour
コード例 #1
0
ファイル: DRToolBar.cs プロジェクト: herbiems89/DeadlyReentry
/*
 *              void Start()
 *              {
 *          if (!CompatibilityChecker.IsAllCompatible())
 *          {
 *              isCompatible = false;
 *              return;
 *          }
 *          print("Start method called Initializing GUIs");
 *                      if (HighLogic.LoadedScene >= GameScenes.SPACECENTER
 *                              && HighLogic.LoadedScene <= GameScenes.TRACKSTATION)
 *          {
 *                              windowStyle = new GUIStyle (HighLogic.Skin.window);
 *              windowStyle.stretchHeight = true;
 *              windowStyleCenter = new GUIStyle (HighLogic.Skin.window);
 *              windowStyleCenter.alignment = TextAnchor.MiddleCenter;
 *              labelStyle = new GUIStyle(HighLogic.Skin.label);
 *              labelStyle.fixedHeight = labelStyle.lineHeight + 4f;
 *                              //RenderingManager.AddToPostDrawQueue (0, Draw);
 *              OnGUIAppLauncherReady();
 *                      }
 *              }
 */
        public void OnGUI()
        {
            if (!CompatibilityChecker.IsAllCompatible())
            {
                isCompatible = false;
                return;
            }
            GUI.skin = HighLogic.Skin;

            if (HighLogic.LoadedSceneIsEditor)
            {
                PreventEditorClickthrough();
            }
            if (HighLogic.LoadedSceneIsFlight || HighLogic.LoadedSceneHasPlanetarium)
            {
                PreventInFlightClickthrough();
            }


            Draw();
        }
コード例 #2
0
ファイル: DRToolBar.cs プロジェクト: herbiems89/DeadlyReentry
        void Awake()
        {
            // Set up the stock toolbar
            if (!CompatibilityChecker.IsAllCompatible())
            {
                isCompatible = false;
                return;
            }
            this.windowPosition = new Rect(0, 0, 360, 480);

            windowStyle = new GUIStyle(HighLogic.Skin.window);
            windowStyle.stretchHeight   = true;
            windowStyleCenter           = new GUIStyle(HighLogic.Skin.window);
            windowStyleCenter.alignment = TextAnchor.MiddleCenter;
            labelStyle             = new GUIStyle(HighLogic.Skin.label);
            labelStyle.fixedHeight = labelStyle.lineHeight + 4f;

            GameEvents.onGUIApplicationLauncherReady.Add(OnGUIAppLauncherReady);
            GameEvents.onGUIApplicationLauncherDestroyed.Add(OnGUIAppLauncherDestroyed);
            GameEvents.onGameSceneLoadRequested.Add(OnGameSceneLoadRequestedForAppLauncher);
            //Texture Melificent =
        }
コード例 #3
0
ファイル: DRToolBar.cs プロジェクト: herbiems89/DeadlyReentry
        private void OnWindow(int windowID)
        {
            if (!CompatibilityChecker.IsAllCompatible())
            {
                isCompatible = false;
                return;
            }
            GUILayout.ExpandWidth(true);
            GUILayout.ExpandHeight(true);
            GUILayout.BeginVertical();

            GUILayout.BeginHorizontal();
            GUILayout.Height(0);
            GUILayout.Label("G Tolerance Mult:", labelStyle);
            string newGToleranceMult = GUILayout.TextField(ReentryPhysics.gToleranceMult.ToString(), GUILayout.MinWidth(100));

            GUILayout.EndHorizontal();

            GUILayout.BeginHorizontal();
            GUILayout.Height(0);
            GUILayout.Label("Crew G Max", labelStyle);
            string newcrewGClamp = GUILayout.TextField(ReentryPhysics.crewGClamp.ToString(), GUILayout.MinWidth(100));

            GUILayout.EndHorizontal();

            GUILayout.BeginHorizontal();
            GUILayout.Height(0);
            GUILayout.Label("Crew G Exponent", labelStyle);
            string newcrewGPower = GUILayout.TextField(ReentryPhysics.crewGPower.ToString(), GUILayout.MinWidth(100));

            GUILayout.EndHorizontal();

            GUILayout.BeginHorizontal();
            GUILayout.Height(0);
            GUILayout.Label("Crew G Min", labelStyle);
            string newcrewGMin = GUILayout.TextField(ReentryPhysics.crewGMin.ToString(), GUILayout.MinWidth(100));

            GUILayout.EndHorizontal();

            GUILayout.BeginHorizontal();
            GUILayout.Height(0);
            GUILayout.Label("Crew G Warn Level", labelStyle);
            string newcrewGWarn = GUILayout.TextField(ReentryPhysics.crewGWarn.ToString(), GUILayout.MinWidth(100));

            GUILayout.EndHorizontal();

            GUILayout.BeginHorizontal();
            GUILayout.Height(0);
            GUILayout.Label("Crew G Kill threshold", labelStyle);
            string newcrewGLimit = GUILayout.TextField(ReentryPhysics.crewGLimit.ToString(), GUILayout.MinWidth(100));

            GUILayout.EndHorizontal();

            GUILayout.BeginHorizontal();
            GUILayout.Height(0);
            GUILayout.Label("Crew G Kill chance per update", labelStyle);
            string newcrewGKillChance = GUILayout.TextField(ReentryPhysics.crewGKillChance.ToString(), GUILayout.MinWidth(100));

            GUILayout.EndHorizontal();
            GUILayout.BeginHorizontal();
            GUILayout.Height(0);
            DeadlyReentryScenario.displayCrewGForceWarning = GUILayout.Toggle(DeadlyReentryScenario.displayCrewGForceWarning, "Warn crew G forces are becoming dangerous!");
            GUILayout.EndHorizontal();
            GUILayout.Width(0);
            GUILayout.Height(0);
            GUILayout.Label("For other thermal settings, press F-12 then select Physics->Thermals.", windowStyleCenter);
            GUILayout.Label(Ariel, windowStyleCenter);

            GUILayout.EndVertical();

            GUI.DragWindow();

            if (GUI.changed)
            {
                //print("GUI CHANGED!!!111oneone");
                float newValue;

                if (float.TryParse(newGToleranceMult, out newValue))
                {
                    ReentryPhysics.gToleranceMult = newValue;
                }

                if (float.TryParse(newcrewGClamp, out newValue))
                {
                    ReentryPhysics.crewGClamp = newValue;
                }

                if (float.TryParse(newcrewGPower, out newValue))
                {
                    ReentryPhysics.crewGPower = newValue;
                }

                if (float.TryParse(newcrewGMin, out newValue))
                {
                    ReentryPhysics.crewGMin = newValue;
                }
                if (float.TryParse(newcrewGWarn, out newValue))
                {
                    ReentryPhysics.crewGWarn = newValue;
                }
                if (float.TryParse(newcrewGLimit, out newValue))
                {
                    ReentryPhysics.crewGLimit = newValue;
                }
                if (float.TryParse(newcrewGKillChance, out newValue))
                {
                    ReentryPhysics.crewGKillChance = newValue;
                }
                DeadlyReentry.ReentryPhysics.SaveSettings();
                DeadlyReentry.ReentryPhysics.SaveCustomSettings();
                if (!DeadlyReentryScenario.displayCrewGForceWarning)
                {
                    ScreenMessages.RemoveMessage(ReentryPhysics.crewGWarningMsg);
                }
            }
        }