This is the behaviour object that we hook events on to for flight
Inheritance: MonoBehaviourExtended
        internal ApplicationLauncherButton InitAppLauncherButton()
        {
            ApplicationLauncherButton retButton = null;

            ApplicationLauncherButton[] lstButtons = KerbalAlarmClock.FindObjectsOfType <ApplicationLauncherButton>();
            //LogFormatted("AppLauncher: Creating Button-BEFORE", lstButtons.Length);
            try
            {
                retButton = ApplicationLauncher.Instance.AddModApplication(
                    onAppLaunchToggleOn, onAppLaunchToggleOff,
                    onAppLaunchHoverOn, onAppLaunchHoverOff,
                    null, null,
                    ApplicationLauncher.AppScenes.ALWAYS,
                    (Texture)KACResources.toolbariconNorm);

                //AppLauncherButtonMutuallyExclusive(settings.AppLauncherMutuallyExclusive);

                //appButton = ApplicationLauncher.Instance.AddApplication(
                //    onAppLaunchToggleOn, onAppLaunchToggleOff,
                //    onAppLaunchHoverOn, onAppLaunchHoverOff,
                //    null, null,
                //    (Texture)Resources.texAppLaunchIcon);
                //appButton.VisibleInScenes = ApplicationLauncher.AppScenes.FLIGHT;
            }
            catch (Exception ex)
            {
                Log.error(ex, "AppLauncher: Failed to set up App Launcher Button");
                retButton = null;
            }
            lstButtons = KerbalAlarmClock.FindObjectsOfType <ApplicationLauncherButton>();
            //LogFormatted("AppLauncher: Creating Button-AFTER", lstButtons.Length);

            return(retButton);
        }
        private static ITargetable TargetDeserialize(String strInput)
        {
            ITargetable tReturn = null;

            String[] TargetParts = strInput.Split(",".ToCharArray());
            switch (TargetParts[0])
            {
            case "Vessel":
                if (KerbalAlarmClock.StoredVesselExists(TargetParts[1]))
                {
                    tReturn = KerbalAlarmClock.StoredVessel(TargetParts[1]);
                }
                break;

            case "CelestialBody":
                if (KerbalAlarmClock.CelestialBodyExists(TargetParts[1]))
                {
                    tReturn = KerbalAlarmClock.CelestialBody(TargetParts[1]);
                }
                break;

            default:
                break;
            }
            return(tReturn);
        }
Beispiel #3
0
        //Init the API Hooks
        private void APIAwake()
        {
            //set up the hookable object
            APIInstance = this;

            //set up any events we need from the core code

            //flag it ready
            Log.detail("API Ready");
            APIReady = true;
        }
 internal void DestroyAppLauncherButton()
 {
     //LogFormatted("AppLauncher: Destroying Button-BEFORE NULL CHECK");
     if (btnAppLauncher != null)
     {
         ApplicationLauncherButton[] lstButtons = KerbalAlarmClock.FindObjectsOfType <ApplicationLauncherButton>();
         Log.detail("AppLauncher: Destroying Button-Button Count:{0}", lstButtons.Length);
         ApplicationLauncher.Instance.RemoveModApplication(btnAppLauncher);
         btnAppLauncher = null;
     }
     //LogFormatted("AppLauncher: Destroying Button-AFTER NULL CHECK");
 }
Beispiel #5
0
        private void APIDestroy()
        {
            //tear it down
            APIInstance = null;

            //Tear down any events we need to remove
            //try {

            //} catch (Exception) { }

            Log.detail("API Cleaned up");
            APIReady = false;
        }
 public KACWorker_ViewOnly(KerbalAlarmClock parent) : base(parent)
 {
 }
        private void APIDestroy()
        {
            //tear it down
            APIInstance = null;

            //Tear down any events we need to remove
            //try {

            //} catch (Exception) { }

            LogFormatted("API Cleaned up");
            APIReady = false;
        }
        //Init the API Hooks
        private void APIAwake()
        {
            //set up the hookable object
            APIInstance = this;

            //set up any events we need from the core code

            //flag it ready
            LogFormatted("API Ready");
            APIReady = true;
        }
        public KACWorker(KerbalAlarmClock parent)
        {
            parentBehaviour = parent;
            Settings = KerbalAlarmClock.Settings;

            InitWorkerVariables();

            //Event for when the vessel changes (within a scene).
            KACWorkerGameState.VesselChanged += KACWorkerGameState_VesselChanged;
        }