コード例 #1
0
 // Git Issue #85.  sometimes spaces are not updating on a vessel.  Deleting a pod does not clear the current vessel.
 private void OnEditorPodPicked(Part part)
 {
     _vessel.Clear();
     _vessel = null;
     if (null != EditorLogic.RootPart)
     {
         _vessel = new CLSVessel();
         _vessel.Populate(EditorLogic.RootPart);
     }
     _editorPartCount = 1;
 }
コード例 #2
0
        private void OnEditorShipModified(ShipConstruct vesselConstruct)
        {
            if (vesselConstruct.Parts.Count == _editorPartCount)
            {
                return;
            }
            //Debug.Log("Calling RebuildCLSVessel as the part count has changed in the editor");

            if (null != _vessel)
            {
                _vessel.Clear();
                _vessel = null;
            }

            if (null != EditorLogic.RootPart)
            {
                _vessel = new CLSVessel();
                _vessel.Populate(EditorLogic.RootPart);

                // TODO recoupler support
            }

            _editorPartCount = vesselConstruct.Parts.Count;
            // First unhighlight the space that was selected.
            if (-1 != WindowSelectedSpace && WindowSelectedSpace < _vessel.Spaces.Count)
            {
                _vessel.Spaces[WindowSelectedSpace].Highlight(true);
            }
        }
コード例 #3
0
        private void RebuildCLSVessel()
        {
            if (null != _clsVessel)
            {
                _clsVessel.Clear();
                _clsVessel = null;
            }

            if (vessel.rootPart == null)
            {
                return;
            }

            try
            {
                // Build new vessel information
                _clsVessel = new CLSVessel();
                _clsVessel.Populate(vessel.rootPart);

                // TODO recoupler support
            }
            catch (Exception ex)
            {
                Debug.Log($"CLS rebuild Vessel Error:  { ex}");
            }
        }
コード例 #4
0
        public override void OnUnloadVessel()
        {
            if (null != _clsVessel)
            {
                _clsVessel.Clear();
                _clsVessel = null;
            }

            // Recoupler support
            for (int i = CLSAddon.Instance.requestedConnections.Count - 1; i >= 0; i--)
            {
                CLSAddon.ConnectPair connectPair = CLSAddon.Instance.requestedConnections[i];
                if (connectPair.part1.vessel == this.vessel)
                {
                    CLSAddon.Instance.requestedConnections.Remove(connectPair);
                }
            }
        }
コード例 #5
0
 private void RebuildCLSVessel()
 {
     if (HighLogic.LoadedSceneIsFlight)
     {
         RebuildCLSVessel(FlightGlobals.ActiveVessel);
     }
     else if (HighLogic.LoadedSceneIsEditor)
     {
         if (null == EditorLogic.startPod)
         {
             // There is no root part in the editor - this ought to mean that there are no parts. Juest clear out everything
             if (null != this.vessel)
             {
                 vessel.Clear();
             }
             this.vessel        = null;
             this.selectedSpace = -1;
         }
         else
         {
             RebuildCLSVessel(EditorLogic.startPod);
         }
     }
 }