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);
                }
            }
        }
Exemplo n.º 3
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 (FARAeroUtil.EditorAboutToAttach() && count++ >= 10)
                    {
                        EditorPartsChanged = true;
                        count = 0;
                    }

                    /*if (part_count_all != editorShip.Count || part_count_ship != EditorLogic.SortedShipList.Count || EditorPartsChanged)
                     * {
                     *
                     * }*/
                }
                else if (!buttonsNeedInitializing)
                {
                    DestroyButtons();
                }
            }
        }
Exemplo n.º 4
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;
                    }
                }
            }
        }