Example #1
0
        /// <inheritdoc/>
        public void UpdateContextMenu()
        {
            Fields["lockStatus"].guiActive          = isLinked;
            Fields["steeringStatus"].guiActive      = isLinked;
            Fields["steeringInvert"].guiActive      = isLinked && persistedActiveSteeringEnabled;
            Fields["steeringSensitivity"].guiActive = isLinked && persistedActiveSteeringEnabled;

            PartModuleUtils.SetupEvent(
                this, StartLockLockingAction,
                e => e.active = isLinked && persistedLockingMode == LockMode.Disabled);
            PartModuleUtils.SetupEvent(
                this, UnlockAction,
                e => e.active = isLinked && persistedLockingMode != LockMode.Disabled);
            PartModuleUtils.SetupEvent(
                this, DeactivateSteeringAction,
                e => e.active = isLinked && persistedActiveSteeringEnabled);
            PartModuleUtils.SetupEvent(
                this, ActiveSteeringAction,
                e => e.active = isLinked && !persistedActiveSteeringEnabled);

            lockStatus     = LockStatusMsgLookup.Lookup(persistedLockingMode);
            steeringStatus = SteeringStatusMsgLookup.Lookup(
                persistedActiveSteeringEnabled ? SteeringStatus.Active : SteeringStatus.Disabled);
        }
Example #2
0
        /// <inheritdoc/>
        public override void UpdateContextMenu()
        {
            base.UpdateContextMenu();

            connectorStateMenuInfo = ConnectorStatesMsgLookup.Lookup(connectorState);
            PartModuleUtils.SetupEvent(this, ToggleVesselsDockModeEvent, e => {
                e.active &= !isConnectorLocked;
            });
            PartModuleUtils.SetupEvent(this, GrabConnectorEvent, e => {
                e.active = connectorState == ConnectorState.Locked;
                GrabConnectorEventInject.guiName = e.guiName;
            });
            PartModuleUtils.SetupEvent(this, ReturnConnectorEvent, e => {
                e.active = IsActiveEvaHoldingConnector();
            });
            PartModuleUtils.SetupEvent(this, DetachConnectorEvent, e => {
                e.active = isLinked;
            });
            PartModuleUtils.SetupEvent(this, InstantLockConnectorEvent, e => {
                e.active = connectorState == ConnectorState.Deployed;
            });
            GrabConnectorEventInject.active = linkTarget != null &&
                                              FlightGlobals.ActiveVessel != linkTarget.part.vessel;
        }