private void DrawShadowedMessage(string message)
    {
      GUIStyle style = new GUIStyle(HighLogic.Skin.label);
      style.fontSize = 22;
      style.alignment = TextAnchor.UpperCenter;

      Rect labelRect = new Rect(0, (Screen.height * 0.25f) + (Mathf.Sin(2 * Time.time) * 5), Screen.width, 200);

      //shadow
      GUIStyle shadowStyle = new GUIStyle(style);
      shadowStyle.normal.textColor = new Color(0, 0, 0, 0.15f);
      Vector3 shadowOffset = 2 * Vector3.up;
      for (int i = 0; i < 16; i++)
      {
        Rect shadowRect = new Rect(labelRect);
        shadowRect.x += shadowOffset.x;
        shadowRect.y += shadowOffset.y;
        GUI.Label(shadowRect, message, shadowStyle);
        shadowOffset = Quaternion.AngleAxis(22.5f, Vector3.forward) * shadowOffset;
      }



      GUI.Label(labelRect, message, style);
    }
示例#2
0
 protected void DrawTooltip()
 {
     if (ToolTip != null && ToolTip.Trim().Length > 0)
     {
         GUI.Label(tooltipRect, ToolTip, HighLogic.Skin.label);
     }
 }
示例#3
0
 private void DrawAltitudeSlider(float line)
 {
     var saveRect = new Rect(LeftIndent * 1.5f, ContentTop + line * entryHeight, contentWidth * 0.9f, entryHeight);
     GUI.Label(new Rect(10, ContentTop + line * entryHeight, contentWidth * 0.9f, 20), "0");
     GUI.Label(new Rect(95, ContentTop + line * entryHeight, contentWidth * 0.9f, 20), "|");
     GUI.Label(new Rect(178, ContentTop + line * entryHeight, contentWidth * 0.9f, 20), "20");
     altAdjust = GUI.HorizontalSlider(saveRect, altAdjust, 0, 20);
 }
示例#4
0
        private static void OnWindow(int winID)
        {
            if (GUI.Button(new Rect(5, 15, 65, 20), "Previous"))
            {
                NavUtilLib.GlobalVariables.FlightData.rwyIdx--;
                NavUtilLib.GlobalVariables.FlightData.rwyIdx = NavUtilLib.Utils.indexChecker(NavUtilLib.GlobalVariables.FlightData.rwyIdx, NavUtilLib.GlobalVariables.FlightData.currentBodyRunways.Count() - 1, 0);
            }

            if (GUI.Button(new Rect(75, 15, 95, 20), "Runway list"))
            {
                RunwayListGUI.show(winPos);
            }

            if (GUI.Button(new Rect(175, 15, 65, 20), "Next"))
            {
                NavUtilLib.GlobalVariables.FlightData.rwyIdx++;
                NavUtilLib.GlobalVariables.FlightData.rwyIdx = NavUtilLib.Utils.indexChecker(NavUtilLib.GlobalVariables.FlightData.rwyIdx, NavUtilLib.GlobalVariables.FlightData.currentBodyRunways.Count() - 1, 0);
            }

            if (GUI.Button(new Rect(5, 40, 115, 20), "Previous G/S"))
            {
                NavUtilLib.GlobalVariables.FlightData.gsIdx--;
                NavUtilLib.GlobalVariables.FlightData.gsIdx = NavUtilLib.Utils.indexChecker(NavUtilLib.GlobalVariables.FlightData.gsIdx, NavUtilLib.GlobalVariables.FlightData.gsList.Count() - 1, 0);
            }

            if (GUI.Button(new Rect(130, 40, 115, 20), "Next G/S"))
            {
                NavUtilLib.GlobalVariables.FlightData.gsIdx++;
                NavUtilLib.GlobalVariables.FlightData.gsIdx = NavUtilLib.Utils.indexChecker(NavUtilLib.GlobalVariables.FlightData.gsIdx, NavUtilLib.GlobalVariables.FlightData.gsList.Count() - 1, 0);
            }

            GUI.Label(new Rect(5, 75, 115, 25), "HSI GUI scale");

            if (GUI.Button(new Rect(130, 75, 100, 25), "Default Scale"))
            {
                NavUtilLib.GlobalVariables.Settings.hsiGUIscale = 0.5f;
            }

            if (GUI.Button(new Rect(5, 150, 115, 20), "Custom Rwys"))
            {
                NavUtilGUI.RunwaysEditor.startGUI();
            }

            //GUI.Label(new Rect(125, 150, 90, 20), "Popup in IVA?");

            GlobalVariables.Settings.hideNavBallWaypoint = GUI.Toggle(new Rect(30, 120, 240, 20), GlobalVariables.Settings.hideNavBallWaypoint, "Hide NavBall waypoint icon");

            GlobalVariables.Settings.enableWindowsInIVA = GUI.Toggle(new Rect(125, 150, 120, 20), GlobalVariables.Settings.enableWindowsInIVA, "Popup in IVA");


            NavUtilLib.GlobalVariables.Settings.hsiGUIscale = GUI.HorizontalSlider(new Rect(5, 105, 240, 30), NavUtilLib.GlobalVariables.Settings.hsiGUIscale, 0.1f, 1.0f);

            GUI.DragWindow();
        }
示例#5
0
        private void DrawZ(float line)
        {
            var leftLabel = new GUIStyle();
            leftLabel.alignment = TextAnchor.UpperLeft;
            leftLabel.normal.textColor = Color.white;

            GUI.Label(new Rect(LeftIndent, ContentTop + line * entryHeight, 60, entryHeight), "Altitude",
                leftLabel);
            float textFieldWidth = 80;
            var fwdFieldRect = new Rect(LeftIndent + contentWidth - textFieldWidth,
                ContentTop + line * entryHeight, textFieldWidth, entryHeight);
            _guiZ = GUI.TextField(fwdFieldRect, _guiZ);
        }
