예제 #1
0
        public void Start()
        {
            if (Instance != null)
            {
                Destroy(this);
                return;
            }

            Instance = this;

            ctrlLockAddon = new AddOns.ControlLockAddon();

            Satellites = new SatelliteManager();
            Antennas = new AntennaManager();
            Network = new NetworkManager();
            Renderer = NetworkRenderer.CreateAndAttach();

            FilterOverlay = new FilterOverlay();
            FocusOverlay = new FocusOverlay();
            TimeWarpDecorator = new TimeWarpDecorator();

            FlightUIPatcher.Patch();

            RTLog.Notify("RTCore {0} loaded successfully.", RTUtil.Version);

            foreach (var vessel in FlightGlobals.Vessels)
            {
                Satellites.RegisterProto(vessel);
                Antennas.RegisterProtos(vessel);
            }
        }
예제 #2
0
        private async void ToolbarItem_Clicked(object sender, EventArgs e)
        {
            if (FilterOverlay.IsVisible)
            {
                // If overlay is visible, slide it to the right, and set as invisible.
                await FilterOverlay.TranslateTo(this.Width - 100, FilterOverlay.Y);

                FilterOverlay.IsVisible = false;
            }
            else
            {
                // If overlay is invisible, make it visible and slide to the left.
                FilterOverlay.IsVisible = true;
                await FilterOverlay.TranslateTo(0, FilterOverlay.Y);
            }
        }
예제 #3
0
        /// <summary>
        /// Called by Unity engine during initialization phase.
        /// Only ever called once.
        /// </summary>
        public void Start()
        {
            // Destroy the Core instance if != null or if RemoteTech is disabled
            if (Instance != null || !RTSettings.Instance.RemoteTechEnabled)
            {
                Destroy(this);
                return;
            }

            Instance = this;

            // disable KSP CommNet
            HighLogic.fetch.currentGame.Parameters.Difficulty.EnableCommNet = (RTSettings.Instance.CommNetEnabled = false);

            // add-ons
            KacAddon = new AddOns.KerbalAlarmClockAddon();

            // managers
            Satellites = new SatelliteManager();
            Antennas = new AntennaManager();
            Network = new NetworkManager();
            Renderer = NetworkRenderer.CreateAndAttach();

            // overlays
            FilterOverlay = new FilterOverlay();
            FocusOverlay = new FocusOverlay();
            TimeWarpDecorator = new TimeWarpDecorator();

            // Handling new F2 GUI Hiding
            GameEvents.onShowUI.Add(UiOn);
            GameEvents.onHideUI.Add(UiOff);

            RTLog.Notify("RTCore {0} loaded successfully.", RTUtil.Version);

            // register vessels and antennas
            foreach (var vessel in FlightGlobals.Vessels)
            {
                // do not try to register vessel types that have no chance of being RT controlled.
                // includes: debris, SpaceObject, unknown, EVA and flag
                if ((vessel.vesselType <= VesselType.Unknown) || (vessel.vesselType >= VesselType.EVA))
                    continue;

                Satellites.RegisterProto(vessel);
                Antennas.RegisterProtos(vessel);
            }
        }