private void OnKerbalHired(ProtoCrewMember crew, int num)
        {
            double currentTime = Planetarium.GetUniversalTime();
            KeyValuePair <string, RMKerbal> rmkerbal = RMLifeSpan.Instance.RMKerbals.AllrmKerbals.FirstOrDefault(a => a.Key == crew.name);

            rmkerbal.Value.Timelastsalary = currentTime;
            rmkerbal.Value.TimeSalaryDue  = RMKerbal.SalaryNextDue(currentTime);
            RmUtils.LogMessage($"RosterManagerLifeSpanAddon.onKerbalHired {crew.name} has been hired to the crew roster.", "info", RMSettings.VerboseLogging);
        }
Esempio n. 2
0
 protected void OnDestroy()
 {
     RmUtils.LogMessage("RosterManagerLifeSpan.Awake OnDestroy...", "info", RMSettings.VerboseLogging);
     foreach (Component child in _children)
     {
         RmUtils.LogMessage($"RosterManagerLifeSpan.Awake Destroying {child.name}", "info", RMSettings.VerboseLogging);
         Destroy(child);
     }
     _children.Clear();
 }
 private void ProcessContractDispute(ProtoCrewMember crew, KeyValuePair <string, RMKerbal> kerbal, double currentTime, bool start, bool extend)
 {
     // They will continue to work for RMLifeSpan.Instance.rmGameSettings.MaxContractDisputePeriods of salaryperiod, with a payrise that must be accepted each time. All backpay is accrued.
     // Or they quit/strike after RMLifeSpan.Instance.rmGameSettings.MaxContractDisputePeriods or if user does not accept the payrise.
     RmUtils.LogMessage($"RosterManagerLifeSpanAddon.CheckSalary unable to pay {crew.name} salary.", "info", RMSettings.VerboseLogging);
     if (start)                                                                                                                          //Start a new contract dispute
     {
         ScreenMessages.PostScreenMessage($"{Localizer.Format("#autoLOC_RM_1103")} {crew.name}", 5.0f, ScreenMessageStyle.UPPER_CENTER); // #autoLOC_RM_1103 = Insufficient funds to pay {0} salary at this time.
         kerbal.Value.SalaryContractDispute = true;
         kerbal.Value.RealTrait             = kerbal.Value.Trait;
         //Start processing dispute, increase the periods we have been in dispute, user must accept payrise as well (if they don't the kerbal Quits) and calculate and store their backpay owed.
         ExtendContractDispute(crew, kerbal);
     }
     else // Process existing contract dispute
     {
         //Check if we have funds now?
         //If we have pay them.
         //Else extend the contract dispute.
         if (Funding.CanAfford((float)kerbal.Value.Salary + (float)kerbal.Value.OwedSalary))
         {
             Funding.Instance.AddFunds(-(kerbal.Value.Salary + kerbal.Value.OwedSalary), TransactionReasons.CrewRecruited);
             kerbal.Value.Timelastsalary                 = currentTime;
             kerbal.Value.SalaryContractDispute          = false;
             kerbal.Value.SalaryContractDisputeProcessed = true;
             kerbal.Value.SalaryContractDisputePeriods   = 0;
             kerbal.Value.PayriseRequired                = 0d;
             kerbal.Value.OwedSalary = 0d;
             //If they are a tourist (dispute) and not dead (DeepFreeze frozen/comatose) set them back to crew
             if (kerbal.Value.Type == ProtoCrewMember.KerbalType.Tourist && crew.rosterStatus != ProtoCrewMember.RosterStatus.Dead)
             {
                 kerbal.Value.Type  = ProtoCrewMember.KerbalType.Crew;
                 crew.type          = ProtoCrewMember.KerbalType.Crew;
                 kerbal.Value.Trait = kerbal.Value.RealTrait;
                 crew.trait         = kerbal.Value.RealTrait;
                 KerbalRoster.SetExperienceTrait(crew, crew.trait);
                 RMKerbal.RegisterExperienceTrait(kerbal.Value);
             }
             RmUtils.LogMessage($"RosterManagerLifeSpanAddon.CheckSalary paid {crew.name} salary.", "info", RMSettings.VerboseLogging);
             RmUtils.LogMessage($"RosterManagerLifeSpanAddon.CheckSalary contract dispute ended {crew.name}", "info", RMSettings.VerboseLogging);
             ScreenMessages.PostScreenMessage(
                 $"{crew.name} {Localizer.Format("#autoLOC_RM_1104")} {kerbal.Value.Salary + kerbal.Value.OwedSalary}", 5.0f, ScreenMessageStyle.UPPER_CENTER); // #autoLOC_RM_1104 = Paid {0} salary of {1}
             ScreenMessages.PostScreenMessage($"{crew.name} {Localizer.Format("#autoLOC_RM_1105")}", 5.0f, ScreenMessageStyle.UPPER_CENTER);                    // #autoLOC_RM_1105 = {0} contract dispute ended.
         }
         else //Can't end dispute
         {
             if (!extend)
             {
                 return;
             }
             kerbal.Value.Timelastsalary = currentTime;
             ExtendContractDispute(crew, kerbal);
         }
     }
 }
 public void RemoveKerbal(ProtoCrewMember crew)
 {
     //First find them in the internal Dictionary.
     if (!RMLifeSpan.Instance.RMKerbals.AllrmKerbals.ContainsKey(crew.name))
     {
         return;
     }
     RmUtils.LogMessage($"RosterManagerLifeSpanAddon.removeKerbal {crew.name} removed from ALLRMKerbals.", "info", RMSettings.VerboseLogging);
     //Then remove them.
     RMLifeSpan.Instance.RMKerbals.AllrmKerbals.Remove(crew.name);
 }
 public void Start()
 {
     RmUtils.LogMessage("RosterManagerLifeSpanAddon Startup...", "info", RMSettings.VerboseLogging);
     try
     {
         CheckDatabase();
     }
     catch (Exception ex)
     {
         RmUtils.LogMessage($"Error in:  RosterManagerLifeSpanAddon.Start.  {ex}", "Error", true);
     }
 }
Esempio n. 6
0
        // Addon state event handlers
        internal void Awake()
        {
            try
            {
                if (HighLogic.LoadedScene != GameScenes.FLIGHT && HighLogic.LoadedScene != GameScenes.SPACECENTER &&
                    HighLogic.LoadedScene != GameScenes.EDITOR && HighLogic.LoadedScene != GameScenes.TRACKSTATION)
                {
                    return;
                }
                //DontDestroyOnLoad(this);
                RMSettings.ApplySettings();
                //WindowRoster.ResetKerbalProfessions();
                RmUtils.LogMessage("RosterManagerAddon.Awake Active...", "info", RMSettings.VerboseLogging);

                if (RMSettings.EnableBlizzyToolbar)
                {
                    // Let't try to use Blizzy's toolbar
                    RmUtils.LogMessage("RosterManagerAddon.Awake - Blizzy Toolbar Selected.", "Info", RMSettings.VerboseLogging);
                    if (!ActivateBlizzyToolBar())
                    {
                        // We failed to activate the toolbar, so revert to stock
                        if (ApplicationLauncher.Ready)
                        {
                            OnGuiAppLauncherReady();
                        }
                        else
                        {
                            GameEvents.onGUIApplicationLauncherReady.Add(OnGuiAppLauncherReady);
                        }
                        RmUtils.LogMessage("RosterManagerAddon.Awake - Stock Toolbar Selected.", "Info", RMSettings.VerboseLogging);
                    }
                }
                else
                {
                    // Use stock Toolbar
                    RmUtils.LogMessage("RosterManagerAddon.Awake - Stock Toolbar Selected.", "Info", RMSettings.VerboseLogging);
                    if (ApplicationLauncher.Ready)
                    {
                        OnGuiAppLauncherReady();
                    }
                    else
                    {
                        GameEvents.onGUIApplicationLauncherReady.Add(OnGuiAppLauncherReady);
                    }
                }
                // lets add our event handlers for kerbal actions
                //GameEvents.onKerbalAdded.Add(OnKerbalAdded);
            }
            catch (Exception ex)
            {
                RmUtils.LogMessage("Error in:  RosterManagerAddon.Awake.  Error:  " + ex, "Error", true);
            }
        }
Esempio n. 7
0
 public static RMKerbal Load(ConfigNode node, string name)
 {
     try
     {
         double lastUpdate = GetNodes.GetNodeValue(node, "lastUpdate", 0d);
         List <ProtoCrewMember> crewList = HighLogic.CurrentGame.CrewRoster.Crew.Concat(HighLogic.CurrentGame.CrewRoster.Applicants).ToList();
         //If Deepfreeze is installed add Unowned and Tourists to the list (could be frozen or comatose).
         if (Api.InstalledMods.IsDfInstalled)
         {
             crewList = crewList.Concat(HighLogic.CurrentGame.CrewRoster.Unowned).Concat(HighLogic.CurrentGame.CrewRoster.Tourist).ToList();
         }
         //var tmpvesselId = GetNodes.GetNodeValue(node, "vesselID", "");
         ProtoCrewMember kerbal = crewList.FirstOrDefault(a => a.name == name);
         RMKerbal        info   = new RMKerbal(lastUpdate, kerbal, false, false)
         {
             Status                         = GetNodes.GetNodeValue(node, "status", ProtoCrewMember.RosterStatus.Available),
             Type                           = GetNodes.GetNodeValue(node, "type", ProtoCrewMember.KerbalType.Crew),
             VesselId                       = GetNodes.GetNodeValue(node, "vesselID", Guid.Empty),
             PartId                         = GetNodes.GetNodeValue(node, "partID", (uint)0),
             VesselName                     = GetNodes.GetNodeValue(node, "VesselName", " "),
             SeatIdx                        = GetNodes.GetNodeValue(node, "seatIdx", 0),
             SeatName                       = GetNodes.GetNodeValue(node, "seatName", ""),
             Age                            = GetNodes.GetNodeValue(node, "age", 25.0d),
             Lifespan                       = GetNodes.GetNodeValue(node, "lifespan", 75.0d),
             TimelastBirthday               = GetNodes.GetNodeValue(node, "timelastBirthday", lastUpdate),
             TimeDfFrozen                   = GetNodes.GetNodeValue(node, "timeDFFrozen", 0d),
             Salary                         = GetNodes.GetNodeValue(node, "salary", 0d),
             TimeSalaryDue                  = GetNodes.GetNodeValue(node, "timeSalaryDue", lastUpdate),
             Timelastsalary                 = GetNodes.GetNodeValue(node, "timelastsalary", lastUpdate),
             Notes                          = GetNodes.GetNodeValue(node, "notes", ""),
             SalaryContractDispute          = GetNodes.GetNodeValue(node, "salaryContractDispute", false),
             OwedSalary                     = GetNodes.GetNodeValue(node, "owedSalary", 0d),
             SalaryContractDisputePeriods   = GetNodes.GetNodeValue(node, "salaryContractDisputePeriods", 0),
             SalaryContractDisputeProcessed = GetNodes.GetNodeValue(node, "salaryContractDisputeProcessed", false),
             PayriseRequired                = GetNodes.GetNodeValue(node, "payriseRequired", 0d),
             Stupidity                      = GetNodes.GetNodeValue(node, "Stupidity", 0f),
             Courage                        = GetNodes.GetNodeValue(node, "Courage", 0f),
             Badass                         = GetNodes.GetNodeValue(node, "Badass", false),
             Trait                          = GetNodes.GetNodeValue(node, "Trait", "Pilot"),
             RealTrait                      = GetNodes.GetNodeValue(node, "RealTrait", "Pilot"),
             Gender                         = GetNodes.GetNodeValue(node, "Gender", ProtoCrewMember.Gender.Male),
             Skill                          = GetNodes.GetNodeValue(node, "Skill", 0),
             Experience                     = GetNodes.GetNodeValue(node, "Experience", 0f)
         };
         info.TimeNextBirthday = GetNodes.GetNodeValue(node, "timeNextBirthday", BirthdayNextDue(info.TimelastBirthday));
         return(info);
     }
     catch (Exception ex)
     {
         RmUtils.LogMessage("RosterManagerLifeSpan.RMKerbal Load error... " + ex, "Error", RMSettings.VerboseLogging);
         return(null);
     }
 }
Esempio n. 8
0
        // ReSharper disable once InconsistentNaming
        internal void OnGUI()
        {
            //Debug.Log("[RosterManager]:  RosterManagerAddon.OnGUI");
            try
            {
                Display();

                RMToolTips.ShowToolTips();
            }
            catch (Exception ex)
            {
                RmUtils.LogMessage("Error in:  RosterManagerAddon.OnGUI.  " + ex, "Error", true);
            }
        }
Esempio n. 9
0
 internal void Start()
 {
     RmUtils.LogMessage("RosterManagerAddon.Start.", "Info", RMSettings.VerboseLogging);
     try
     {
         if (WindowRoster.ResetRosterSize)
         {
             WindowRoster.Position.height = 335; //reset height
         }
     }
     catch (Exception ex)
     {
         RmUtils.LogMessage("Error in:  RosterManagerAddon.Start.  " + ex, "Error", true);
     }
 }
Esempio n. 10
0
 internal void Update()
 {
     try
     {
         CheckForToolbarTypeToggle();
     }
     catch (Exception ex)
     {
         if (!FrameErrTripped)
         {
             RmUtils.LogMessage($" in Update (repeating error).  Error:  {ex.Message} \r\n\r\n{ex.StackTrace}", "Error", true);
             FrameErrTripped = true;
         }
     }
 }
Esempio n. 11
0
        internal void Display()
        {
            string step = "";

            try
            {
                step = "0 - Start";
                RMStyle.SetupGui();

                if (WindowDebugger.ShowWindow)
                {
                    step = "2 - Debugger";
                    WindowDebugger.Position = GUILayout.Window(318643, WindowDebugger.Position, WindowDebugger.Display, $"{Localizer.Format("#autoLOC_RM_1001")} {RMSettings.CurVersion}", GUILayout.MinHeight(20));    // #autoLOC_RM_1001 = Roster Manager -  Debug Console - Ver.
                }

                if (HighLogic.LoadedScene == GameScenes.SPACECENTER || HighLogic.LoadedScene == GameScenes.EDITOR || HighLogic.LoadedScene == GameScenes.TRACKSTATION || HighLogic.LoadedScene == GameScenes.FLIGHT)
                {
                    if (WindowSettings.ShowWindow)
                    {
                        step = "3 - Show Settings";
                        WindowSettings.Position = GUILayout.Window(318546, WindowSettings.Position, WindowSettings.Display, Localizer.Format("#autoLOC_RM_1002"), GUILayout.MinHeight(20)); // #autoLOC_RM_1002 = Roster Manager Settings
                    }

                    if (WindowContracts.ShowWindow)
                    {
                        step = "4 - Roster Contracts";
                        WindowContracts.Position = GUILayout.Window(318987, WindowContracts.Position, WindowContracts.Display, Localizer.Format("#autoLOC_RM_1003"), GUILayout.MinHeight(20));  // #autoLOC_RM_1003 = Roster Contracts
                    }

                    if (WindowRoster.ShowWindow)
                    {
                        if (WindowRoster.DisplayMode == WindowRoster.DisplayModes.Index)
                        {
                            step = "5 - Reset Roster Size";
                            WindowRoster.Position.height = 335; //reset hight
                        }

                        step = "6 - Show Roster";
                        WindowRoster.Position = GUILayout.Window(318547, WindowRoster.Position, WindowRoster.Display, Localizer.Format("#autoLOC_RM_1004"), GUILayout.MinHeight(20));   // #autoLOC_RM_1004 = Roster Manager
                    }
                }
                step = "1 - Show Interface(s)";
            }
            catch (Exception ex)
            {
                RmUtils.LogMessage($" in drawGui at or near step:  {step}.  Error:  {ex.Message} \n\n{ex.StackTrace}", "Error", true);
            }
        }
        internal void UpdateKerbal(ProtoCrewMember crew, bool addifNotFound)
        {
            double currentTime = Planetarium.GetUniversalTime();
            //First find them in the internal Dictionary.
            KeyValuePair <string, RMKerbal> kerbal = RMLifeSpan.Instance.RMKerbals.AllrmKerbals.FirstOrDefault(a => a.Key == crew.name);

            //If not found and addifNotFound is true create a new entry
            if (kerbal.Value == null && addifNotFound)
            {
                RmUtils.LogMessage(
                    $"RosterManagerLifeSpanAddon.updateKerbal {crew.name} not found in ALLRMKerbals, adding new entry.", "info", RMSettings.VerboseLogging);
                RMKerbal rmkerbal = new RMKerbal(Planetarium.GetUniversalTime(), crew, true, false);
                RMLifeSpan.Instance.RMKerbals.AllrmKerbals.Add(crew.name, rmkerbal);
            }
            //If found update their entry
            else if (kerbal.Value != null)
            {
                if (!(currentTime - kerbal.Value.LastUpdate > RMSettings.LifeInfoUpdatePeriod))
                {
                    return;
                }
                RmUtils.LogMessage($"RosterManagerLifeSpanAddon.updateKerbal {crew.name} updating entry.", "info", RMSettings.VerboseLogging);
                if (RMLifeSpan.Instance.RMGameSettings.EnableAging)
                {
                    CheckAge(crew, kerbal, currentTime);
                }
                if (RMLifeSpan.Instance.RMGameSettings.EnableSalaries)
                {
                    //We only pay salaries to Crew or Dead/Unowned (frozen)
                    if (kerbal.Value.Type == ProtoCrewMember.KerbalType.Crew ||
                        kerbal.Value.Status == ProtoCrewMember.RosterStatus.Dead && kerbal.Value.Type == ProtoCrewMember.KerbalType.Unowned)
                    {
                        CheckSalary(crew, kerbal, currentTime);
                    }
                }
                kerbal.Value.LastUpdate = currentTime;
                kerbal.Value.Trait      = crew.trait;
                kerbal.Value.Type       = crew.type;
                kerbal.Value.Status     = crew.rosterStatus;
                if (crew.rosterStatus != ProtoCrewMember.RosterStatus.Available)
                {
                    return;
                }
                kerbal.Value.VesselId   = Guid.Empty;
                kerbal.Value.VesselName = string.Empty;
            }
        }
Esempio n. 13
0
 private void OnGuiAppLauncherDestroyed()
 {
     //Debug.Log("[RosterManager]:  RosterManagerAddon.OnGUIAppLauncherDestroyed");
     try
     {
         if (_rmRosterStock == null)
         {
             return;
         }
         ApplicationLauncher.Instance.RemoveModApplication(_rmRosterStock);
         _rmRosterStock = null;
     }
     catch (Exception ex)
     {
         RmUtils.LogMessage("Error in:  RosterManagerAddon.OnGUIAppLauncherDestroyed.  " + ex, "Error", true);
     }
 }
Esempio n. 14
0
 internal static void SetPartHighlight(Part part, Color color)
 {
     try
     {
         if (part == null)
         {
             return;
         }
         part.SetHighlightColor(color);
         part.SetHighlight(true, false);
         part.highlightType = Part.HighlightType.AlwaysOn;
     }
     catch (Exception ex)
     {
         RmUtils.LogMessage($" in  SetPartHighlight.  Error:  {ex.Message} \n\n{ex.StackTrace}", "Error", true);
     }
 }
Esempio n. 15
0
 internal static Guid GetNodeValue(ConfigNode confignode, string fieldname, Guid guid)
 {
     if (!confignode.HasValue(fieldname))
     {
         return(Guid.Empty);
     }
     try
     {
         Guid id = new Guid(confignode.GetValue(fieldname));
         return(id);
     }
     catch (Exception ex)
     {
         RmUtils.LogMessage("RosterManagerLifeSpan.RMKerbal error loading vesselID " + ex, "Error", RMSettings.VerboseLogging);
         return(Guid.Empty);
     }
 }
Esempio n. 16
0
        //Vessel state handlers
        internal void OnDestroy()
        {
            //Debug.Log("[RosterManager]:  RosterManagerAddon.OnDestroy");
            try
            {
                if (RMSettings.Loaded)
                {
                    try
                    {
                        RMSettings.SaveSettings();
                    }
                    catch
                    {
                        // Do nothing.
                    }
                }

                // Handle Toolbars
                if (_rmRosterBlizzy == null)
                {
                    if (_rmRosterStock != null)
                    {
                        ApplicationLauncher.Instance.RemoveModApplication(_rmRosterStock);
                        _rmRosterStock = null;
                    }
                    if (_rmRosterStock == null)
                    {
                        // Remove the stock toolbar button launcher handler
                        GameEvents.onGUIApplicationLauncherReady.Remove(OnGuiAppLauncherReady);
                    }
                }
                else
                {
                    _rmRosterBlizzy?.Destroy();
                }
                //Reset Roster Window data
                WindowRoster.DisplayMode    = WindowRoster.DisplayModes.None;
                WindowRoster.SelectedKerbal = null;
                WindowRoster.ToolTip        = "";
                //Settings.ShowRoster = false;
            }
            catch (Exception ex)
            {
                RmUtils.LogMessage("Error in:  RosterManagerAddon.OnDestroy.  " + ex, "Error", true);
            }
        }
Esempio n. 17
0
 /// <summary>
 /// Remove highlighting on a part.
 /// </summary>
 /// <param name="part">Part to remove highlighting from.</param>
 internal static void ClearPartHighlight(Part part)
 {
     try
     {
         if (part == null)
         {
             return;
         }
         part.SetHighlight(false, false);
         part.SetHighlightDefault();
         part.highlightType = Part.HighlightType.OnMouseOver;
     }
     catch (Exception ex)
     {
         RmUtils.LogMessage($" in  ClearPartHighlight.  Error:  {ex.Message} \n\n{ex.StackTrace}", "Error", true);
     }
 }
 public void Update()
 {
     try
     {
         if (HighLogic.LoadedScene == GameScenes.FLIGHT)
         {
             //Update vesselID and Name for crew in the RM confignode dictionary. We aren't actually using this now, but will come into use/handy later.
             //This is necessary because SP doesn't actually store assigned vessels to crew in game neatly. They are stored ito the vessel modules, not the kerbal or crewroster,
             // which would make things easier!! DEVS take note!!!
             if (FlightGlobals.ActiveVessel != null)
             {
                 foreach (ProtoCrewMember crew in FlightGlobals.ActiveVessel.GetVesselCrew().ToList())
                 {
                     KeyValuePair <string, RMKerbal> kerbal = RMLifeSpan.Instance.RMKerbals.AllrmKerbals.FirstOrDefault(a => a.Key == crew.name);
                     if (kerbal.Key == null)
                     {
                         continue;
                     }
                     kerbal.Value.VesselId   = FlightGlobals.ActiveVessel.id;
                     kerbal.Value.VesselName = FlightGlobals.ActiveVessel.vesselName;
                 }
             }
         }
         //Update all known Crew, Applicants in any game scene.
         List <ProtoCrewMember> crewList = HighLogic.CurrentGame.CrewRoster.Crew.Concat(HighLogic.CurrentGame.CrewRoster.Applicants).ToList();
         //If Deepfreeze is installed add Unowned and Tourists to the list (could be frozen or comatose).
         if (Api.InstalledMods.IsDfInstalled)
         {
             crewList = crewList.Concat(HighLogic.CurrentGame.CrewRoster.Unowned).Concat(HighLogic.CurrentGame.CrewRoster.Tourist).ToList();
         }
         foreach (ProtoCrewMember crew in crewList)
         {
             // If they are not Dead or they are Dead status and they are unowned (frozen) or tourist (comatose) - We update their Life stats.
             if (crew.rosterStatus != ProtoCrewMember.RosterStatus.Dead ||
                 (crew.rosterStatus == ProtoCrewMember.RosterStatus.Dead && (crew.type == ProtoCrewMember.KerbalType.Unowned || crew.type == ProtoCrewMember.KerbalType.Tourist)))
             {
                 UpdateKerbal(crew, true);
             }
         }
     }
     catch (Exception ex)
     {
         RmUtils.LogMessage($"Error in:  RosterManagerLifeSpanAddon.Update.  {ex}", "Error", true);
     }
 }
Esempio n. 19
0
        // ReSharper disable once InconsistentNaming
        internal void OnGUI()
        {
            //Debug.Log("[RosterManager]:  RosterManagerAddon.OnGUI");
            if (Event.current.type == EventType.MouseUp)
            {
                // Turn off window resizing
                RmUtils.ResetResize();
            }
            try
            {
                Display();

                RMToolTips.ShowToolTips();
            }
            catch (Exception ex)
            {
                RmUtils.LogMessage("Error in:  RosterManagerAddon.OnGUI.  " + ex, "Error", true);
            }
        }
Esempio n. 20
0
 internal void Save(ConfigNode node)
 {
     try
     {
         ConfigNode kerbalLifeRecordNode = node.HasNode(ConfigNodeName) ? node.GetNode(ConfigNodeName) : node.AddNode(ConfigNodeName);
         Dictionary <string, RMKerbal> .Enumerator allRmKerbals = AllrmKerbals.GetEnumerator();
         while (allRmKerbals.MoveNext())
         {
             ConfigNode kerbalNode = allRmKerbals.Current.Value.Save(kerbalLifeRecordNode);
             RmUtils.LogMessage("RosterManagerLifeSpan.RMKerbals Saving kerbal = " + allRmKerbals.Current.Key, "info", RMSettings.VerboseLogging);
             kerbalNode.AddValue("kerbalName", allRmKerbals.Current.Key);
         }
         allRmKerbals.Dispose();
     }
     catch (Exception ex)
     {
         RmUtils.LogMessage("RosterManagerLifeSpan.RMKerbal Save error... " + ex, "Error", RMSettings.VerboseLogging);
     }
     RmUtils.LogMessage("RosterManagerLifeSpan.RMKerbals Saving Completed", "info", RMSettings.VerboseLogging);
 }
 private void CheckSalary(ProtoCrewMember crew, KeyValuePair <string, RMKerbal> kerbal, double currentTime)
 {
     if (currentTime >= kerbal.Value.TimeSalaryDue) // Salary Due??
     {
         //Set time next salary due
         kerbal.Value.TimeSalaryDue = RMKerbal.SalaryNextDue(currentTime);
         //Pay Salary
         if (HighLogic.CurrentGame.Mode != Game.Modes.CAREER)
         {
             return;
         }
         //Check if contractdispute is active and if it is process that
         if (kerbal.Value.SalaryContractDispute && kerbal.Value.SalaryContractDisputeProcessed)
         {
             //If they are a Tourist they are on strike. We don't process dispute.
             if (kerbal.Value.Type == ProtoCrewMember.KerbalType.Tourist)
             {
                 return;
             }
             ProcessContractDispute(crew, kerbal, currentTime, false, true);
         }
         else //No contract dispute so process normal salary.
         {
             if (Funding.CanAfford((float)kerbal.Value.Salary))
             {
                 Funding.Instance.AddFunds(-kerbal.Value.Salary, TransactionReasons.CrewRecruited);
                 kerbal.Value.Timelastsalary = currentTime;
                 RmUtils.LogMessage($"RosterManagerLifeSpanAddon.CheckSalary paid {crew.name} salary.", "info", RMSettings.VerboseLogging);
                 ScreenMessages.PostScreenMessage(
                     $"{crew.name} {Localizer.Format("#autoLOC_RM_1102")} {kerbal.Value.Salary}", 5.0f, ScreenMessageStyle.UPPER_CENTER); // #autoLOC_RM_1102 = Paid {0} salary of {1}
             }
             else //Unable to pay, start a contract dispute.
             {
                 if (!kerbal.Value.SalaryContractDispute && kerbal.Value.SalaryContractDisputeProcessed)
                 {
                     ProcessContractDispute(crew, kerbal, currentTime, true, true);
                 }
             }
         }
     }
 }
 internal void ResignKerbal(ProtoCrewMember crew, KeyValuePair <string, RMKerbal> kerbal)
 {
     RmUtils.LogMessage(
         $"RosterManagerLifeSpanAddon.resignKerbal {crew.name} contract in dispute. They will remain a tourist until they are paid.", "info", RMSettings.VerboseLogging);
     ScreenMessages.PostScreenMessage($"{crew.name} contract in dispute. They will remain a tourist until they are paid.", 5.0f, ScreenMessageStyle.UPPER_CENTER);
     //We don't change their status if they are unowned/dead (DeepFreeze Frozen)
     if (crew.type == ProtoCrewMember.KerbalType.Unowned || crew.rosterStatus == ProtoCrewMember.RosterStatus.Dead)
     {
         return;
     }
     RMKerbal.UnregisterExperienceTrait(kerbal.Value);
     //kerbal.Value.RealTrait = kerbal.Value.Trait;
     kerbal.Value.Type  = ProtoCrewMember.KerbalType.Tourist;
     crew.type          = ProtoCrewMember.KerbalType.Tourist;
     kerbal.Value.Trait = "Tourist";
     crew.trait         = "Tourist";
     KerbalRoster.SetExperienceTrait(crew, crew.trait);
     kerbal.Value.PayriseRequired = 0d;
     kerbal.Value.SalaryContractDisputeProcessed = true;
     kerbal.Value.SalaryContractDispute          = true;
 }
Esempio n. 23
0
        internal void Display()
        {
            try
            {
                RMStyle.SetupGui();

                if (WindowDebugger.ShowWindow)
                {
                    WindowDebugger.Position = GUILayout.Window(318643, WindowDebugger.Position, WindowDebugger.Display, $"{Localizer.Format("#autoLOC_RM_1001")} {RMSettings.CurVersion}", GUILayout.MinHeight(20));    // #autoLOC_RM_1001 = Roster Manager -  Debug Console - Ver.
                }

                if (IsCorrectSceneLoaded())
                {
                    if (WindowSettings.ShowWindow)
                    {
                        WindowSettings.Position = GUILayout.Window(318546, WindowSettings.Position, WindowSettings.Display, Localizer.Format("#autoLOC_RM_1002"), GUILayout.MinHeight(20)); // #autoLOC_RM_1002 = Roster Manager Settings
                    }

                    if (WindowContracts.ShowWindow)
                    {
                        WindowContracts.Position = GUILayout.Window(318987, WindowContracts.Position, WindowContracts.Display, Localizer.Format("#autoLOC_RM_1003"), GUILayout.MinHeight(20));  // #autoLOC_RM_1003 = Roster Contracts
                    }

                    if (WindowRoster.ShowWindow)
                    {
                        if (WindowRoster.DisplayMode == WindowRoster.DisplayModes.None)
                        {
                            WindowRoster.Position.height = WindowRoster.WindowHeight + WindowRoster.HeightScale; //reset height
                        }

                        WindowRoster.Position = GUILayout.Window(318547, WindowRoster.Position, WindowRoster.Display, Localizer.Format("#autoLOC_RM_1004"), GUILayout.MinHeight(20));   // #autoLOC_RM_1004 = Roster Manager
                    }
                }
            }
            catch (Exception ex)
            {
                RmUtils.LogMessage($" in drawGui.  Error:  {ex.Message} \n\n{ex.StackTrace}", "Error", true);
            }
        }
Esempio n. 24
0
 internal static bool ActivateBlizzyToolBar()
 {
     if (RMSettings.EnableBlizzyToolbar)
     {
         try
         {
             if (ToolbarManager.ToolbarAvailable)
             {
                 if (HighLogic.LoadedScene == GameScenes.SPACECENTER || HighLogic.LoadedScene == GameScenes.EDITOR || HighLogic.LoadedScene == GameScenes.TRACKSTATION || HighLogic.LoadedScene == GameScenes.FLIGHT)
                 {
                     _rmRosterBlizzy             = ToolbarManager.Instance.Add("RosterManager", "Roster");
                     _rmRosterBlizzy.TexturePath = WindowSettings.ShowWindow ? TextureFolder + "Icon_On_24" : TextureFolder + "Icon_Off_24";
                     _rmRosterBlizzy.ToolTip     = Localizer.Format("#autoLOC_RM_1000"); // #autoLOC_RM_1000 = Roster Manager Roster Window
                     _rmRosterBlizzy.Visibility  = new GameScenesVisibility(GameScenes.SPACECENTER);
                     _rmRosterBlizzy.Visible     = true;
                     _rmRosterBlizzy.OnClick    += e =>
                     {
                         OnRMRosterToggle();
                     };
                 }
                 RmUtils.LogMessage("Blizzy Toolbar available!", "Info", RMSettings.VerboseLogging);
                 return(true);
             }
             RmUtils.LogMessage("Blizzy Toolbar not available!", "Info", RMSettings.VerboseLogging);
             return(false);
         }
         catch (Exception ex)
         {
             // Blizzy Toolbar instantiation error.
             RmUtils.LogMessage("Error in EnableBlizzyToolbar... Error:  " + ex, "Error", true);
             return(false);
         }
     }
     // No Blizzy Toolbar
     RmUtils.LogMessage("Blizzy Toolbar not Enabled...", "Info", RMSettings.VerboseLogging);
     return(false);
 }
Esempio n. 25
0
 // Stock vs Blizzy Toolbar switch handler
 private void CheckForToolbarTypeToggle()
 {
     if (RMSettings.EnableBlizzyToolbar && !RMSettings.PrevEnableBlizzyToolbar)
     {
         // Let't try to use Blizzy's toolbar
         RmUtils.LogMessage("CheckForToolbarToggle - Blizzy Toolbar Selected.", "Info", RMSettings.VerboseLogging);
         if (!ActivateBlizzyToolBar())
         {
             // We failed to activate the toolbar, so revert to stock
             GameEvents.onGUIApplicationLauncherReady.Add(OnGuiAppLauncherReady);
             RmUtils.LogMessage("RosterManagerAddon.Awake - Stock Toolbar Selected.", "Info", RMSettings.VerboseLogging);
             RMSettings.EnableBlizzyToolbar = RMSettings.PrevEnableBlizzyToolbar;
         }
         else
         {
             OnGuiAppLauncherDestroyed();
             GameEvents.onGUIApplicationLauncherReady.Remove(OnGuiAppLauncherReady);
             RMSettings.PrevEnableBlizzyToolbar = RMSettings.EnableBlizzyToolbar;
             if (HighLogic.LoadedScene == GameScenes.SPACECENTER || HighLogic.LoadedScene == GameScenes.EDITOR || HighLogic.LoadedScene == GameScenes.TRACKSTATION || HighLogic.LoadedScene == GameScenes.FLIGHT)
             {
                 _rmRosterBlizzy.Visible = true;
             }
         }
     }
     else if (!RMSettings.EnableBlizzyToolbar && RMSettings.PrevEnableBlizzyToolbar)
     {
         // Use stock Toolbar
         RmUtils.LogMessage("RosterManagerAddon.Awake - Stock Toolbar Selected.", "Info", RMSettings.VerboseLogging);
         if (HighLogic.LoadedScene == GameScenes.SPACECENTER || HighLogic.LoadedScene == GameScenes.EDITOR || HighLogic.LoadedScene == GameScenes.TRACKSTATION || HighLogic.LoadedScene == GameScenes.FLIGHT)
         {
             _rmRosterBlizzy.Visible = false;
         }
         GameEvents.onGUIApplicationLauncherReady.Add(OnGuiAppLauncherReady);
         OnGuiAppLauncherReady();
         RMSettings.PrevEnableBlizzyToolbar = RMSettings.EnableBlizzyToolbar;
     }
 }
        private readonly System.Random _gen = new System.Random(); // Random seed for deciding when a kerbal dies of old age. Do we need two seeds?

        protected RMLifeSpanAddon()
        {
            RmUtils.LogMessage("RosterManagerLifeSpanAddon.Constructor Active...", "info", RMSettings.VerboseLogging);
            _instance = this;
        }
Esempio n. 27
0
        internal static void SaveSettings()
        {
            //If EnableAging has been turned ON when it was previously OFF, we reset age processing, otherwise they could all die instantly.
            if (RMLifeSpan.Instance.RMGameSettings.EnableAging && PrevEnableAging == false)
            {
                RmUtils.LogMessage("RosterManagerWindowSettings.Display Save settings, aging has been enabled. Reset all birthdays.", "info", RMSettings.VerboseLogging);
                double currentTime = Planetarium.GetUniversalTime();
                foreach (KeyValuePair <string, RMKerbal> rmkerbal in RMLifeSpan.Instance.RMKerbals.AllrmKerbals)
                {
                    rmkerbal.Value.TimelastBirthday = currentTime;
                    rmkerbal.Value.TimeNextBirthday = RMKerbal.BirthdayNextDue(currentTime);
                }
            }
            //If EnableSalaries has been turned OFF when it was previously ON, reset any kerbals from tourist back to active.
            if (!RMLifeSpan.Instance.RMGameSettings.EnableSalaries && PrevEnableSalaries)
            {
                RmUtils.LogMessage("RosterManagerWindowSettings.Display Save settings, salaries have been turned off. Reset all salary related fields for all kerbals.", "info", RMSettings.VerboseLogging);
                foreach (KeyValuePair <string, RMKerbal> rmkerbal in RMLifeSpan.Instance.RMKerbals.AllrmKerbals)
                {
                    if (rmkerbal.Value.Type == ProtoCrewMember.KerbalType.Tourist && rmkerbal.Value.Kerbal.rosterStatus != ProtoCrewMember.RosterStatus.Dead)
                    {
                        rmkerbal.Value.Type         = ProtoCrewMember.KerbalType.Crew;
                        rmkerbal.Value.Kerbal.type  = ProtoCrewMember.KerbalType.Crew;
                        rmkerbal.Value.Trait        = rmkerbal.Value.RealTrait;
                        rmkerbal.Value.Kerbal.trait = rmkerbal.Value.RealTrait;
                        KerbalRoster.SetExperienceTrait(rmkerbal.Value.Kerbal, rmkerbal.Value.Trait);
                        RMKerbal.RegisterExperienceTrait(rmkerbal.Value);
                    }
                    rmkerbal.Value.SalaryContractDispute          = false;
                    rmkerbal.Value.SalaryContractDisputePeriods   = 0;
                    rmkerbal.Value.SalaryContractDisputeProcessed = true;
                }
            }
            //If EnableSalaries has been turned ON when it was previously OFF, reset all kerbals salary time to now.
            if (RMLifeSpan.Instance.RMGameSettings.EnableSalaries && PrevEnableSalaries == false)
            {
                RmUtils.LogMessage("RosterManagerWindowSettings.Display Save settings, salaries have been turned on. Reset all salary related fields for all kerbals.", "info", RMSettings.VerboseLogging);
                double currentTime = Planetarium.GetUniversalTime();
                foreach (KeyValuePair <string, RMKerbal> rmkerbal in RMLifeSpan.Instance.RMKerbals.AllrmKerbals)
                {
                    rmkerbal.Value.Timelastsalary = currentTime;
                    rmkerbal.Value.TimeSalaryDue  = RMKerbal.SalaryNextDue(currentTime);
                }
            }
            if (Settings == null)
            {
                Settings = LoadSettingsFile();
            }

            ConfigNode windowsNode  = Settings.HasNode("RM_Windows") ? Settings.GetNode("RM_Windows") : Settings.AddNode("RM_Windows");
            ConfigNode settingsNode = Settings.HasNode("RM_Settings") ? Settings.GetNode("RM_Settings") : Settings.AddNode("RM_Settings");
            ConfigNode hiddenNode   = Settings.HasNode("RM_Hidden") ? Settings.GetNode("RM_Hidden") : Settings.AddNode("RM_Hidden");

            // Write window positions
            WriteRectangle(windowsNode, "DebuggerPosition", WindowDebugger.Position);
            WriteRectangle(windowsNode, "SettingsPosition", WindowSettings.Position);
            WriteRectangle(windowsNode, "RosterPosition", WindowRoster.Position);
            WriteRectangle(windowsNode, "ContractDisputePosition", WindowContracts.Position);

            //Write settings...
            // Realism Settings
            WriteValue(settingsNode, "LockSettings", LockSettings);

            // ToolTip Settings
            WriteValue(settingsNode, "ShowToolTips", ShowToolTips);
            WriteValue(settingsNode, "SettingsToolTips", WindowSettings.ShowToolTips);
            WriteValue(settingsNode, "RosterToolTips", WindowRoster.ShowToolTips);
            WriteValue(settingsNode, "DebuggerToolTips", WindowDebugger.ShowToolTips);
            WriteValue(settingsNode, "ContractDisputeToolTips", WindowContracts.ShowToolTips);

            // Config Settings
            WriteValue(settingsNode, "ShowDebugger", WindowDebugger.ShowWindow);
            WriteValue(settingsNode, "EnableBlizzyToolbar", EnableBlizzyToolbar);
            WriteValue(settingsNode, "VerboseLogging", VerboseLogging);
            WriteValue(settingsNode, "AutoDebug", AutoDebug);
            WriteValue(settingsNode, "DebugLogPath", DebugLogPath);
            WriteValue(settingsNode, "ErrorLogLength", ErrorLogLength);
            WriteValue(settingsNode, "SaveLogOnExit", SaveLogOnExit);
            WriteValue(settingsNode, "EnableKerbalRename", EnableKerbalRename);

            // Hidden Settings
            WriteValue(hiddenNode, "LifeInfoUpdatePeriod", LifeInfoUpdatePeriod);

            if (!Directory.Exists(SettingsPath))
            {
                Directory.CreateDirectory(SettingsPath);
            }
            Settings.Save(SettingsFile);
        }
        private void CheckAge(ProtoCrewMember crew, KeyValuePair <string, RMKerbal> kerbal, double currentTime)
        {
            //Calculate and update their age.
            //If they are DeepFreeze Frozen - They Don't Age, until they are thawed.
            if (Api.InstalledMods.IsDfInstalled)
            {
                if (crew.rosterStatus == ProtoCrewMember.RosterStatus.Dead && crew.type == ProtoCrewMember.KerbalType.Unowned)
                {
                    //Frozen - check if we are tracking when they were frozen, if not, set it to the time they were frozen
                    if (!(Math.Abs(kerbal.Value.TimeDfFrozen) < Tolerance))
                    {
                        return;
                    }
                    if (RMAddon.FrozenKerbals.ContainsKey(crew.name))
                    {
                        kerbal.Value.TimeDfFrozen = RMAddon.FrozenKerbals[crew.name].LastUpdate;
                    }
                    return; //We don't process age any further if they are frozen.
                }
                if (crew.rosterStatus == ProtoCrewMember.RosterStatus.Dead && (crew.type != ProtoCrewMember.KerbalType.Unowned || crew.type != ProtoCrewMember.KerbalType.Tourist))
                {
                    //They are really dead. Should this ever occur? Just in case.
                    return;
                }
                //If we get here, they aren't frozen and they aren't really dead... so were they frozen?
                //IE: we know that if they are now crew, but their KerbalLifeInfo record has their status as dead and time frozen > 0
                if (crew.type == ProtoCrewMember.KerbalType.Crew && kerbal.Value.Status == ProtoCrewMember.RosterStatus.Dead && kerbal.Value.TimeDfFrozen > 0d)
                {
                    //We add the time they were frozen onto their time of last birthday - effectively extending their life.
                    double timeFrozen = currentTime - kerbal.Value.TimeDfFrozen; //The amount of time they were frozen
                    kerbal.Value.TimelastBirthday += timeFrozen;
                    kerbal.Value.TimeDfFrozen      = 0d;
                }
            }

            //Is it their Birthday?

            if (currentTime >= kerbal.Value.TimeNextBirthday)
            {
                //It's their Birthday!!!!
                kerbal.Value.Age += 1;
                kerbal.Value.TimelastBirthday = currentTime;
                kerbal.Value.TimeNextBirthday = RMKerbal.BirthdayNextDue(currentTime);
                if (kerbal.Value.Type != ProtoCrewMember.KerbalType.Applicant)
                {
                    ScreenMessages.PostScreenMessage(
                        $"{crew.name} {Localizer.Format("#autoLOC_RM_1100")} {kerbal.Value.Age:###0}", 5.0f, ScreenMessageStyle.UPPER_CENTER);  // #autoLOC_RM_1100 = It\'s {0} Birthday! They are now {1:###0}
                }
                RmUtils.LogMessage(
                    $"RosterManagerLifeSpanAddon.checkAge {crew.name} just had a birthday. They are now {kerbal.Value.Age:###0}", "info", RMSettings.VerboseLogging);
            }

            //Check if they Die of Old Age
            if (!(kerbal.Value.Lifespan - 2 <= kerbal.Value.Age))
            {
                return;
            }
            int percentage;

            //Set random range based on:- if age is less than lifespan have 20% chance of death, if age is = or up to 2 years greater than lifespan have 40% chance of death.
            // if age is > than 2 years past lifespan have 60% chance of death. If age is > than 4 years past lifespan have 80% chance of death.
            if (kerbal.Value.Age < kerbal.Value.Lifespan)
            {
                percentage = 20;
            }
            else if (kerbal.Value.Lifespan + 2 < kerbal.Value.Age)
            {
                percentage = 40;
            }
            else if (kerbal.Value.Lifespan + 4 < kerbal.Value.Age)
            {
                percentage = 60;
            }
            else
            {
                percentage = 80;
            }
            if (_gen.Next(100) < percentage)
            {
                //Their Time has Come. As long as they aren't currently DeepFreeze Frozen/comatose
                if (crew.rosterStatus == ProtoCrewMember.RosterStatus.Dead ||
                    (crew.type == ProtoCrewMember.KerbalType.Unowned && crew.type == ProtoCrewMember.KerbalType.Tourist))
                {
                    return;
                }
                TimeWarp.SetRate(0, false);
                if (CameraManager.Instance.currentCameraMode == CameraManager.CameraMode.IVA)
                {
                    CameraManager.Instance.SetCameraFlight();
                }
                RmUtils.LogMessage($"RosterManagerLifeSpanAddon.CheckAge {crew.name} died from old age.", "info", RMSettings.VerboseLogging);
                ScreenMessages.PostScreenMessage(
                    $"{crew.name} {Localizer.Format("#autoLOC_RM_1101")} {kerbal.Value.Age:###0}", 5.0f, ScreenMessageStyle.UPPER_CENTER); // #autoLOC_RM_1101 = {0} died at the old age of {1:###0}

                if (crew.rosterStatus == ProtoCrewMember.RosterStatus.Assigned)                                                            //On active duty, need to find their vessel and remove them.
                {
                    bool foundcrew = false;
                    //First try to find their assigned vessel and remove them.
                    if (kerbal.Value.VesselId != Guid.Empty)
                    {
                        Vessel v = FlightGlobals.Vessels.FirstOrDefault(a => a.id == kerbal.Value.VesselId);
                        if (v != null)
                        {
                            if (v.loaded)
                            {
                                Part part = v.Parts.Find(p => p.protoModuleCrew.Contains(crew));
                                if (part != null)
                                {
                                    part.RemoveCrewmember(crew);
                                    crew.Die();
                                    foundcrew = true;
                                }
                            }
                            else
                            {
                                ProtoPartSnapshot part = v.protoVessel.protoPartSnapshots.Find(p => p.protoModuleCrew.Contains(crew));
                                if (part != null)
                                {
                                    part.RemoveCrew(crew);
                                    crew.Die();
                                    foundcrew = true;
                                }
                            }
                        }
                    }
                    if (!foundcrew) //We didn't find their vessel and remove them so now search all vessels in game.
                    {
                        foreach (Vessel v in FlightGlobals.Vessels)
                        {
                            if (v.isEVA && v.name.Contains(crew.name))
                            {
                                if (v.name.Contains(crew.name))
                                {
                                    v.rootPart.Die();
                                    foundcrew = true;
                                    break;
                                }
                            }
                            if (v.loaded)
                            {
                                Part part = v.Parts.Find(p => p.protoModuleCrew.Contains(crew));
                                if (part == null)
                                {
                                    continue;
                                }
                                part.RemoveCrewmember(crew);
                                crew.Die();
                                foundcrew = true;
                                break;
                            }
                            else
                            {
                                ProtoPartSnapshot part = v.protoVessel.protoPartSnapshots.Find(p => p.protoModuleCrew.Contains(crew));
                                if (part == null)
                                {
                                    continue;
                                }
                                part.RemoveCrew(crew);
                                crew.Die();
                                foundcrew = true;
                                break;
                            }
                        }
                    }

                    if (!foundcrew) //We still didn't find them, log error and kill them anyway.
                    {
                        RmUtils.LogMessage(
                            $"RosterManagerLifeSpanAddon.CheckAge {crew.name} couldn\'t find them to remove them from vessel.", "Error", RMSettings.VerboseLogging);
                        crew.Die();
                    }
                }
                else //Not on active duty
                {
                    crew.Die();
                }

                //Remove from LifeSpan.Instance.kerbalLifeRecord.KerbalLifeRecords
                RemoveKerbal(crew);

                // set ReSpawn
                if (HighLogic.CurrentGame.Parameters.Difficulty.MissingCrewsRespawn)
                {
                    crew.StartRespawnPeriod();
                }
            }
        }
 private void OnKerbalSacked(ProtoCrewMember crew, int num)
 {
     RmUtils.LogMessage(
         $"RosterManagerLifeSpanAddon.onKerbalSacked {crew.name} has been sacked from the crew roster.", "info", RMSettings.VerboseLogging);
     RemoveKerbal(crew);
 }
Esempio n. 30
0
        public override void OnAwake()
        {
            RmUtils.LogMessage("RosterManagerLifeSpan.Awake Active...", "info", RMSettings.VerboseLogging);
            base.OnAwake();
            _instance      = this;
            RMKerbals      = new RMKerbals();
            RMGameSettings = new RMGameSettings();

            switch (HighLogic.LoadedScene)
            {
            case GameScenes.SPACECENTER:
            {
                RmUtils.LogMessage("RosterManagerLifeSpan.Awake adding SpaceCenterManager", "info", RMSettings.VerboseLogging);
                RMLifeSpanAddon klMem = gameObject.AddComponent <RMLifeSpanAddon>();
                _children.Add(klMem);
            }
            break;

            case GameScenes.FLIGHT:
            {
                RmUtils.LogMessage("RosterManagerLifeSpan.Awake adding FlightManager", "info", RMSettings.VerboseLogging);
                RMLifeSpanAddon klMem = gameObject.AddComponent <RMLifeSpanAddon>();
                _children.Add(klMem);
            }
            break;

            case GameScenes.EDITOR:
            {
                RmUtils.LogMessage("RosterManagerLifeSpan.Awake adding EditorManager", "info", RMSettings.VerboseLogging);
                RMLifeSpanAddon klMem = gameObject.AddComponent <RMLifeSpanAddon>();
                _children.Add(klMem);
            }
            break;

            case GameScenes.TRACKSTATION:
            {
                RmUtils.LogMessage("RosterManagerLifeSpan.Awake adding TrackingStationManager", "info", RMSettings.VerboseLogging);
                RMLifeSpanAddon klMem = gameObject.AddComponent <RMLifeSpanAddon>();
                _children.Add(klMem);
            }
            break;

            case GameScenes.LOADING:
                break;

            case GameScenes.LOADINGBUFFER:
                break;

            case GameScenes.MAINMENU:
                break;

            case GameScenes.SETTINGS:
                break;

            case GameScenes.CREDITS:
                break;

            case GameScenes.PSYSTEM:
                break;

            default:
                throw new ArgumentOutOfRangeException();
            }
        }