Exemple #1
0
        //Toolbar button click handlers
        internal static void OnRMRosterToggle()
        {
            //Debug.Log("[RosterManager]:  RosterManagerAddon.OnRMRosterToggle");
            try
            {
                if (HighLogic.LoadedScene != GameScenes.SPACECENTER && HighLogic.LoadedScene != GameScenes.EDITOR &&
                    HighLogic.LoadedScene != GameScenes.TRACKSTATION && HighLogic.LoadedScene != GameScenes.FLIGHT)
                {
                    return;
                }
                WindowRoster.ShowWindow = !WindowRoster.ShowWindow;
                if (RMSettings.EnableBlizzyToolbar)
                {
                    _rmRosterBlizzy.TexturePath = WindowRoster.ShowWindow ? TextureFolder + "Icon_On_24" : TextureFolder + "Icon_Off_24";
                }
                else
                {
                    _rmRosterStock.SetTexture(GameDatabase.Instance.GetTexture(WindowRoster.ShowWindow ? TextureFolder + "Icon_On_128" : TextureFolder + "Icon_Off_128", false));
                }

                if (!WindowRoster.ShowWindow)
                {
                    return;
                }
                WindowRoster.DisplayMode = WindowRoster.DisplayModes.Index;
                WindowRoster.UpdateRosterList();
                //AllCrew.Clear();
                //if (RMLifeSpan.Instance != null)
                //    AllCrew = RMLifeSpan.Instance.rmkerbals.ALLRMKerbals.ToList();
            }
            catch (Exception ex)
            {
                RmUtils.LogMessage("Error in:  RosterManagerAddon.OnRMRosterToggle.  " + ex, "Error", true);
            }
        }
Exemple #2
0
        internal static void Display()
        {
            ScrollDetailsPosition = GUILayout.BeginScrollView(ScrollDetailsPosition, RMStyle.ScrollStyle, GUILayout.Height(210), GUILayout.Width(680));
            Rect   rect    = new Rect();
            string label   = "";
            string toolTip = "";

            GUILayout.Label("Kerbal Flight History", RMStyle.LabelStyleBold);
            GUILayout.Label(WindowRoster.SelectedKerbal.Name + " - (" + WindowRoster.SelectedKerbal.Title + ")", RMStyle.LabelStyleBold, GUILayout.MaxWidth(300));

            if (!string.IsNullOrEmpty(RMAddon.saveMessage))
            {
                GUILayout.Label(RMAddon.saveMessage, RMStyle.ErrorLabelRedStyle);
            }

            // Begin Tab contents.
            FlightLog thisLog = WindowRoster.SelectedKerbal.Kerbal.flightLog;

            foreach (FlightLog.Entry thisEntry in thisLog.Entries)
            {
                GUILayout.Label(thisEntry.flight.ToString() + " - " + thisEntry.target + " - " + thisEntry.type);
            }

            //End Tab contents
            GUILayout.EndScrollView();

            WindowRoster.DisplayEditActionButtons(ref rect, ref label, ref toolTip);
        }
Exemple #3
0
        internal static void Display()
        {
            ScrollDetailsPosition = GUILayout.BeginScrollView(ScrollDetailsPosition, RMStyle.ScrollStyle, GUILayout.Height(210), GUILayout.Width(680));
            Rect   rect    = new Rect();
            string label   = "";
            string toolTip = "";

            GUILayout.Label("Kerbal Records", RMStyle.LabelStyleBold);
            GUILayout.Label(WindowRoster.SelectedKerbal.Name + " - (" + WindowRoster.SelectedKerbal.Title + ")", RMStyle.LabelStyleBold, GUILayout.MaxWidth(300));

            if (!string.IsNullOrEmpty(RMAddon.saveMessage))
            {
                GUILayout.Label(RMAddon.saveMessage, RMStyle.ErrorLabelRedStyle);
            }

            // Begin Tab contents.

            if (GUILayout.Button("Enter Notes", GUILayout.Width(100)))
            {
            }

            //End Tab contents
            GUILayout.EndScrollView();

            WindowRoster.DisplayEditActionButtons(ref rect, ref label, ref toolTip);
        }