示例#6
0
 private void DrawTitle(float line)
 {
     var centerLabel = new GUIStyle
     {
         alignment = TextAnchor.UpperCenter,
         normal = { textColor = Color.white }
     };
     var titleStyle = new GUIStyle(centerLabel)
     {
         fontSize = 14,
         alignment = TextAnchor.MiddleCenter
     };
     GUI.Label(new Rect(0, 0, WindowWidth, 20), "Move Launch", titleStyle);
 }
        private void DrawNameEntry(float line)
        {
            var leftLabel = new GUIStyle();

            leftLabel.alignment        = TextAnchor.UpperLeft;
            leftLabel.normal.textColor = Color.white;

            GUI.Label(new Rect(LeftIndent, ContentTop + line * entryHeight, 60, entryHeight), "Name",
                      leftLabel);
            float textFieldWidth = 140;
            var   fwdFieldRect   = new Rect(LeftIndent + contentWidth - textFieldWidth,
                                            ContentTop + line * entryHeight, textFieldWidth, entryHeight);

            GPSname = GUI.TextField(fwdFieldRect, GPSname);
        }
示例#8
0
        private void DrawAltitudeText(float line)
        {
            var centerLabel = new GUIStyle
            {
                alignment = TextAnchor.UpperCenter,
                normal = { textColor = Color.white }
            };
            var titleStyle = new GUIStyle(centerLabel)
            {
                fontSize = 10,
                alignment = TextAnchor.MiddleCenter
            };

            GUI.Label(new Rect(0, ContentTop + line * entryHeight, WindowWidth, 18),
                "ATTITUDE ADJUSTMENT",
                titleStyle);
        }
示例#9
0
        private void DrawText(float line)
        {
            var centerLabel = new GUIStyle
            {
                alignment = TextAnchor.UpperCenter,
                normal = { textColor = Color.white }
            };
            var titleStyle = new GUIStyle(centerLabel)
            {
                fontSize = 12,
                alignment = TextAnchor.MiddleCenter
            };

            GUI.Label(new Rect(0, ContentTop + line * entryHeight, WindowWidth, 20),
                "Enter GPS Coords Below",
                titleStyle);
        }
示例#10
0
        //public void SetText(string text) => this.text = text;

        protected override void OnDraw(Rect bounds)
        {
            GUIStyle style = new GUIStyle(GUI.skin.label)
            {
                alignment = textAnchor
            };

            style.normal.textColor = color;
            if (createdFonts.ContainsKey(fontName))
            {
                style.font = createdFonts[fontName];
            }
            style.fontSize  = fontSize;
            style.fontStyle = fontStyle;
            style.richText  = true;

            GUIContent content = new GUIContent()
            {
                text = ExpandTokens()
            };

            GUI.Label(bounds, content, style);
        }
