Exemplo n.º 1
0
        protected virtual void DrawWindow()
        {
            if (visible && allowedToDraw())
            {
                bool paused = false;
                if (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 = GUIResources.EnsureVisible(windowPos);
                    windowPos = GUILayout.Window(windowId, windowPos, PreDrawWindowContents, windowTitle, GUILayout.ExpandWidth(windowResizableX),
                                                 GUILayout.ExpandHeight(windowResizableY), GUILayout.MinWidth(windowPos.width), GUILayout.MinHeight(windowPos.height));
                }
            }
        }
        protected override void DrawWindowContents(int windowID)
        {
            GUIResources.SetupGUI();
            GUILayout.BeginVertical();
            behaviour.currentReplayTime = GUILayout.HorizontalSlider((float)behaviour.currentReplayTime, 0, (float)behaviour.totalReplayTime);

            GUILayout.BeginHorizontal(); // BEGIN outer container
            if (GUILayout.Button(playTex))
            {
                behaviour.isOffRails     = false;
                behaviour.playbackFactor = 1;
            }
            if (GUILayout.Button(ffTex))
            {
                behaviour.isOffRails      = false;
                behaviour.playbackFactor += 1;
            }
            if (GUILayout.Button(pauseTex))
            {
                behaviour.isOffRails     = false;
                behaviour.playbackFactor = 0;
            }
            if (GUILayout.Button(stopTex))
            {
                behaviour.isOffRails        = false;
                behaviour.playbackFactor    = 0;
                behaviour.currentReplayTime = 0;
            }
            GUILayout.EndHorizontal();

            GUILayout.EndVertical();
        }
Exemplo n.º 3
0
        public virtual void Load(ConfigNode config)
        {
            if (config.HasNode(configNodeName))
            {
                ConfigNode windowConfig = config.GetNode(configNodeName);

                windowPos.x      = GUIResources.GetValue(windowConfig, "x", windowPos.x);
                windowPos.y      = GUIResources.GetValue(windowConfig, "y", windowPos.y);
                windowPos.width  = GUIResources.GetValue(windowConfig, "width", windowPos.width);
                windowPos.height = GUIResources.GetValue(windowConfig, "height", windowPos.height);

                bool newValue = GUIResources.GetValue(windowConfig, "visible", visible);
                //SetVisible(newValue);
            }
        }
        protected override void DrawWindowContents(int windowID)
        {
            GUIResources.SetupGUI();

            GUILayout.BeginVertical(); // BEGIN outer container
            GUILayout.BeginHorizontal();

            GUI.enabled = TrackManager.Instance.isRecordingAllowed();
            string recordText = "create new Track";

            if (!GUI.enabled)
            {
                recordText = "[ - NO SIGNAL! -]";
            }

            if (GUILayout.Button(recordText))
            {
                TrackManager.Instance.startNewTrack();
            }
            GUI.enabled = true;

            if (GUILayout.Button("Stop recording"))
            {
                TrackManager.Instance.stopRecording();
            }

            GUILayout.EndHorizontal();

            if (GUILayout.Button("Add Log Entry to current Path"))
            {
                if (TrackManager.Instance.IsRecording)
                {
                    ExplorerTrackBehaviour.Instance.logEntryWindow = new LogEntryWindow(TrackManager.Instance);
                    ExplorerTrackBehaviour.Instance.logEntryWindow.SetVisible(true);
                }
                else
                {
                    Debug.Log("Cannot add a Log Entry - no track is active/beeing recorded");
                }
            }


            createTrackList();

            GUILayout.BeginHorizontal();
            if (GUILayout.Button("Save Tracks"))
            {
                TrackManager.Instance.saveTracks();
                Save(new ConfigNode(GetConfigNodeName()));
            }
            if (GUILayout.Button("Restore from Files"))
            {
                TrackManager.Instance.restoreTracksFromFile();
            }

            GUILayout.EndHorizontal();

            GUILayout.BeginHorizontal();
            if (GUILayout.Button("High Precision", (mainBehaviour.RecordingInterval == 0.2f) ? GUIResources.ButtonToggledStyle : GUIResources.ButtonStyle))
            {
                mainBehaviour.RecordingInterval        = 0.2f;
                TrackManager.Instance.ChangeThresholds = new RecordingThresholds(2, 2, 0.05f);
            }
            if (GUILayout.Button("Medium Precision", (mainBehaviour.RecordingInterval == 1) ? GUIResources.ButtonToggledStyle : GUIResources.ButtonStyle))
            {
                mainBehaviour.RecordingInterval        = 1.0f;
                TrackManager.Instance.ChangeThresholds = new RecordingThresholds(10, 10, 0.1f);
            }
            if (GUILayout.Button("Low Precision", (mainBehaviour.RecordingInterval == 5) ? GUIResources.ButtonToggledStyle : GUIResources.ButtonStyle))
            {
                mainBehaviour.RecordingInterval        = 5.0f;
                TrackManager.Instance.ChangeThresholds = new RecordingThresholds(20, 20, 0.25f);
            }
            GUILayout.EndHorizontal();

            GUILayout.EndVertical();

            SetTooltipText();
            DrawToolTip();
        }
Exemplo n.º 5
0
 public void Start()
 {
     GUIResources.LoadAssets();
 }