// handles UI elements for mode switching : shell togglemode public void switchModes() { // use a string we need anyway to track the mode bool fov = _text != fv; //attention, NOT equals here because we are switching text.text = fov ? fv : ls; _text = text.text; toggleMode(fov? "fov" : "laserscan"); //button.SetActive(fov ? true : false); CountText.SetActive(fov ? true : false); Cams.SetActive(fov ? true : false); SpreadSlider.SetActive(!fov ? true : false); CountSlider.SetActive(!fov ? true : false); //LinePanel.SetActive(!fov ? true : false); flipButton.SetActive(!fov ? true : false); obsButton.SetActive(!fov ? true : false); tutorialButton.SetActive(!fov ? true : false); LaserLinesToggle.SetActive(!fov ? true : false); // turn graph on in laserscan mode, off in fov mode if (fov && LinePanel.activeSelf || !fov && !LinePanel.activeSelf) { toggleGraph(); } }
// the function which en/disables the whole UI, uses _text to test mode so as not to turn on the wrong buttons public void toggleUI() { uiActive = !uiActive; // use a string we need anyway to track the mode bool fov = _text == fv; //attention, equals here because we are returning modeText.SetActive(uiActive); modeButton.SetActive(uiActive); FoVButton.SetActive(uiActive); CountText.SetActive(fov && uiActive ? true : false); Cams.SetActive(fov && uiActive ? true : false); SpreadSlider.SetActive(!fov && uiActive ? true : false); CountSlider.SetActive(!fov && uiActive ? true : false); flipButton.SetActive(!fov && uiActive ? true : false); obsButton.SetActive(!fov && uiActive ? true : false); tutorialButton.SetActive(!fov && uiActive ? true : false); LaserLinesToggle.SetActive(!fov && uiActive ? true : false); //LinePanel.SetActive(!fov && uiActive ? true : false); }