예제 #1
0
        // Called when applauncher is ready for population
        void onAppLauncherLoad()
        {
            Log.detail("onAppLauncherLoad");

            // deserialize use_neo_gui flag
            AutoSerialization.Deserialize(this, "AtmosphereAutopilot",
                                          "Global_settings.txt",
                                          typeof(GlobalSerializable), null);

            if (prefabs == null)
            {
                Log.warn("No prefabs found, Neo-GUI unavailable");
                use_neo_gui = false;
            }

            if (use_neo_gui)
            {
                if (launcher_btn_textore_off == null || launcher_btn_textore_on == null)
                {
                    launcher_btn_textore_off = prefabs.LoadAsset <Texture>("AA_off");
                    launcher_btn_textore_on  = prefabs.LoadAsset <Texture>("AA_on");
                }
                if (ApplicationLauncher.Ready)
                {
                    bool hidden;
                    bool contains = ApplicationLauncher.Instance.Contains(launcher_btn, out hidden);
                    if (!contains)
                    {
                        launcher_btn = ApplicationLauncher.Instance.AddModApplication(
                            OnALTrueNeo, OnALFalseNeo, OnALHover, OnALUnHoverNeo, null, null,
                            ApplicationLauncher.AppScenes.FLIGHT | ApplicationLauncher.AppScenes.MAPVIEW,
                            launcher_btn_textore_off);
                    }
                    if (ActiveVessel != null &&
                        autopilot_module_lists.ContainsKey(ActiveVessel) &&
                        autopilot_module_lists[ActiveVessel][typeof(TopModuleManager)] != null)
                    {
                        setLauncherOnOffIcon(autopilot_module_lists[ActiveVessel][typeof(TopModuleManager)].Active);
                    }
                }
            }
            else
            {
                if (ApplicationLauncher.Ready)
                {
                    bool hidden;
                    bool contains = ApplicationLauncher.Instance.Contains(launcher_btn, out hidden);
                    if (!contains)
                    {
                        launcher_btn = ApplicationLauncher.Instance.AddModApplication(
                            OnALTrue, OnALFalse, OnHover, OnALUnHover, null, null,
                            ApplicationLauncher.AppScenes.FLIGHT | ApplicationLauncher.AppScenes.MAPVIEW,
                            Asset.Texture2D.LoadFromFile("icons", "toolbar")
                            );
                    }
                }
            }
        }
예제 #2
0
        // Called when applauncher is ready for population
        void onAppLauncherLoad()
        {
            // deserialize use_neo_gui flag
            AutoSerialization.Deserialize(this, "AtmosphereAutopilot",
                                          KSPUtil.ApplicationRootPath + "GameData/AtmosphereAutopilot/Global_settings.txt",
                                          typeof(GlobalSerializable), null);

            if (prefabs == null)
            {
                Debug.Log("[AtmosphereAutopilot]: No prefabs found, Neo-GUI unavailable");
                use_neo_gui = false;
            }

            if (use_neo_gui)
            {
                if (launcher_btn_textore_off == null || launcher_btn_textore_on == null)
                {
                    launcher_btn_textore_off = prefabs.LoadAsset <Texture>("AA_off");
                    launcher_btn_textore_on  = prefabs.LoadAsset <Texture>("AA_on");
                }
                if (ApplicationLauncher.Ready)
                {
                    bool hidden;
                    bool contains = ApplicationLauncher.Instance.Contains(launcher_btn, out hidden);
                    if (!contains)
                    {
                        launcher_btn = ApplicationLauncher.Instance.AddModApplication(
                            OnALTrueNeo, OnALFalseNeo, OnALHover, OnALUnHoverNeo, null, null,
                            ApplicationLauncher.AppScenes.FLIGHT | ApplicationLauncher.AppScenes.MAPVIEW,
                            launcher_btn_textore_off);
                    }
                    if (ActiveVessel != null &&
                        autopilot_module_lists.ContainsKey(ActiveVessel) &&
                        autopilot_module_lists[ActiveVessel][typeof(TopModuleManager)] != null)
                    {
                        setLauncherOnOffIcon(autopilot_module_lists[ActiveVessel][typeof(TopModuleManager)].Active);
                    }
                }
            }
            else
            {
                if (ApplicationLauncher.Ready)
                {
                    bool hidden;
                    bool contains = ApplicationLauncher.Instance.Contains(launcher_btn, out hidden);
                    if (!contains)
                    {
                        launcher_btn = ApplicationLauncher.Instance.AddModApplication(
                            OnALTrue, OnALFalse, OnHover, OnALUnHover, null, null,
                            ApplicationLauncher.AppScenes.FLIGHT | ApplicationLauncher.AppScenes.MAPVIEW,
                            GameDatabase.Instance.GetTexture("AtmosphereAutopilot/icon", false));
                    }
                }
            }
        }
예제 #3
0
 public bool Deserialize()
 {
     return(AutoSerialization.Deserialize(this, "settings_wnd", KSPUtil.ApplicationRootPath + "GameData/AtmosphereAutopilot/Global_settings.txt",
                                          typeof(GlobalSerializable), OnDeserialize));
 }
예제 #4
0
 public bool Deserialize()
 {
     return(AutoSerialization.Deserialize(this, "settings_wnd", "Global_settings.txt",
                                          typeof(GlobalSerializable), OnDeserialize));
 }
예제 #5
0
 /// <summary>
 /// Deserialize global fields. Optional OnDeserialize callback is used.
 /// </summary>
 public bool DeserializeGlobalSpecific()
 {
     return(AutoSerialization.Deserialize(this, module_name.Replace(' ', '_'),
                                          KSPUtil.ApplicationRootPath + "GameData/AtmosphereAutopilot/Global_settings.txt",
                                          typeof(GlobalSerializable), OnDeserialize));
 }
예제 #6
0
 /// <summary>
 /// Deserialize vessel-specific fields. Optional OnDeserialize callback is used.
 /// </summary>
 public bool DeserializeVesselSpecific()
 {
     return(AutoSerialization.Deserialize(this, module_name.Replace(' ', '_'),
                                          KSPUtil.ApplicationRootPath + "GameData/AtmosphereAutopilot/designs/" + vessel.vesselName + ".txt",
                                          typeof(VesselSerializable), OnDeserialize));
 }
 /// <summary>
 /// Deserialize window position
 /// </summary>
 public bool Deserialize()
 {
     return(AutoSerialization.Deserialize(this, "hotkey_manager",
                                          "Global_settings.txt",
                                          typeof(GlobalSerializable)));
 }
예제 #8
0
 /// <summary>
 /// Deserialize global fields. Optional OnDeserialize callback is used.
 /// </summary>
 public bool DeserializeGlobalSpecific()
 {
     return(AutoSerialization.Deserialize(this, module_name.Replace(' ', '_'),
                                          "Global_settings.txt",
                                          typeof(GlobalSerializable), OnDeserialize));
 }
예제 #9
0
 /// <summary>
 /// Deserialize vessel-specific fields. Optional OnDeserialize callback is used.
 /// </summary>
 public bool DeserializeVesselSpecific()
 {
     return(AutoSerialization.Deserialize(this, module_name.Replace(' ', '_'),
                                          "designs", vessel.vesselName + ".txt",
                                          typeof(VesselSerializable), OnDeserialize));
 }