示例#11
0
        /*************************************************************************************************************************/
        public void MainGUI(int windowID)
        {
            List <string> save_files = new List <string>();
            Vessel        temp_vessel;
            string        temp_string;
            Guid          guid_delete_vessel = FlightGlobals.ActiveVessel.id;
            bool          delete_vessel      = false;
            float         scrollbar_size;
            bool          scrollbar_enable = false;
            float         window_height, window_width, scrollbar_width_offset;

            window_height = 60;
            window_width  = 280;

            GUILayout.BeginVertical();

            GUILayout.BeginHorizontal();

            if (!_SETTING_Minimize)
            {
                if (_SAVE_Has_Launched)
                {
                    GUILayout.Box("Mission Time: " + get_time_string(Planetarium.GetUniversalTime() - _SAVE_Launched_At), text_main, GUILayout.Width(188));
                }
                else
                {
                    GUILayout.Box("Mission Time: " + "00:00", text_main, GUILayout.Width(137));
                }
            }
            else
            {
                GUILayout.Space(5);
            }

            if (_SETTING_Armed)
            {
                temp_string = "Armed";
            }
            else
            {
                temp_string = "Arm";
            }

            if (!_SAVE_Has_Launched)
            {
                _SETTING_Armed = GUILayout.Toggle(_SETTING_Armed, temp_string, button_small, GUILayout.Width(50));
            }
            else
            if (_SETTING_Minimize)
            {
                GUILayout.Box("Flight", text_main, GUILayout.Width(50));
            }

            if (!_SETTING_Minimize)
            {
                show_setting = GUILayout.Toggle(show_setting, buttonContent, button_small, GUILayout.Width(25));
                if (show_setting)
                {
                    buttonContent = upContent;
                }
                else
                {
                    buttonContent = downContent;
                }
            }

            _SETTING_Minimize = GUILayout.Toggle(_SETTING_Minimize, "_", button_small, GUILayout.Width(25));
            if (really_close && _SETTING_Minimize)
            {
                _SETTING_Minimize = false;
            }

            if (!_SETTING_Minimize)
            {
                really_close = GUILayout.Toggle(really_close, "x", button_small, GUILayout.Width(25));
            }
            else
            {
                window_width = 105;
            }

            GUILayout.EndHorizontal();

            if (really_close)
            {
                if (_SAVE_Has_Launched)
                {
                    GUILayout.Space(5);
                    window_height += 5;

                    GUILayout.Box("Plugin will be reset!", text_heading, GUILayout.Width(266));
                    window_height += 29;
                    GUILayout.Box("Close?", text_heading, GUILayout.Width(266));
                    GUILayout.BeginHorizontal();

                    if (GUILayout.Button("YES", button_big, GUILayout.Width(132)))
                    {
                        close_FMRS();
                    }

                    if (GUILayout.Button("NO", button_big, GUILayout.Width(133)))
                    {
                        really_close = false;
                    }

                    GUILayout.EndHorizontal();
                    window_height += 58;
                }
                else
                {
                    close_FMRS();
                }
            }

            if (really_close == false && _SETTING_Minimize == false && show_setting == true)
            {
                GUILayout.Space(5);
                window_height += 5;
                GUILayout.BeginVertical(/* area_style ,*/ GUILayout.Width(266));
                GUILayout.Space((5 * 30) + 5);
                _SETTING_Messages     = GUI.Toggle(new Rect(5, 35 + (30 * 1), 25, 25), _SETTING_Messages, "Messaging System");
                window_height        += 30;
                _SETTING_Auto_Cut_Off = GUI.Toggle(new Rect(5, 35 + (30 * 2), 25, 25), _SETTING_Auto_Cut_Off, "Auto Cut Off Engines");
                window_height        += 30;
                _SETTING_Auto_Recover = GUI.Toggle(new Rect(5, 35 + (30 * 3), 25, 25), _SETTING_Auto_Recover, "Auto Recover Landed Crafts");
                window_height        += 30;
                _SETTING_Throttle_Log = GUI.Toggle(new Rect(5, 35 + (30 * 4), 25, 25), _SETTING_Throttle_Log, "Throttle Logger WIP");
                window_height        += 30;
                Timer_Stage_Delay     = GUI.HorizontalSlider(new Rect(45, 35 + (30 * 6) + 15, 205, 25), Timer_Stage_Delay, 0.2f, 5.0f);
                window_height        += 45;
                GUI.Label(new Rect(20, 35 + (30 * 7), 225, 25), "Stage Save Delay: " + Timer_Stage_Delay.ToString("F1"));
                GUILayout.EndVertical();
                window_height += 42;
            }

            if (really_close == false && _SETTING_Minimize == false && show_setting == false)
            {
                if (Vessels_dropped.Count > 0)
                {
                    GUILayout.Space(5);
                    window_height += 5;

                    GUILayout.Box("Separated Stages:", text_heading, GUILayout.Width(266));
                    window_height += 33;

                    foreach (KeyValuePair <Guid, string> temp_keyvalue in Vessels_dropped)
                    {
                        if (!save_files.Contains(temp_keyvalue.Value))
                        {
                            save_files.Add(temp_keyvalue.Value);
                        }
                    }

                    save_files.Sort(delegate(string x, string y)
                    {
                        return(get_save_value(save_cat.SAVEFILE, y).CompareTo(get_save_value(save_cat.SAVEFILE, x)));
                    });

                    nr_save_files = save_files.Count;

                    scrollbar_size  = nr_save_files * 61;
                    scrollbar_size += (Vessels_dropped.Count - nr_save_files) * 25;
                    if (_SAVE_Switched_To_Dropped && can_q_save_load)
                    {
                        scrollbar_size += 43;
                    }

                    if (scrollbar_size > 225)
                    {
                        scrollbar_enable = true;
                        scroll_Vector    = GUILayout.BeginScrollView(scroll_Vector, scrollbar_stlye, GUILayout.Width(266), GUILayout.Height(225));
                        GUILayout.BeginVertical();
                        window_height         += 220;
                        scrollbar_width_offset = 0;
                    }
                    else
                    {
                        GUILayout.BeginVertical(/* area_style, */ GUILayout.Width(266));
                        window_height         += scrollbar_size;
                        scrollbar_width_offset = 20;
                    }

                    while (save_files.Count != 0)
                    {
                        GUILayout.Space(5);
                        GUILayout.BeginVertical(); //  area_style);
                        if (save_files.Last().Contains("separated_"))
                        {
                            GUILayout.Box("Separated at " + get_time_string(Convert.ToDouble(get_save_value(save_cat.SAVEFILE, save_files.Last())) - _SAVE_Launched_At), text_main, GUILayout.Width(230 + scrollbar_width_offset));
                        }
                        else
                        {
                            GUILayout.Box("Stage " + save_files.Last().Substring(10) + " separated at " + get_time_string(Convert.ToDouble(get_save_value(save_cat.SAVEFILE, save_files.Last())) - _SAVE_Launched_At), text_main, GUILayout.Width(230 + scrollbar_width_offset));
                        }

                        foreach (KeyValuePair <Guid, string> vessel_in_savefile in Vessels_dropped)
                        {
                            if (FMRS_SAVE_Util.Instance.jumpInProgress)
                            {
                                GUI.enabled = false;
                            }
                            if (vessel_in_savefile.Value == save_files.Last())
                            {
                                GUILayout.BeginHorizontal();
                                if (get_vessel_state(vessel_in_savefile.Key) == vesselstate.RECOVERED)
                                {
                                    GUILayout.Box(Vessels_dropped_names[vessel_in_savefile.Key] + " recovered", text_cyan, GUILayout.Width(205 + scrollbar_width_offset));
                                }
                                else if (get_vessel_state(vessel_in_savefile.Key) == vesselstate.LANDED)
                                {
                                    GUILayout.Box(Vessels_dropped_names[vessel_in_savefile.Key] + " landed", text_green, GUILayout.Width(205 + scrollbar_width_offset));
                                }
                                else if (vessel_in_savefile.Key == FlightGlobals.ActiveVessel.id || vessel_in_savefile.Key == anz_id)
                                {
                                    float temp_float = 230 + scrollbar_width_offset;
                                    if (can_q_save_load)
                                    {
                                        GUILayout.EndHorizontal();
                                        GUILayout.Space(5);
                                        GUILayout.BeginVertical(/* area_style, */ GUILayout.Width(230));
                                        temp_float = 222 + scrollbar_width_offset;
                                    }
                                    if (FlightGlobals.ActiveVessel.LandedOrSplashed)
                                    {
                                        GUILayout.Box(Vessels_dropped_names[vessel_in_savefile.Key] + " landed", text_green, GUILayout.Width(temp_float));
                                    }
                                    else
                                    {
                                        GUILayout.Box("contr.: " + Vessels_dropped_names[vessel_in_savefile.Key], text_yellow, GUILayout.Width(temp_float));
                                    }
                                    if (can_q_save_load)
                                    {
                                        if (GUILayout.Button("Jump back to Separation", button_main, GUILayout.Width(222 + scrollbar_width_offset)))
                                        {
                                            jump_to_vessel(vessel_in_savefile.Key, false);
                                        }

                                        GUILayout.EndVertical();
                                        GUILayout.Space(5);
                                        GUILayout.BeginHorizontal();
                                    }
                                }
                                else if (get_vessel_state(vessel_in_savefile.Key) == vesselstate.DESTROYED)
                                {
                                    GUILayout.Box(Vessels_dropped_names[vessel_in_savefile.Key] + " destroyed", text_red, GUILayout.Width(205 + scrollbar_width_offset));
                                }
                                else
                                {
                                    temp_vessel = FlightGlobals.Vessels.Find(p => p.id == vessel_in_savefile.Key);

                                    if (temp_vessel == null)
                                    {
                                        if (GUILayout.Button(Vessels_dropped_names[vessel_in_savefile.Key], button_main, GUILayout.Width(205 + scrollbar_width_offset)))
                                        {
                                            jump_to_vessel(vessel_in_savefile.Key, true);
                                        }
                                    }
                                    else
                                    {
                                        if (loaded_vessels.Contains(temp_vessel.id) && _SAVE_Switched_To_Dropped)
                                        {
                                            if (temp_vessel.LandedOrSplashed)
                                            {
                                                if (GUILayout.Button(Vessels_dropped_names[vessel_in_savefile.Key] + " landed", button_green, GUILayout.Width(205 + scrollbar_width_offset)))
                                                {
                                                    FlightGlobals.ForceSetActiveVessel(temp_vessel);
                                                }
                                            }
                                            else
                                            {
                                                if (GUILayout.Button(Vessels_dropped_names[vessel_in_savefile.Key] + " is near", button_yellow, GUILayout.Width(205 + scrollbar_width_offset)))
                                                {
                                                    FlightGlobals.ForceSetActiveVessel(temp_vessel);
                                                }
                                            }
                                        }
                                        else
                                        {
                                            if (GUILayout.Button(Vessels_dropped_names[vessel_in_savefile.Key], button_main, GUILayout.Width(205 + scrollbar_width_offset)))
                                            {
                                                jump_to_vessel(vessel_in_savefile.Key, true);
                                            }
                                        }
                                    }
                                }

                                if (vessel_in_savefile.Key != FlightGlobals.ActiveVessel.id && vessel_in_savefile.Key != anz_id)
                                {
                                    if (GUILayout.Button("X", button_small_red, GUILayout.Width(25)))
                                    {
                                        guid_delete_vessel = vessel_in_savefile.Key;
                                        delete_vessel      = true;
                                    }
                                }
                                GUILayout.EndHorizontal();
                                button_main.normal.textColor = button_main.focused.textColor = Color.white;
                            }
                            GUI.enabled = true;
                        }
                        GUILayout.EndVertical();
                        temp_string = save_files.Last();
                        save_files.Remove(temp_string);
                    }

                    if (scrollbar_enable)
                    {
                        GUILayout.EndVertical();
                        GUILayout.EndScrollView();
                    }
                    else
                    {
                        GUILayout.EndVertical();
                    }
                }

                if (_SAVE_Switched_To_Dropped)
                {
                    GUILayout.Space(5);
                    window_height += 5;
                    if (FMRS_SAVE_Util.Instance.jumpInProgress)
                    {
                        GUI.enabled = false;
                    }
                    if (GUILayout.Button("Jump back to Main Mission", button_big, GUILayout.Width(266)))
                    {
                        jump_to_vessel("Main");
                    }
                    GUI.enabled    = true;
                    window_height += 31;
                }

                if (_SAVE_Has_Launched && can_restart)
                {
                    GUILayout.Space(5);
                    window_height += 5;
                    if (FMRS_SAVE_Util.Instance.jumpInProgress)
                    {
                        GUI.enabled = false;
                    }
                    if (revert_to_launch)
                    {
                        GUILayout.Box("Revert Flight?", text_heading, GUILayout.Width(266));

                        GUILayout.BeginHorizontal();

                        if (GUILayout.Button("YES", button_big, GUILayout.Width(132)))
                        {
                            // _SETTING_Enabled = false;
                            jump_to_vessel(_SAVE_Main_Vessel, "before_launch");
                        }
                        if (GUILayout.Button("NO", button_big, GUILayout.Width(133)))
                        {
                            revert_to_launch = false;
                        }

                        GUILayout.EndHorizontal();
                        window_height += 58;
                    }
                    else
                    {
                        if (_SAVE_Flight_Reset)
                        {
                            revert_to_launch = GUILayout.Toggle(revert_to_launch, "Revert To Plugin Start", button_big, GUILayout.Width(266));
                        }
                        else
                        {
                            revert_to_launch = GUILayout.Toggle(revert_to_launch, "Revert To Launch", button_big, GUILayout.Width(266));
                        }
                        window_height += 31;
                    }
                    GUI.enabled = true;
                }
            }
            GUILayout.EndVertical();

            if (delete_vessel && guid_delete_vessel != FlightGlobals.ActiveVessel.id)
            {
                delete_dropped_vessel(guid_delete_vessel);
            }

            windowPos.height = window_height;
            //   windowPos.width = window_width;

            GUI.DragWindow();
        }
