private void onGameScenceSwitch(GameEvents.FromToAction <GameScenes, GameScenes> data) { Debug.Log($"[{DISPLAYNAME}] Destroy()"); parallelNegative.onClick.RemoveAllListeners(); parallelPlus.onClick.RemoveAllListeners(); foreach (UIStateToggleButton button in modebuttons) { button.onClick.RemoveListener(delegate { onSASbuttonPressed(button); }); } Destroy(parallelNegative.gameObject); Destroy(parallelPlus.gameObject); buttonInit = false; vesselDockingAid = null; autopilotState = false; }
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); } }