Beispiel #1
0
        private void OnDestroy()
        {
            if (CustomCommNetUI != null)
            {
                Destroy(CustomCommNetUI);
            }
            if (CustomCommNetNetwork != null)
            {
                Destroy(CustomCommNetNetwork);
            }

            Cache.InitCommVessels();

            GameEvents.onVesselCreate.Remove(new EventData <Vessel> .OnEvent(OnVesselCountChanged));
            GameEvents.onVesselDestroy.Remove(new EventData <Vessel> .OnEvent(OnVesselCountChanged));
        }
Beispiel #2
0
        public static void CacheCommNetVessels()
        {
            if (!Cache.refreshCommNode)
            {
                return;
            }

            Cache.InitCommVessels();

            List <Vessel> allVessels = FlightGlobals.fetch.vessels;

            for (int i = 0; i < allVessels.Count; i++)
            {
                if (allVessels[i].connection != null && Lib.IsVessel(allVessels[i]))
                {
                    Lib.Debug("Caching CommNetVessel '{0}'", allVessels[i].vesselName);
                    Cache.CommNodeInfo(allVessels[i]);
                }
            }
            Cache.refreshCommNode = false;
        }