示例#12
0
        /// <summary>
        /// Darws the Info window where the new saved partfile can be configured
        /// </summary>
        /// <param name="windowID"></param>
        private void HandleInfoWindow(int windowID)
        {
            float    margin       = 5f;
            float    height       = 20;
            float    posH         = height;
            float    columnWidth  = (Constants.guiInfoWindowW - (margin * 5)) / 4;
            float    columnHeight = (Constants.guiInfoWindowH - ((height + margin) * 2));
            float    scrollwidth  = columnWidth - 20.0f;
            GUIStyle style        = new GUIStyle();

            for (int i = 0; i < 4; i++)
            {
                _guiInfoWindowColoumns[i] = new Rect((margin * (i + 1)) + (columnWidth * i), height, columnWidth, columnHeight);
                posH = height;
                switch (i)
                {
                case 0:
                {
                    GUI.Label(new Rect(_guiInfoWindowColoumns[i].x, posH, columnWidth, height), "Name:");
                    posH += height + margin;
                    //_welder.Name = _textFieldTitle.DrawAdvancedGUITextField(new Rect(_guiInfoWindowColoumns[i].x, posH, columnWidth, height), _welder.Name, 100, (int)this.state);
                    _welder.Name = GUI.TextField(new Rect(_guiInfoWindowColoumns[i].x, posH, columnWidth, height), _welder.Name, 100);
                    posH        += height + margin;
                    GUI.Label(new Rect(_guiInfoWindowColoumns[i].x, posH, columnWidth, height), "Title:");
                    posH += height + margin;
                    //_welder.Title = _textFieldTitle.DrawAdvancedGUITextField(new Rect(_guiInfoWindowColoumns[i].x, posH, columnWidth, height), _welder.Title, 100, (int)this.state);
                    _welder.Title = GUI.TextField(new Rect(_guiInfoWindowColoumns[i].x, posH, columnWidth, height), _welder.Title, 100);
                    posH         += height + margin;
                    GUI.Label(new Rect(_guiInfoWindowColoumns[i].x, posH, columnWidth, height), "Description:");
                    posH += height + margin;
                    //_welder.Description = _textAreaDescription.DrawAdvancedGUITextArea(new Rect(_guiInfoWindowColoumns[i].x, posH, columnWidth, 7 * height + 6 * margin), _welder.Description, 600, (int)this.state);
                    _welder.Description = GUI.TextArea(new Rect(_guiInfoWindowColoumns[i].x, posH, columnWidth, 8 * height + 7 * margin), _welder.Description, 600);
                    posH += 8 * height + 8 * margin;
                    GUI.Label(new Rect(_guiInfoWindowColoumns[i].x, posH, columnWidth, height), "Symmetry:");
                    posH += height + margin;
                    _welder.stringStackSymmetry = GUI.TextField(new Rect(_guiInfoWindowColoumns[i].x, posH, columnWidth, height), _welder.stringStackSymmetry, 100);
                }
                break;

                case 1:
                {
                    GUI.Label(new Rect(_guiInfoWindowColoumns[i].x, posH, columnWidth, height), "Category:");
                    posH += height + margin;
                    Rect _cetegoryBox = new Rect(_guiInfoWindowColoumns[i].x, posH, columnWidth, height);
                    posH += height + margin;
                    GUI.Label(new Rect(_guiInfoWindowColoumns[i].x, posH, columnWidth, height), "RequiredTech:");
                    posH += height + margin;
                    Rect _techBox = new Rect(_guiInfoWindowColoumns[i].x, posH, columnWidth, height);
                    posH += height + margin;
                    Rect _vesselTypeBox = new Rect();
                    if (_welder.vesselTypeList.Count > 0)
                    {
                        GUI.Label(new Rect(_guiInfoWindowColoumns[i].x, posH, columnWidth, height), "VesselType:");
                        posH          += height + margin;
                        _vesselTypeBox = new Rect(_guiInfoWindowColoumns[i].x, posH, columnWidth, height);
                        posH          += height + margin;
                    }
                    GUI.Label(new Rect(_guiInfoWindowColoumns[i].x, posH, columnWidth, height), string.Format("Nb Parts: {0}", _welder.NbParts));
                    posH += height + margin;
                    GUI.Label(new Rect(_guiInfoWindowColoumns[i].x, posH, columnWidth, height), string.Format("Cost: {0:F2}", _welder.Cost));
                    posH += height + margin;
                    GUI.Label(new Rect(_guiInfoWindowColoumns[i].x, posH, columnWidth, height), string.Format("Mass: {0:F3} / {1:F3}", _welder.Mass, _welder.WetMass));
                    posH += height + margin;
                    GUI.Label(new Rect(_guiInfoWindowColoumns[i].x, posH, columnWidth, height), string.Format("Temp: {0:F1}", _welder.MaxTemp));
                    posH += height + margin;
                    GUI.Label(new Rect(_guiInfoWindowColoumns[i].x, posH, columnWidth, height), string.Format("B Force: {0:F3}", _welder.BreakingForce));
                    posH += height + margin;
                    GUI.Label(new Rect(_guiInfoWindowColoumns[i].x, posH, columnWidth, height), string.Format("B Torque: {0:F3}", _welder.BreakingTorque));
                    posH += height + margin;
                    GUI.Label(new Rect(_guiInfoWindowColoumns[i].x, posH, columnWidth, height), string.Format("Drag: {0:F3} / {1:F3}", _welder.MinDrag, _welder.MaxDrag));

                    if (_techDropdown.IsOpen || _catDropdown.IsOpen)
                    {
                        GUI.Box(_vesselTypeBox, _welder.vesselType);
                    }
                    else
                    {
                        if (_welder.vesselTypeList.Count > 0)
                        {
                            _welder.vesselType = _welder.vesselTypeList[_vesselTypeDropdown.Show(_vesselTypeBox)];
                        }
                    }

                    if (_catDropdown.IsOpen)
                    {
                        GUI.Box(_techBox, _welder.techRequire);
                    }
                    else
                    {
                        _welder.techRequire = _welder.techList[_techDropdown.Show(_techBox)];
                    }
                    _catDropdown.SelectedItemIndex = (int)_welder.Category;
                    _welder.Category = (PartCategories)_catDropdown.Show(_cetegoryBox);
                }
                break;

                case 2:
                {
                    GUI.Label(new Rect(_guiInfoWindowColoumns[i].x, posH, columnWidth, height), "Modules:");
                    posH += height + margin;
                    string[] modulenames = _welder.Modules;
                    _scrollMod             = GUI.BeginScrollView(new Rect(_guiInfoWindowColoumns[i].x, posH, columnWidth, (height * 14 + margin * 13)), _scrollMod, new Rect(0, 0, scrollwidth, modulenames.Length > 14 ? 345 + (modulenames.Length - 14) * (height + margin) : 345), false, true);
                    style.wordWrap         = false;
                    style.normal.textColor = Color.white;
                    posH = 0;
                    foreach (string modulename in modulenames)
                    {
                        GUI.Label(new Rect(2, posH, scrollwidth, height), modulename, style);
                        posH += height + margin;
                    }
                    GUI.EndScrollView();
                }
                break;

                case 3:
                {
                    GUI.Label(new Rect(_guiInfoWindowColoumns[i].x, posH, columnWidth, height), "Resources:");
                    posH += height + margin;
                    string[] resourcesdata = _welder.Resources;
                    _scrollRes             = GUI.BeginScrollView(new Rect(_guiInfoWindowColoumns[i].x, posH, columnWidth, (height * 14 + margin * 13)), _scrollRes, new Rect(0, 0, scrollwidth, resourcesdata.Length > 14 ? 345 + (resourcesdata.Length - 14) * (height + margin) : 345), false, true);
                    style.wordWrap         = false;
                    style.normal.textColor = Color.white;
                    posH = 0;
                    foreach (string resname in resourcesdata)
                    {
                        GUI.Label(new Rect(2, posH, scrollwidth, height), resname, style);
                        posH += height + margin;
                    }
                    GUI.EndScrollView();
                }
                break;

                default:
                {
                    GUI.Label(new Rect(0, posH, columnWidth, height), "Broken GUI Column:");
                }
                break;
                }
            }

            if (!WelderNameNotUsed())
            {
                style.normal.textColor = Color.red;
                GUI.Label(new Rect(margin, columnHeight + margin, columnWidth * 1.5f, height), Constants.guiNameUsed, style);
            }
            if (!isSymmetryNumber())
            {
                style.normal.textColor = Color.red;
                GUI.Label(new Rect(margin, height + columnHeight + margin, columnWidth * 1.5f, height), Constants.guiSymmetryNotNumbered, style);
            }


            if (!string.IsNullOrEmpty(_welder.Name))
            {
                if (GUI.Button(new Rect(_guiInfoWindowColoumns[1].x + columnWidth * 0.5f, height + columnHeight + margin, columnWidth * 0.5f, height), Constants.guiSave))
                {
                    //check if the file exist
                    string welding_pathname = this.welding_pathname;                     // Cache the built pathname
                    if (!File <UbioZurWeldingLtd> .Local.Exists(welding_pathname))
                    {
                        //create the file (why? LisiasT)
                        L.StreamWriter partfile = File <UbioZurWeldingLtd> .Local.CreateText(welding_pathname);

                        partfile.Close();

                        WriteCfg(welding_pathname);
                        this.state = DisplayState.savedWindow;
                    }
                    else
                    {
                        this.state = DisplayState.overwriteDial;
                    }
                }
            }
            else
            {
                GUI.Box(new Rect(_guiInfoWindowColoumns[1].x + columnWidth * 0.5f, height + columnHeight + margin, columnWidth * 0.5f, height), Constants.guiSave);
            }
            if (GUI.Button(new Rect(_guiInfoWindowColoumns[2].x, height + columnHeight + margin, columnWidth * 0.5f, height), Constants.guiCancel))
            {
                this.state = DisplayState.none;
                ClearEditor();
            }
            GUI.DragWindow();
        }
