private void SetNewState(bool disable, bool reset) { if (reset) { vesselDockingAid = vessel.GetComponent <VesselDockingAid>() as VesselDockingAid; autopilotState = vesselDockingAid.Setup(); SASstate = vessel.Autopilot.Enabled; } if (autopilotState && !disable) { parallelPlus.gameObject.SetActive(true); parallelNegative.gameObject.SetActive(true); switch (vesselDockingAid.targetMode) { case TargetMode.OFF: modebuttons[0].changeState(buttonActive); parallelPlus.SetState(false); parallelNegative.SetState(false); break; case TargetMode.PARALLEL_PLUS: modebuttons[0].changeState(buttonDisabled); parallelNegative.SetState(false); parallelPlus.SetState(true); break; case TargetMode.PARALLEL_NEGATIVE: modebuttons[0].changeState(buttonDisabled); parallelNegative.SetState(true); parallelPlus.SetState(false); break; } } else { parallelNegative.gameObject.SetActive(false); parallelPlus.gameObject.SetActive(false); } }
/// <summary> /// Exchanges UIStateToggleButton Button States /// </summary> /// <param name="button"></param> /// <param name="buttonState"></param> public static void changeState(this UIStateToggleButton button, ButtonState buttonState) { button.stateTrue = buttonState; button.SetState(UIStateToggleButton.BtnState.True); }