void OnDestroy()
        {
            if (!CompatibilityChecker.IsAllCompatible())
            {
                return;
            }

            if (config != null)
            {
                SaveConfigs();
            }

            GameEvents.onGUIApplicationLauncherReady.Remove(OnGUIAppLauncherReady);
            if (FARFlightButtonStock != null)
            {
                ApplicationLauncher.Instance.RemoveModApplication(FARFlightButtonStock);
            }

            if (FARFlightButtonBlizzy != null)
            {
                FARFlightButtonBlizzy.Destroy();
            }

            //GameEvents.onVesselLoaded.Remove(FindPartsWithoutFARModel);
            GameEvents.onVesselLoaded.Remove(FindPartsWithoutFARModel);
            GameEvents.onVesselGoOffRails.Remove(FindPartsWithoutFARModel);
            GameEvents.onVesselWasModified.Remove(UpdateFARPartModules);
            GameEvents.onVesselCreate.Remove(UpdateFARPartModules);
            GameEvents.onVesselChange.Remove(ChangeControlSys);
            GameEvents.onShowUI.Remove(ShowUI);
            GameEvents.onHideUI.Remove(HideUI);
        }
Ejemplo n.º 2
0
        public virtual void Initialization()
        {
            if (!CompatibilityChecker.IsAllCompatible())
            {
                this.enabled = false;
                return;
            }

            OnVesselPartsChange = UpdateShipPartsList;
            UpdateShipPartsList();
        }
Ejemplo n.º 3
0
        public void Awake()
        {
            if (!CompatibilityChecker.IsAllCompatible())
            {
                return;
            }

            GameEvents.onEditorPartEvent.Add(UpdateWingInteractionsEvent);
            buttonsNeedInitializing = true;
            LoadConfigs();
        }
Ejemplo n.º 4
0
        void OnDestroy()
        {
            if (!CompatibilityChecker.IsAllCompatible())
            {
                return;
            }

            GameEvents.onEditorPartEvent.Remove(UpdateWingInteractionsEvent);
            SaveConfigs();
            DestroyButtons();
        }
Ejemplo n.º 5
0
        public void LateUpdate()
        {
            if (!CompatibilityChecker.IsAllCompatible())
            {
                return;
            }

            FARAeroUtil.ResetEditorParts();
            FARBaseAerodynamics.GlobalCoLReady = false;

            if (EditorLogic.fetch)
            {
                if (editorGUI == null)
                {
                    editorGUI = new FAREditorGUI();
                    //editorGUI.LoadGUIParameters();
                    editorGUI.RestartCtrlGUI();
                    GameEvents.onEditorUndo.Add(editorGUI.ResetAll);
                    GameEvents.onEditorRedo.Add(editorGUI.ResetAll);
                }
                if (EditorLogic.RootPart != null)
                {
                    editorShip = FARAeroUtil.AllEditorParts;

                    if (buttonsNeedInitializing)
                    {
                        InitializeButtons();
                    }

                    /*if (EditorLogic.RootPart != lastRootPart)
                     * {
                     *  lastRootPart = EditorLogic.RootPart;
                     *  EditorPartsChanged = true;
                     * }*/

                    if (FARAeroUtil.EditorAboutToAttach() && count++ >= 20)
                    {
                        EditorPartsChanged = true;
                        count = 0;
                    }

                    if (part_count_all != editorShip.Count || part_count_ship != EditorLogic.SortedShipList.Count || EditorPartsChanged)
                    {
                        UpdateEditorShipModules();
                    }
                }
                else if (!buttonsNeedInitializing)
                {
                    DestroyButtons();
                }
            }
        }
        public void Start()
        {
            if (!CompatibilityChecker.IsAllCompatible())
            {
                return;
            }

            GameEvents.onVesselLoaded.Add(FindPartsWithoutFARModel);
            GameEvents.onVesselGoOffRails.Add(FindPartsWithoutFARModel);
            GameEvents.onVesselWasModified.Add(UpdateFARPartModules);
            GameEvents.onVesselCreate.Add(UpdateFARPartModules);
            GameEvents.onVesselChange.Add(ChangeControlSys);
            GameEvents.onShowUI.Add(ShowUI);
            GameEvents.onHideUI.Add(HideUI);
        }
        public void LateUpdate()
        {
            if (!CompatibilityChecker.IsAllCompatible())
            {
                return;
            }

            if (FlightGlobals.ready)
            {
                //FARFlightButton = FARControlSys.ActiveControlSys && (FARControlSys.ActiveControlSys.vessel == FlightGlobals.ActiveVessel);

                if (FARControlSys.ActiveControlSys == null)
                {
                    FARControlSys.SetActiveControlSys(FlightGlobals.ActiveVessel);
                }
            }
        }