示例#13
0
        private void DisplayCDI(int id)
        {
            float width       = window.width;
            float height      = window.height;
            float ctrl_width  = width - 60;
            float ctrl_height = height - 80;

            float minV = -1;
            float maxV = 1;

            GUI.backgroundColor = Color.clear;

            if (bShowH)
            {
                float delta = (float)deviationH;
                float value;

                String deltaString;

                if (delta < 0)
                {
                    value = (float)(Math.Sqrt(-delta) * -0.1);

                    if (delta > -0.5f)
                    {
                        deltaString = "0 m";
                    }
                    else
                    {
                        deltaString = String.Format("{0:F0} m", delta);
                    }
                }
                else
                {
                    value = (float)(Math.Sqrt(delta) * 0.1);

                    if (delta < 0.5f)
                    {
                        deltaString = "0 m";
                    }
                    else
                    {
                        deltaString = String.Format("+{0:F0} m", delta);
                    }
                }

                GUI.Label(new Rect(20, 0, ctrl_width, 20), deltaString,
                          GeneralUI.UISkin.customStyles[(int)myStyles.cdiLabel]);

                GUI.backgroundColor = XKCDColors.NeonRed;
                DrawIndicatorH(new Rect(20, 20, ctrl_width, 20), -value, minV, maxV);
                GUI.backgroundColor = Color.clear;
            }

            if (bShowV)
            {
                double delta = deviationV;
                float  value;

                String deltaString;

                if (delta < 0)
                {
                    value = (float)(Math.Sqrt(-delta) * -0.1);

                    if (delta > -0.5f)
                    {
                        deltaString = "0 m";
                    }
                    else
                    {
                        deltaString = String.Format("{0:F0} m", delta);
                    }
                }
                else
                {
                    value = (float)(Math.Sqrt(delta) * 0.1);

                    if (delta < 0.5f)
                    {
                        deltaString = "0 m";
                    }
                    else
                    {
                        deltaString = String.Format("+{0:F0} m", delta);
                    }
                }

                GUI.backgroundColor = XKCDColors.NeonRed;
                DrawIndicatorV(new Rect(width - 40, 40, 20, ctrl_height), value, minV, maxV);
                GUI.backgroundColor = Color.clear;

                float barX = (width - 30) - 2;

                GUI.Label(new Rect(barX - 45, 40 + ctrl_height, 90, 20), deltaString,
                          GeneralUI.UISkin.customStyles[(int)myStyles.cdiLabel]);
            }
            // uncommented the following to allow user to move the CDI whereever they want
            if (!George.lockCDI)
            {
                GUI.DragWindow();
            }
        }
