Exemple #1
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);
            }
        }
Exemple #2
0
        // Addon state event handlers
        internal void Awake()
        {
            try
            {
                if (HighLogic.LoadedScene == GameScenes.FLIGHT || HighLogic.LoadedScene == GameScenes.SPACECENTER)
                {
                    DontDestroyOnLoad(this);
                    RMSettings.ApplySettings();
                    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
                            GameEvents.onGUIApplicationLauncherReady.Add(OnGUIAppLauncherReady);
                            GameEvents.onGUIApplicationLauncherDestroyed.Add(OnGUIAppLauncherDestroyed);
                            Utilities.LogMessage("RosterManagerAddon.Awake - Stock Toolbar Selected.", "Info", RMSettings.VerboseLogging);
                        }
                    }
                    else
                    {
                        // Use stock Toolbar
                        Utilities.LogMessage("RosterManagerAddon.Awake - Stock Toolbar Selected.", "Info", RMSettings.VerboseLogging);
                        GameEvents.onGUIApplicationLauncherReady.Add(OnGUIAppLauncherReady);
                        GameEvents.onGUIApplicationLauncherDestroyed.Add(OnGUIAppLauncherDestroyed);
                    }
                }
            }
            catch (Exception ex)
            {
                Utilities.LogMessage("Error in:  RosterManagerAddon.Awake.  Error:  " + ex.ToString(), "Error", true);
            }
        }