private void startTracking()
        {
            int       count      = 0;
            RMMModule aRMMModule = null;

            foreach (Part p in FlightGlobals.ActiveVessel.parts)
            {
                foreach (PartModule pm in p.Modules)
                {
                    if (pm.ClassName == "RMMModule")
                    {
                        count++;
                        aRMMModule = p.Modules.OfType <RMMModule>().FirstOrDefault();
                        if (aRMMModule.trackingPrimary)
                        {
                            aRMMModule.OpenGUITracking(); return;
                        }
                    }
                }
            }

            if (count == 1)
            {
                aRMMModule.OpenGUITracking(); return;
            }
        }
예제 #2
0
 public Tracking(RMMModule partModule)
 {
     _partModule = partModule;
     if (_mission == null && !String.IsNullOrEmpty(trackMissionId))
     {
         _mission = Mission.GetMissionById(trackMissionId);
     }
 }
예제 #3
0
 private void SetThisPortPrimary()
 {
     foreach (Part p in vessel.parts)
     {
         RMMModule rmmModule = p.Modules.OfType <RMMModule>().FirstOrDefault();
         if (rmmModule != null && rmmModule.trackMissionId == trackMissionId)
         {
             rmmModule.trackingPrimary = false;
             rmmModule.PortCode        = "";
         }
     }
     trackingPrimary      = true;
     _partModule.PortCode = "Mission Part";
 }
예제 #4
0
 private void setOtherModules()
 {
     foreach (Part p in vessel.parts)
     {
         foreach (PartModule pm in p.Modules)
         {
             if (pm.ClassName == "RMMModule")
             {
                 RMMModule ComOffMod = p.Modules.OfType <RMMModule>().FirstOrDefault();
                 ComOffMod.trackMissionId = trackMissionId;
             }
         }
     }
 }
예제 #5
0
 private void updateNextLogicTime(Vessel ves)
 {
     foreach (Part p in ves.parts)
     {
         foreach (PartModule pm in p.Modules)
         {
             if (pm.ClassName == "RMMModule" && part.flightID != p.flightID)
             {
                 RMMModule ComOffMod = p.Modules.OfType <RMMModule>().FirstOrDefault();
                 if (ComOffMod.trackMissionId == trackMissionId)
                 {
                     ComOffMod.nextLogicTime = _partModule.nextLogicTime;
                 }
             }
         }
     }
 }
예제 #6
0
 public static bool ForeignDockingPorts(Vessel ves, string trackID)
 {
     foreach (Part p in ves.parts)
     {
         foreach (PartModule pm in p.Modules)
         {
             if (pm.ClassName == "ModuleDockingNode")
             {
                 RMMModule ComOffMod = p.Modules.OfType <RMMModule>().FirstOrDefault();
                 if (ComOffMod.trackMissionId != trackID)
                 {
                     return(true);
                 }
             }
         }
     }
     return(false);
 }
예제 #7
0
        private void ensurePrimaryExists()
        {
            foreach (Part p in vessel.parts)
            {
                foreach (PartModule pm in p.Modules)
                {
                    if (pm.ClassName == "RMMModule")
                    {
                        RMMModule ComOffMod = p.Modules.OfType <RMMModule>().FirstOrDefault();
                        if (ComOffMod.trackMissionId == trackMissionId && ComOffMod.trackingPrimary)
                        {
                            return;
                        }
                    }
                }
            }

            foreach (Part p in vessel.parts)
            {
                foreach (PartModule pm in p.Modules)
                {
                    if (pm.ClassName == "RMMModule")
                    {
                        RMMModule ComOffMod = p.Modules.OfType <RMMModule>().FirstOrDefault();
                        if (ComOffMod.trackMissionId == trackMissionId)
                        {
                            if (p.flightID > part.flightID)
                            {
                                return;
                            }
                        }
                    }
                }
            }
            trackingPrimary = true;
        }
예제 #8
0
 private void updateTrackingVars(Vessel ves)
 {
     foreach (Part p in ves.parts)
     {
         foreach (PartModule pm in p.Modules)
         {
             if (pm.ClassName == "RMMModule" && part.flightID != p.flightID)
             {
                 RMMModule ComOffMod = p.Modules.OfType <RMMModule>().FirstOrDefault();
                 if (ComOffMod.trackMissionId == trackMissionId)
                 {
                     ComOffMod.trackingActive         = trackingActive;
                     ComOffMod.trackingStatus         = trackingStatus;
                     ComOffMod.trackPartCount         = trackPartCount;
                     ComOffMod.returnMission          = returnMission;
                     ComOffMod.returnMissionDeparted  = returnMissionDeparted;
                     ComOffMod.trackFolderName        = trackFolderName;
                     ComOffMod.trackMissionTime       = trackMissionTime;
                     ComOffMod.trackBody              = trackBody;
                     ComOffMod.trackMaxOrbitAltitude  = trackMaxOrbitAltitude;
                     ComOffMod.trackDescription       = trackDescription;
                     ComOffMod.trackCrew              = trackCrew;
                     ComOffMod.trackCrewCapacity      = trackCrewCapacity;
                     ComOffMod.trackReturnEnabled     = trackReturnEnabled;
                     ComOffMod.trackSafeReturn        = trackSafeReturn;
                     ComOffMod.trackReturnResources   = trackReturnResources;
                     ComOffMod.trackReturnCargoMass   = trackReturnCargoMass;
                     ComOffMod.trackDockingDistance   = trackDockingDistance;
                     ComOffMod.trackMinimumReturnCrew = trackMinimumReturnCrew;
                     //ComOffMod.trackCrewBalance = trackCrewBalance;
                     //ComOffMod.trackReturnCrewBalance = trackReturnCrewBalance;
                 }
             }
         }
     }
 }
예제 #9
0
        /// <summary>
        /// GUILocation
        /// </summary>
        /// <param name="windowID"></param>
        private void WindowGUILocation(int windowID)
        {
            GUI.DragWindow(new Rect(0, 0, 350, 30));
            if (rmmmSelectGUI != null)
            {
                rmmmSelectGUI.windowGUIMainX = windowPosGUILocation.xMin;
                rmmmSelectGUI.windowGUIMainY = windowPosGUILocation.yMin + windowPosGUILocation.height;
                rmmmSelectGUI.windowGUIMainWidth = windowPosGUILocation.width;
            }

            GUILayout.BeginVertical();

            scrollPositionModules = GUILayout.BeginScrollView(scrollPositionModules, true, false, horiScrollBarStyle, GUIStyle.none, GUILayout.Width(350), GUILayout.Height(50));
            GUILayout.BeginHorizontal();
            foreach (RMMModule rmmm in RegisteredModuleList)
            {
                if (GUILayout.Button(rmmm.PortCode, buttonStyle, GUILayout.Height(30)))
                {
                    if (rmmmSelectGUI != null) { rmmmSelectGUI.closeGUIMain(); }
                    rmmmSelectGUI = rmmm;
                    rmmmSelectGUI.closeGUIMain();
                    rmmmSelectGUI.openGUIMain();
                }
            }
            GUILayout.EndHorizontal();
            GUILayout.EndScrollView();

            GUILayout.EndVertical();
        }