示例#14
0
 private void LineLabel(string label, ref float line)
 {
     GUI.Label(LineRect(ref line), label, HighLogic.Skin.label);
 }
示例#15
0
        private void ToolbarWindow(int windowID)
        {
            float line = 0;

            line += 1.25f;

            if (FlightGlobals.ActiveVessel && (FlightGlobals.ActiveVessel.LandedOrSplashed || VesselMove.Instance.IsMovingVessel))
            {
                if (!VesselMove.Instance.IsMovingVessel)
                {
                    if (GUI.Button(LineRect(ref line, 1.5f), "Move Vessel", HighLogic.Skin.button))
                    {
                        VesselMove.Instance.StartMove(FlightGlobals.ActiveVessel, true);
                    }
                    line += 0.2f;

                    Rect spawnVesselRect = LineRect(ref line);
                    svRectScreenSpace    = new Rect(spawnVesselRect);
                    svRectScreenSpace.x += toolbarRect.x;
                    svRectScreenSpace.y += toolbarRect.y;

                    if (GUI.Button(spawnVesselRect, "Spawn Vessel", HighLogic.Skin.button))
                    {
                        VesselSpawn.instance.StartVesselSpawn();
                    }

                    line += .75f;
                    Rect crewRect1 = LineRect(ref line);
                    Rect crewRect2 = new Rect(crewRect1.x + crewRect1.width / 2 + 5f, crewRect1.y, crewRect1.width / 2, crewRect1.height);
                    crewRect1.width      = crewRect1.width / 2;
                    svCrewScreenSpace    = new Rect(crewRect1);
                    svCrewScreenSpace.x += toolbarRect.x;
                    svCrewScreenSpace.y += toolbarRect.y;
                    addCrewMembers       = GUI.Toggle(crewRect1, addCrewMembers, "Spawn Crew");
                    if (!addCrewMembers)
                    {
                        GUI.enabled = false;
                    }
                    selectCrewMembers = GUI.Toggle(crewRect2, selectCrewMembers, "Choose Crew");
                    GUI.enabled       = true;
                    showMoveHelp      = false;
                }
                else
                {
                    if (GUI.Button(LineRect(ref line, 2), "Place Vessel", HighLogic.Skin.button))
                    {
                        VesselMove.Instance.EndMove();
                    }

                    line += 0.3f;

                    if (GUI.Button(LineRect(ref line, 2), "Drop Vessel", HighLogic.Skin.button))
                    {
                        VesselMove.Instance.DropMove();
                    }

                    line += 0.3f;

                    if (GUI.Button(LineRect(ref line), "Help", HighLogic.Skin.button))
                    {
                        showMoveHelp = !showMoveHelp;
                    }
                }
            }
            else
            {
                GUIStyle centerLabelStyle = new GUIStyle(HighLogic.Skin.label);
                centerLabelStyle.alignment = TextAnchor.UpperCenter;
                GUI.Label(LineRect(ref line), "You need to be landed to use this!", centerLabelStyle);
            }

            toolbarRect.height = (line * toolbarLineHeight) + (toolbarMargin * 2);
            GUI.DragWindow(new Rect(0, 0, Screen.width, 30));
            VMUtils.RepositionWindow(ref toolbarRect);
        }
