コード例 #1
0
        public void Start()
        {
            RotationChannel = GameEvents.FindEvent <EventData <byte, object> >("onSerialReceived16");
            if (RotationChannel != null)
            {
                RotationChannel.Add(vesselRotationCallback);
            }
            TranslationChannel = GameEvents.FindEvent <EventData <byte, object> >("onSerialReceived17");
            if (TranslationChannel != null)
            {
                TranslationChannel.Add(vesselTranslationCallback);
            }
            WheelChannel = GameEvents.FindEvent <EventData <byte, object> >("onSerialReceived18");
            if (WheelChannel != null)
            {
                WheelChannel.Add(wheelCallback);
            }
            ThrottleChannel = GameEvents.FindEvent <EventData <byte, object> >("onSerialReceived19");
            if (ThrottleChannel != null)
            {
                ThrottleChannel.Add(throttleCallback);
            }
            AutopilotChannel = GameEvents.FindEvent <EventData <byte, object> >("onSerialReceived28");
            if (AutopilotChannel != null)
            {
                AutopilotChannel.Add(autopilotModeCallback);
            }

            FlightGlobals.ActiveVessel.OnPostAutopilotUpdate += AutopilotUpdater;
        }
コード例 #2
0
        public void Start()
        {
            RotationChannel = GameEvents.FindEvent <EventData <byte, object> >("onSerialReceived" + InboundPackets.VesselRotation);
            if (RotationChannel != null)
            {
                RotationChannel.Add(vesselRotationCallback);
            }
            TranslationChannel = GameEvents.FindEvent <EventData <byte, object> >("onSerialReceived" + InboundPackets.VesselTranslation);
            if (TranslationChannel != null)
            {
                TranslationChannel.Add(vesselTranslationCallback);
            }
            WheelChannel = GameEvents.FindEvent <EventData <byte, object> >("onSerialReceived" + InboundPackets.WheelControl);
            if (WheelChannel != null)
            {
                WheelChannel.Add(wheelCallback);
            }
            ThrottleChannel = GameEvents.FindEvent <EventData <byte, object> >("onSerialReceived" + InboundPackets.VesselThrottle);
            if (ThrottleChannel != null)
            {
                ThrottleChannel.Add(throttleCallback);
            }
            CustomAxisChannel = GameEvents.FindEvent <EventData <byte, object> >("onSerialReceived" + InboundPackets.VesselCustomAxis);
            if (CustomAxisChannel != null)
            {
                CustomAxisChannel.Add(customAxisCallback);
            }
            AutopilotChannel = GameEvents.FindEvent <EventData <byte, object> >("onSerialReceived" + InboundPackets.AutopilotMode);
            if (AutopilotChannel != null)
            {
                AutopilotChannel.Add(autopilotModeCallback);
            }

            SASInfoChannel = GameEvents.FindEvent <EventData <byte, object> >("toSerial" + OutboundPackets.SASInfo);
            KSPit.AddToDeviceHandler(SASInfoProvider);
            mySASInfo.currentSASMode      = 255; // value for not enabled
            mySASInfo.SASModeAvailability = 0;

            lastActiveVessel = FlightGlobals.ActiveVessel;
            FlightGlobals.ActiveVessel.OnPostAutopilotUpdate += AutopilotUpdater;
            GameEvents.onVesselChange.Add(OnVesselChange);
        }