Exemple #1
0
 internal void FillVesselCrew(Vessel vessel)
 {
     foreach (var part in vessel.parts)
     {
         if (part.CrewCapacity > 0)
         {
             FillPartCrew(part.CrewCapacity - part.protoModuleCrew.Count, part);
         }
     }
     RMAddon.FireEventTriggers(vessel);
 }
Exemple #2
0
 internal static void AddCrewMember(ProtoCrewMember pKerbal, Part part)
 {
     part.AddCrewmember(pKerbal);
     pKerbal.rosterStatus = ProtoCrewMember.RosterStatus.Assigned;
     if (part.internalModel != null)
     {
         if (pKerbal.seat != null)
         {
             pKerbal.seat.SpawnCrew();
         }
     }
     RMAddon.FireEventTriggers(part.vessel);
 }
Exemple #3
0
 internal void EmptyVesselCrew(Vessel vessel)
 {
     foreach (var part in vessel.parts)
     {
         if (part.CrewCapacity > 0)
         {
             for (int i = part.protoModuleCrew.Count - 1; i >= 0; i--)
             {
                 RMAddon.RemoveCrewMember(part.protoModuleCrew[i], part);
             }
             RMAddon.FireEventTriggers(vessel);
         }
     }
 }
Exemple #4
0
 internal static void AddCrewMember(ProtoCrewMember pKerbal, Vessel vessel)
 {
     foreach (Part part in vessel.parts)
     {
         if (part.CrewCapacity > 0 && !RMAddon.CrewPartIsFull(part))
         {
             part.AddCrewmember(pKerbal);
             pKerbal.rosterStatus = ProtoCrewMember.RosterStatus.Assigned;
             if (part.internalModel != null)
             {
                 if (pKerbal.seat != null)
                 {
                     pKerbal.seat.SpawnCrew();
                 }
             }
             RMAddon.FireEventTriggers(part.vessel);
             break;
         }
     }
 }
Exemple #5
0
        internal static void Display(int windowId)
        {
            // Reset Tooltip active flag...
            ToolTipActive = false;

            Rect rect = new Rect(Position.width - 20, 4, 16, 16);

            if (GUI.Button(rect, new GUIContent("", "Close Window")))
            {
                OnCreate       = false;
                SelectedKerbal = null;
                ToolTip        = "";
                if (HighLogic.LoadedScene == GameScenes.SPACECENTER)
                {
                    RMAddon.OnRMRosterToggle();
                }
                else
                {
                    ShowWindow = false;
                }
            }
            if (Event.current.type == EventType.Repaint && ShowToolTips == true)
            {
                ToolTip = Utilities.SetActiveTooltip(rect, Position, GUI.tooltip, ref ToolTipActive, 0, 0);
            }
            try
            {
                GUIStyle style        = GUI.skin.button;
                var      defaultColor = style.normal.textColor;
                GUILayout.BeginVertical();
                DisplayRosterFilter();

                DisplayRosterListViewer();

                if (OnCreate)
                {
                    CreateKerbalViewer();
                }
                else if (SelectedKerbal != null)
                {
                    GUILayout.Label("Kerbal Manager", RMStyle.LabelStyleBoldCenter, GUILayout.Width(680));
                    DisplayTabButtons();
                    DisplaySelectedTab();
                }
                else
                {
                    GUILayout.BeginHorizontal();
                    if (GUILayout.Button("Create Kerbal"))
                    {
                        OnCreate = true;
                    }
                    var settingsStyle = WindowSettings.ShowWindow ? RMStyle.ButtonToggledStyle : RMStyle.ButtonStyle;
                    if (GUILayout.Button("Settings", settingsStyle))
                    {
                        try
                        {
                            WindowSettings.ShowWindow = !WindowSettings.ShowWindow;
                            if (WindowSettings.ShowWindow)
                            {
                                // Store settings in case we cancel later...
                                RMSettings.StoreTempSettings();
                            }
                        }
                        catch (Exception ex)
                        {
                            Utilities.LogMessage(string.Format(" opening Settings Window.  Error:  {0} \r\n\r\n{1}", ex.Message, ex.StackTrace), "Error", true);
                        }
                    }

                    if (RMSettings.RenameWithProfession)
                    {
                        string toolTip = "This action resets all renamed Kerbals to their KSP default professions.\r\nIt removes any non printing chars used to maintain a specific profession.\r\nUse this when you wish to revert a game save to be compatabile with KerbalStats\r\n or some other mod that creates custom professions.";
                        if (GUILayout.Button(new GUIContent("Reset Professions", toolTip)))
                        {
                            ResetKerbalProfessions();
                        }
                    }
                    rect = GUILayoutUtility.GetLastRect();
                    if (Event.current.type == EventType.Repaint && ShowToolTips == true)
                    {
                        ToolTip = Utilities.SetActiveTooltip(rect, Position, GUI.tooltip, ref ToolTipActive, 30, 30 - ScrollViewerPosition.y);
                    }
                    GUILayout.EndHorizontal();
                }
                GUILayout.EndVertical();
                GUI.DragWindow(new Rect(0, 0, Screen.width, 30));
            }
            catch (Exception ex)
            {
                Utilities.LogMessage(string.Format(" in Roster Window.  Error:  {0} \r\n\r\n{1}", ex.Message, ex.StackTrace), "Error", true);
            }
        }
Exemple #6
0
 internal static void RemoveCrewMember(ProtoCrewMember pKerbal, Part part)
 {
     part.RemoveCrewmember(pKerbal);
     pKerbal.rosterStatus = ProtoCrewMember.RosterStatus.Available;
     RMAddon.FireEventTriggers(part.vessel);
 }
Exemple #7
0
 internal void RespawnCrew(Vessel vessel)
 {
     vessel.SpawnCrew();
     RMAddon.FireEventTriggers(vessel);
 }