示例#16
0
        void ToolbarWindow(int windowID)
        {
            float line = 0;

            line += 1.25f;

            if (!FlightGlobals.ActiveVessel)
            {
                return;
            }

            if (AirPark.Instance)
            {
                if (!AirParkInstance.Parked)
                {
                    if (GUI.Button(LineRect(ref line, 1.5f), "Park Vessel", HighLogic.Skin.button))
                    {
                        if (FlightGlobals.ActiveVessel && !FlightGlobals.ActiveVessel.Landed)
                        {
                            AirPark.Instance.TogglePark();
                        }
                    }
                }
                else
                {
                    if (GUI.Button(LineRect(ref line, 2), "Un-Park", HighLogic.Skin.button))
                    {
                        AirPark.Instance.TogglePark();
                    }
                }

                line += 0.2f;
                {
                    Rect spawnVesselRect = LineRect(ref line);
                    svRectScreenSpace    = new Rect(spawnVesselRect);
                    svRectScreenSpace.x += toolbarRect.x;
                    svRectScreenSpace.y += toolbarRect.y;
                    if (!AirPark.autoPark)
                    {
                        if (GUI.Button(spawnVesselRect, "Auto-Park OFF", HighLogic.Skin.button))
                        {
                            AirPark.Instance.ToggleAutoPark();
                        }
                    }
                    else
                    {
                        if (GUI.Button(spawnVesselRect, "Auto-Park ON", HighLogic.Skin.button))
                        {
                            AirPark.Instance.ToggleAutoPark();
                        }
                    }
                }

                {
                    line += 0.2f;
                    Rect spawnVesselRect = LineRect(ref line);
                    svRectScreenSpace    = new Rect(spawnVesselRect);
                    svRectScreenSpace.x += toolbarRect.x;
                    svRectScreenSpace.y += toolbarRect.y;
                    if (!AirPark.isSuborbitalParkAllowed)
                    {
                        if (GUI.Button(spawnVesselRect, "Sub Orbital Park OFF", HighLogic.Skin.button))
                        {
                            AirPark.Instance.ToggleSubOrbitalPark();
                        }
                    }
                    else
                    {
                        if (GUI.Button(spawnVesselRect, "Sub Orbital Park ON", HighLogic.Skin.button))
                        {
                            AirPark.Instance.ToggleSubOrbitalPark();
                        }
                    }
                }
            }
            else
            {
                GUIStyle centerLabelStyle = new GUIStyle(HighLogic.Skin.label)
                {
                    alignment = TextAnchor.UpperCenter
                };
                GUI.Label(LineRect(ref line), "No AirPark Module Found", centerLabelStyle);
            }

            toolbarRect.height = (line * toolbarLineHeight) + (toolbarMargin * 2);
        }