Exemple #4
0
        //Toolbar button click handlers
        internal static void OnRMRosterToggle()
        {
            //Debug.Log("[RosterManager]:  RosterManagerAddon.OnSMRosterToggleOn");
            try
            {
                if (HighLogic.LoadedScene == GameScenes.SPACECENTER)
                {
                    WindowRoster.ShowWindow = !WindowRoster.ShowWindow;
                    if (RMSettings.EnableBlizzyToolbar)
                    {
                        RMRoster_Blizzy.TexturePath = WindowRoster.ShowWindow ? TextureFolder + "Icon_On_24" : TextureFolder + "Icon_Off_24";
                    }
                    else
                    {
                        RMRoster_Stock.SetTexture((Texture)GameDatabase.Instance.GetTexture(WindowRoster.ShowWindow ? TextureFolder + "Icon_On_38" : TextureFolder + "Icon_Off_38", false));
                    }

                    RMAddon.FrozenKerbals = WindowRoster.GetFrozenKerbals();
                    AllCrew = HighLogic.CurrentGame.CrewRoster.Crew.ToList();
                    if (InstalledMods.IsDFInstalled)
                    {
                        AllCrew.AddRange(HighLogic.CurrentGame.CrewRoster.Unowned);
                    }
                }
            }
            catch (Exception ex)
            {
                Utilities.LogMessage("Error in:  RosterManagerAddon.OnSMRosterToggleOn.  " + ex.ToString(), "Error", true);
            }
        }
Exemple #5
0
 internal static void FireEventTriggers(Vessel vessel)
 {
     // Per suggestion by shaw (http://forum.kerbalspaceprogram.com/threads/62270?p=1033866&viewfull=1#post1033866)
     // and instructions for using CLS API by codepoet.
     RmUtils.LogMessage("FireEventTriggers:  Active.", "info", RMSettings.VerboseLogging);
     WindowRoster.UpdateRosterList();
     GameEvents.onVesselChange.Fire(vessel);
 }
Exemple #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();
                Utilities.LogMessage("RosterManagerAddon.Awake Active...", "info", RMSettings.VerboseLogging);

                if (RMSettings.EnableBlizzyToolbar)
                {
                    // Let't try to use Blizzy's toolbar
                    Utilities.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);
                        }
                        Utilities.LogMessage("RosterManagerAddon.Awake - Stock Toolbar Selected.", "Info", RMSettings.VerboseLogging);
                    }
                }
                else
                {
                    // Use stock Toolbar
                    Utilities.LogMessage("RosterManagerAddon.Awake - Stock Toolbar Selected.", "Info", RMSettings.VerboseLogging);
                    if (ApplicationLauncher.Ready)
                    {
                        OnGuiAppLauncherReady();
                    }
                    else
                    {
                        GameEvents.onGUIApplicationLauncherReady.Add(OnGuiAppLauncherReady);
                    }
                }
            }
            catch (Exception ex)
            {
                Utilities.LogMessage("Error in:  RosterManagerAddon.Awake.  Error:  " + ex, "Error", true);
            }
        }
 internal static void RefreshCrew()
 {
     if (!IsCorrectSceneLoaded())
     {
         return;
     }
     //RMAddon.FrozenKerbals.Clear();
     AllCrew.Clear();
     FrozenKerbals = WindowRoster.GetFrozenKerbals();
     if (RMLifeSpan.Instance != null)
     {
         AllCrew = RMLifeSpan.Instance.RMKerbals.AllrmKerbals.ToList();
     }
 }
Exemple #8
0
 internal static void RefreshCrew(GameScenes scene)
 {
     if (scene != GameScenes.EDITOR && scene != GameScenes.FLIGHT && scene != GameScenes.SPACECENTER &&
         scene != GameScenes.TRACKSTATION)
     {
         return;
     }
     //RMAddon.FrozenKerbals.Clear();
     AllCrew.Clear();
     FrozenKerbals = WindowRoster.GetFrozenKerbals();
     if (RMLifeSpan.Instance != null)
     {
         AllCrew = RMLifeSpan.Instance.RMKerbals.AllrmKerbals.ToList();
     }
 }