Ejemplo n.º 8
0
        public virtual void Start()
        {
            if (!CompatibilityChecker.IsAllCompatible())
            {
                this.enabled = false;
                return;
            }

            OnVesselPartsChange = UpdateShipPartsList;
            UpdateShipPartsList();

            if (HighLogic.LoadedSceneIsEditor)
            {
                part.OnEditorAttach  += OnEditorAttach;
                part.OnEditorDetach  += OnEditorAttach;
                part.OnEditorDestroy += OnEditorAttach;
            }
        }
        void OnDestroy()
        {
            if (!CompatibilityChecker.IsAllCompatible())
            {
                return;
            }

            SaveConfigs();
            GameEvents.onGUIApplicationLauncherReady.Remove(OnGUIAppLauncherReady);
            if (FARDebugButtonStock != null)
            {
                ApplicationLauncher.Instance.RemoveModApplication(FARDebugButtonStock);
            }

            if (FARDebugButtonBlizzy != null)
            {
                FARDebugButtonBlizzy.Destroy();
            }
        }
        public void Awake()
        {
            if (!CompatibilityChecker.IsAllCompatible())
            {
                this.enabled = false;
                return;
            }

            LoadConfigs();
            if (FARDebugValues.useBlizzyToolbar)
            {
                FARDebugButtonBlizzy             = ToolbarManager.Instance.add("ferram4", "FARDebugButtonBlizzy");
                FARDebugButtonBlizzy.TexturePath = "FerramAerospaceResearch/Textures/icon_button_blizzy";
                FARDebugButtonBlizzy.ToolTip     = "FAR Debug Options";
                FARDebugButtonBlizzy.OnClick    += (e) => debugMenu = !debugMenu;
            }
            else
            {
                GameEvents.onGUIApplicationLauncherReady.Add(OnGUIAppLauncherReady);
            }
        }
        public void Awake()
        {
            if (!CompatibilityChecker.IsAllCompatible())
            {
                return;
            }

            LoadConfigs();
            if (FARDebugValues.useBlizzyToolbar)
            {
                FARFlightButtonBlizzy             = ToolbarManager.Instance.add("ferram4", "FAREditorButton");
                FARFlightButtonBlizzy.TexturePath = "FerramAerospaceResearch/Textures/icon_button_blizzy";
                FARFlightButtonBlizzy.ToolTip     = "FAR Flight Systems";
                FARFlightButtonBlizzy.OnClick    += (e) => FARControlSys.minimize = !FARControlSys.minimize;
            }
            else
            {
                GameEvents.onGUIApplicationLauncherReady.Add(OnGUIAppLauncherReady);
            }

            InputLockManager.RemoveControlLock("FAREdLock");
        }
        public void Awake()
        {
            if (!CompatibilityChecker.IsAllCompatible())
            {
                return;
            }

            LoadConfigs();

            if (FARDebugValues.useBlizzyToolbar)
            {
                FAREditorButtonBlizzy             = ToolbarManager.Instance.add("ferram4", "FAREditorButton");
                FAREditorButtonBlizzy.TexturePath = "FerramAerospaceResearch/Textures/icon_button_blizzy";
                FAREditorButtonBlizzy.ToolTip     = "FAR Editor Analysis";
                FAREditorButtonBlizzy.OnClick    += (e) => FAREditorGUI.minimize = !FAREditorGUI.minimize;
            }
            else
            {
                GameEvents.onGUIApplicationLauncherReady.Add(OnGUIAppLauncherReady);
            }

            GameEvents.onShowUI.Add(ShowUI);
            GameEvents.onHideUI.Add(HideUI);
        }
        public void LateUpdate()
        {
            if (!CompatibilityChecker.IsAllCompatible())
            {
                return;
            }

            FARAeroUtil.ResetEditorParts();
            FARBaseAerodynamics.GlobalCoLReady = false;

            if (EditorLogic.fetch)
            {
                if (editorGUI == null)
                {
                    editorGUI = new FAREditorGUI();
                    //editorGUI.LoadGUIParameters();
                    editorGUI.RestartCtrlGUI();
                }
                if (EditorLogic.startPod != null)
                {
                    var editorShip = FARAeroUtil.AllEditorParts;


                    if (FARAeroUtil.EditorAboutToAttach() && count++ >= 10)
                    {
                        EditorPartsChanged = true;
                        count = 0;
                    }

                    if (part_count_all != editorShip.Count || part_count_ship != EditorLogic.SortedShipList.Count || EditorPartsChanged)
                    {
                        FindPartsWithoutFARModel(editorShip);
                        for (int i = 0; i < editorShip.Count; i++)
                        {
                            Part p = editorShip[i];
                            for (int j = 0; j < p.Modules.Count; j++)
                            {
                                PartModule m = p.Modules[j];
                                if (m is FARBaseAerodynamics)
                                {
                                    (m as FARBaseAerodynamics).ClearShielding();
                                }
                            }
                        }

                        for (int i = 0; i < editorShip.Count; i++)
                        {
                            Part p = editorShip[i];
                            for (int j = 0; j < p.Modules.Count; j++)
                            {
                                PartModule m = p.Modules[j];
                                if (m is FARPartModule)
                                {
                                    (m as FARPartModule).ForceOnVesselPartsChange();
                                }
                            }
                        }
                        part_count_all     = editorShip.Count;
                        part_count_ship    = EditorLogic.SortedShipList.Count;
                        EditorPartsChanged = false;
                    }
                }
            }
        }