示例#17
0
 private void TooltipWindow(int id)
 {
     GUI.Label(new Rect(2, 0, tooltipRect.width - 2, tooltipRect.height), ToolTip, HighLogic.Skin.label);
 }
        private static void OnWindow(int winID)
        {
            rwyListLength = Rwy.customRunways.Count * 40;

            rwyListVector = GUI.BeginScrollView(new Rect(10, 20, 150, 270), rwyListVector, new Rect(0, 0, 135, rwyListLength + 35));

            if (GUI.Button(new Rect(2, 0, 130, 30), "Create Runway"))
            {
                tempRwy  = new NavUtilLib.Runway();
                isNewRwy = true;
            }

            for (int i = 0; i < Rwy.customRunways.Count; i++)
            {
                if (i == Rwy.cRwyIdx && !isNewRwy)
                {
                    if (GUI.Button(new Rect(2, (i * 40) + 40, 130, 30), "* " + Rwy.customRunways[i].ident))
                    {
                        Rwy.cRwyIdx = i;
                        tempRwy     = Rwy.customRunways[i];
                        isNewRwy    = false;
                    }
                }
                else
                {
                    if (GUI.Button(new Rect(2, (i * 40) + 40, 130, 30), Rwy.customRunways[i].ident))
                    {
                        Rwy.cRwyIdx = i;
                        tempRwy     = Rwy.customRunways[i];
                        isNewRwy    = false;
                    }
                }
            }
            GUI.EndScrollView();
            //begin runway info area

            GUI.Label(new Rect(170, 20, 200, 20), "Runway Ident");

            GUI.Label(new Rect(170, 70, 150, 20), "Runway Heading");

            GUI.Label(new Rect(170, 120, 150, 20), "Runway Elevation (m)");



            GUI.Label(new Rect(170, 185, 240, 20), "Marker distance from current point (m)");

            GUI.Label(new Rect(190, 200, 60, 20), " Inner");
            GUI.Label(new Rect(260, 200, 60, 20), " Middle");
            GUI.Label(new Rect(330, 200, 60, 20), " Outer");


            //isNewRwy


            //only difference is textbox vs label
            if (isNewRwy)
            {
                GUI.Label(new Rect(340, 70, 85, 20), "Auto Hdg?");
                useAutoHdg = GUI.Toggle(new Rect(350, 90, 20, 20), useAutoHdg, "");

                GUI.Label(new Rect(340, 120, 85, 20), "Auto Elevation?");
                useAutoElevation = GUI.Toggle(new Rect(350, 140, 20, 20), useAutoElevation, "");


                tempRwy.ident = GUI.TextField(new Rect(170, 40, 200, 20), tempRwy.ident);

                GUI.Label(new Rect(340, 70, 85, 20), "Auto Hdg?");
                useAutoHdg = GUI.Toggle(new Rect(350, 90, 20, 20), useAutoHdg, "");
                if (useAutoHdg)
                {
                    tempRwy.hdg = (float)Math.Round(FlightGlobals.ship_heading, 2);

                    GUI.Label(new Rect(170, 90, 150, 20), tempRwy.hdg.ToString() + "°");
                }
                else
                {
                    tempRwy.hdg = Convert.ToSingle(GUI.TextField(new Rect(170, 90, 150, 20), Convert.ToString(tempRwy.hdg)));
                }

                GUI.Label(new Rect(340, 120, 85, 20), "Auto Alt?");
                useAutoElevation = GUI.Toggle(new Rect(350, 140, 20, 20), useAutoElevation, "");
                if (useAutoElevation)
                {
                    tempRwy.altMSL = (float)Math.Round(FlightGlobals.ActiveVessel.altitude, 1);

                    GUI.Label(new Rect(170, 140, 150, 20), Convert.ToString(tempRwy.altMSL) + "m");
                }
                else
                {
                    tempRwy.altMSL = Convert.ToSingle(GUI.TextField(new Rect(170, 140, 150, 20), Convert.ToString(tempRwy.altMSL)));
                }



                GUI.Label(new Rect(170, 165, 120, 20), "Use Marker Becons?");
                makeMarkers = GUI.Toggle(new Rect(350, 168, 20, 20), makeMarkers, "");


                if (makeMarkers)
                {
                    tempRwy.innerMarkerDist = Convert.ToSingle(GUI.TextField(new Rect(190, 220, 60, 20), Convert.ToString(tempRwy.innerMarkerDist)));

                    tempRwy.middleMarkerDist = Convert.ToSingle(GUI.TextField(new Rect(260, 220, 60, 20), Convert.ToString(tempRwy.middleMarkerDist)));
                    tempRwy.outerMarkerDist  = Convert.ToSingle(GUI.TextField(new Rect(330, 220, 60, 20), Convert.ToString(tempRwy.outerMarkerDist)));

                    if (tempRwy.innerMarkerDist < -500)
                    {
                        tempRwy.innerMarkerDist = -500;
                    }


                    if (tempRwy.middleMarkerDist < -500)
                    {
                        tempRwy.middleMarkerDist = -500;
                    }


                    if (tempRwy.outerMarkerDist < -500)
                    {
                        tempRwy.outerMarkerDist = -500;
                    }
                }
            }
            else
            {
                GUI.Label(new Rect(170, 40, 200, 20), tempRwy.ident);

                GUI.Label(new Rect(170, 90, 150, 20), tempRwy.hdg.ToString() + "°");
                GUI.Label(new Rect(170, 140, 150, 20), Convert.ToString(tempRwy.altMSL) + "m");

                if (tempRwy.innerMarkerDist > -500)
                {
                    GUI.Label(new Rect(190, 220, 60, 20), tempRwy.innerMarkerDist.ToString() + "m");
                }
                else
                {
                    GUI.Label(new Rect(190, 220, 60, 20), "  N/A");
                }

                if (tempRwy.middleMarkerDist > -500)
                {
                    GUI.Label(new Rect(260, 220, 60, 20), tempRwy.middleMarkerDist.ToString() + "m");
                }
                else
                {
                    GUI.Label(new Rect(260, 220, 60, 20), "  N/A");
                }

                if (tempRwy.outerMarkerDist > -500)
                {
                    GUI.Label(new Rect(330, 220, 60, 20), tempRwy.outerMarkerDist.ToString() + "m");
                }
                else
                {
                    GUI.Label(new Rect(330, 220, 60, 20), "  N/A");
                }
            }

            if (isNewRwy)
            {
                if (GUI.Button(new Rect(170, 250, 200, 20), "Create Runway"))
                {
                    //create the runway and add to database
                    tempRwy.body        = FlightGlobals.currentMainBody.bodyName;
                    tempRwy.gsLatitude  = (float)FlightGlobals.ship_latitude;
                    tempRwy.gsLongitude = (float)FlightGlobals.ship_longitude;

                    Vector2d loc = NavUtilLib.Utils.CalcCoordinatesFromInitialPointBearingDistance(new Vector2d(tempRwy.gsLatitude, tempRwy.gsLongitude), tempRwy.hdg, 1000, FlightGlobals.currentMainBody.Radius);

                    tempRwy.locLatitude  = (float)loc.x;
                    tempRwy.locLongitude = (float)loc.y;

                    if (!makeMarkers)
                    {
                        tempRwy.innerMarkerDist  = -1000;
                        tempRwy.middleMarkerDist = -1000;
                        tempRwy.outerMarkerDist  = -1000;
                    }


                    Rwy.customRunways.Add(tempRwy);
                    Rwy.currentBodyRunways.Add(tempRwy);

                    Rwy.cRwyIdx = Rwy.customRunways.FindIndex(r => r.ident == tempRwy.ident);

                    WriteCustomRwys();

                    isNewRwy = false;
                }
            }
            else
            {
                //show delete button
                if (GUI.Button(new Rect(170, 250, 200, 20), "Delete This Runway"))
                {
                    Rwy.allRunways.Remove(Rwy.customRunways[Rwy.cRwyIdx]);
                    if (Rwy.currentBodyRunways.Contains(Rwy.customRunways[Rwy.cRwyIdx]))
                    {
                        Rwy.currentBodyRunways.Remove(Rwy.customRunways[Rwy.cRwyIdx]);
                    }
                    Rwy.customRunways.Remove(Rwy.customRunways[Rwy.cRwyIdx]);

                    WriteCustomRwys();

                    Rwy.cRwyIdx = 0;

                    isNewRwy = true;
                    tempRwy  = new NavUtilLib.Runway();
                }
            }
            GUI.DragWindow();
        }