Exemple #9
0
        internal static void Display()
        {
            ScrollDetailsPosition = GUILayout.BeginScrollView(ScrollDetailsPosition, RMStyle.ScrollStyle, GUILayout.Height(210), GUILayout.Width(680));
            Rect   rect    = new Rect();
            string label   = "";
            string toolTip = "";

            GUILayout.Label("Kerbal Training", RMStyle.LabelStyleBold);
            GUILayout.Label(WindowRoster.SelectedKerbal.Name + " - (" + WindowRoster.SelectedKerbal.Title + ")", RMStyle.LabelStyleBold, GUILayout.MaxWidth(300));

            if (!string.IsNullOrEmpty(RMAddon.saveMessage))
            {
                GUILayout.Label(RMAddon.saveMessage, RMStyle.ErrorLabelRedStyle);
            }

            GUILayout.Label("", GUILayout.Width(10));
            GUILayout.Label("Skill");
            GUILayout.BeginHorizontal();
            GUILayout.Label("", GUILayout.Width(10));
            GUILayout.Label("0", GUILayout.Width(10));
            WindowRoster.SelectedKerbal.Skill = (int)GUILayout.HorizontalSlider(WindowRoster.SelectedKerbal.Skill, 0, 5, GUILayout.MaxWidth(300));
            rect = GUILayoutUtility.GetLastRect();
            if (Event.current.type == EventType.Repaint && RMSettings.ShowToolTips == true)
            {
                ToolTip = Utilities.SetActiveTooltip(rect, WindowRoster.Position, GUI.tooltip, ref ToolTipActive, 30, 50);
            }
            GUILayout.Label(WindowRoster.SelectedKerbal.Skill.ToString() + " / 5");
            GUILayout.EndHorizontal();

            GUILayout.Label("Experience");
            GUILayout.BeginHorizontal();
            GUILayout.Label("", GUILayout.Width(10));
            GUILayout.Label("0", GUILayout.Width(10));
            WindowRoster.SelectedKerbal.Experience = (int)GUILayout.HorizontalSlider(WindowRoster.SelectedKerbal.Experience, 0, 99999, GUILayout.MaxWidth(300));
            rect = GUILayoutUtility.GetLastRect();
            if (Event.current.type == EventType.Repaint && RMSettings.ShowToolTips == true)
            {
                ToolTip = Utilities.SetActiveTooltip(rect, WindowRoster.Position, GUI.tooltip, ref ToolTipActive, 30, 50);
            }
            GUILayout.Label(WindowRoster.SelectedKerbal.Experience.ToString() + " / 99999");
            GUILayout.EndHorizontal();

            GUILayout.EndScrollView();

            WindowRoster.DisplayEditActionButtons(ref rect, ref label, ref toolTip);
        }
Exemple #10
0
        internal static void Display()
        {
            ScrollDetailsPosition = GUILayout.BeginScrollView(ScrollDetailsPosition, RMStyle.ScrollStyle, GUILayout.Height(210), GUILayout.Width(680));
            Rect   rect    = new Rect();
            string label   = "";
            string toolTip = "";

            GUILayout.Label(WindowRoster.SelectedKerbal.IsNew ? "Create a Kerbal" : "Edit a Kerbal", RMStyle.LabelStyleBold);
            if (RMSettings.EnableKerbalRename)
            {
                GUILayout.BeginHorizontal();
                WindowRoster.SelectedKerbal.Name = GUILayout.TextField(WindowRoster.SelectedKerbal.Name, GUILayout.MaxWidth(300));
                GUILayout.Label(" - (" + WindowRoster.SelectedKerbal.Kerbal.experienceTrait.Title + ")");
                GUILayout.EndHorizontal();
            }
            else
            {
                GUILayout.Label(WindowRoster.SelectedKerbal.Name + " - (" + WindowRoster.SelectedKerbal.Title + ")", RMStyle.LabelStyleBold, GUILayout.MaxWidth(300));
            }

            if (!string.IsNullOrEmpty(RMAddon.saveMessage))
            {
                GUILayout.Label(RMAddon.saveMessage, RMStyle.ErrorLabelRedStyle);
            }
            if (RMSettings.EnableKerbalRename && RMSettings.RenameWithProfession)
            {
                WindowRoster.DisplaySelectProfession();
            }
            WindowRoster.DisplaySelectGender();
            WindowRoster.SelectedKerbal.Gender = WindowRoster.gender;

            GUILayout.Label("Courage");
            WindowRoster.SelectedKerbal.Courage = GUILayout.HorizontalSlider(WindowRoster.SelectedKerbal.Courage, 0, 1, GUILayout.MaxWidth(300));

            GUILayout.Label("Stupidity");
            WindowRoster.SelectedKerbal.Stupidity = GUILayout.HorizontalSlider(WindowRoster.SelectedKerbal.Stupidity, 0, 1, GUILayout.MaxWidth(300));

            WindowRoster.SelectedKerbal.Badass = GUILayout.Toggle(WindowRoster.SelectedKerbal.Badass, "Badass");

            GUILayout.EndScrollView();

            WindowRoster.DisplayEditActionButtons(ref rect, ref label, ref toolTip);
        }
        public string SubmitChanges()
        {
            if (NameExists())
            {
                return("That name is in use!");
            }

            SyncKerbal();

            if (!IsNew)
            {
                return(string.Empty);
            }
            // Add to roster.
            Kerbal.rosterStatus = ProtoCrewMember.RosterStatus.Available;
            HighLogic.CurrentGame.CrewRoster.AddCrewMember(Kerbal);

            WindowRoster.UpdateRosterList();
            return(string.Empty);
        }