示例#1
0
        private void vesselChange(Vessel v)
        {
            currentCrew.Clear();

            if (resetting)
            {
                StopCoroutine("delayedReset");
            }

            StartCoroutine("delayedReset", false);
        }
示例#2
0
        private static IEnumerator parseProgressTree()
        {
            loaded = false;

            int timer = 0;

            while (ProgressTracking.Instance == null && timer < 500)
            {
                timer++;
                yield return(null);
            }

            if (timer >= 500)
            {
                Debug.Log("[Progress Tracking Parser] Progress Parser Timed Out");
                loaded = false;
                yield break;
            }

            while (timer < 10)
            {
                timer++;
                yield return(null);
            }

            bodySubTrees.Clear();
            standardNodes.Clear();
            intervalNodes.Clear();
            pointsOfInterest.Clear();

            loadIntervalNodes();
            loadStandardNodes();
            loadPOINodes();

            for (int i = 0; i < ProgressTracking.Instance.celestialBodyNodes.Length; i++)
            {
                CelestialBodySubtree b = ProgressTracking.Instance.celestialBodyNodes[i];

                loadNextBodyNode(b);
            }

            updateCompletionRecord();

            loaded = true;

            onProgressParsed.Fire();

            Debug.Log("[Progress Tracking Parser] Progress Nodes Loaded...");
        }
        protected override void OnUnregister()
        {
            suitableVessels.Clear();
            CleanupWaypoints();

            if (!registered)
            {
                return;
            }

            registered = false;

            GameEvents.VesselSituation.onOrbit.Remove(vesselOrbit);
            GameEvents.onVesselCreate.Remove(newVesselCheck);
            GameEvents.onPartCouple.Remove(dockCheck);
            GameEvents.onVesselSOIChanged.Remove(soiChange);
        }
        public override void CleanupWaypoints()
        {
            if (!waypointsOn || !useWaypoints)
            {
                return;
            }

            foreach (Waypoint w in wps.Values)
            {
                if (w == null)
                {
                    continue;
                }

                WaypointManager.RemoveWaypoint(w);
            }

            waypointsOn = false;
            wps.Clear();
        }
 public override void OnLoad(ConfigNode gameNode)
 {
     base.OnLoad(gameNode);
     if (gameNode.HasNode(configNodeName))
     {
         ConfigNode settingsNode = gameNode.GetNode(configNodeName);
         InterestedVessels.Clear();
         var vesselNodes = settingsNode.GetNodes(InterestedVessel.configNodeName);
         foreach (ConfigNode vesselNode in vesselNodes)
         {
             InterestedVessel interestedVessel = InterestedVessel.Load(vesselNode);
             if (interestedVessel != null)
             {
                 ProtoVessel key = interestedVessel.protovessel;
                 InterestedVessels.Add(key, interestedVessel);
             }
         }
     }
     Utilities.Log("OnLoad: ", gameNode);
 }
示例#6
0
 public static void ClearLists()
 {
     List.Clear();
     ModuleDict.Clear();
 }
 internal void resetMissionsList()
 {
     missionList.Clear();
 }
        public static IEnumerator loadContracts()
        {
            if (HighLogic.CurrentGame.Mode != Game.Modes.CAREER)
            {
                yield break;
            }

            loaded = false;

            int i = 0;

            //Agency modifiers don't seem to work unless I wait a few frames before loading contracts
            while (i < 5)
            {
                i++;
                yield return(null);
            }

            Debug.Log("[Contract Parser] Loading All Contracts...");

            activeContracts.Clear();
            offeredContracts.Clear();
            completedContracts.Clear();
            failedContracts.Clear();
            declinedContracts.Clear();

            for (int j = 0; j < ContractSystem.Instance.Contracts.Count; j++)
            {
                Contract c = ContractSystem.Instance.Contracts[j];

                if (c == null)
                {
                    Debug.Log("[Contract Parser] Error in loading null contract from master list");
                    continue;
                }

                contractContainer cc = new contractContainer(c);

                if (cc.Root == null)
                {
                    Debug.Log(string.Format("[Contract Parser] Error while loading contract of type {0}; skipping", c.GetType().Name));
                    continue;
                }

                switch (cc.Root.ContractState)
                {
                case Contract.State.Active:
                    addActiveContract(cc);
                    continue;

                case Contract.State.Offered:
                    addOfferedContract(cc);
                    continue;

                case Contract.State.Completed:
                    addCompletedContract(cc);
                    continue;

                case Contract.State.Cancelled:
                case Contract.State.DeadlineExpired:
                case Contract.State.Failed:
                    addFailedContract(cc);
                    continue;

                default:
                    continue;
                }
            }

            for (int j = 0; j < ContractSystem.Instance.ContractsFinished.Count; j++)
            {
                Contract c = ContractSystem.Instance.ContractsFinished[j];

                if (c == null)
                {
                    Debug.Log("[Contract Parser] Error in loading contract from finished list");
                    continue;
                }

                contractContainer cc = new contractContainer(c);

                if (cc.Root == null)
                {
                    Debug.Log(string.Format("[Contract Parser] Error while loading finished contract of type {0}; skipping", c.GetType().Name));
                    continue;
                }

                switch (cc.Root.ContractState)
                {
                case Contract.State.Active:
                    addActiveContract(cc);
                    continue;

                case Contract.State.Offered:
                    addOfferedContract(cc);
                    continue;

                case Contract.State.Completed:
                    addCompletedContract(cc);
                    continue;

                case Contract.State.Cancelled:
                case Contract.State.DeadlineExpired:
                case Contract.State.Failed:
                    addFailedContract(cc);
                    continue;

                default:
                    continue;
                }
            }

            if (contractReflection.CCLoaded)
            {
                RefreshCCOfferedContracts();
            }

            loaded = true;

            onContractsParsed.Fire();

            Debug.Log("[Contract Parser] Finished Loading All Contracts");
        }
示例#9
0
 public static void clearAnomalies()
 {
     anomalies.Clear();
 }