ControllerUIGroup GetButtonGroupByFaderOptions(FaderOptions _faderOptions) { foreach (ControllerUIGroup cbg in controllerUIs) { if (cbg.faderOptions == _faderOptions) { return(cbg); } } Debug.LogError("Didn't find a match for button group! Returning empty."); return(null); }
bool GetControllerEnabled(FaderOptions _faderOptions) { ControllerUIGroup group = GetButtonGroupByFaderOptions(_faderOptions); if (group.activationToggle.isOn) { return(true); } else { return(false); } }
public ControllerUIGroup(ControllerSettings _config, GameObject _faderOptionsPrefab, GameObject _optionsActivateButtonPrefab, GameObject _controlObject) { faderOptions = Instantiate(_faderOptionsPrefab).GetComponent <FaderOptions>(); faderOptions.gameObject.name = _config.name + " Options Panel"; faderOptions.controllerConfig = _config; controllerConfig = _config; faderMenuButton = Instantiate(_optionsActivateButtonPrefab).GetComponent <Button>(); faderMenuButton.gameObject.name = _config.name + " Options"; faderMenuButton.GetComponentInChildren <Text>().text = _config.name + " Options"; // change visible button title faderMenuButton.onClick.AddListener(DisplayFaderOptions); activationToggle = faderMenuButton.GetComponentInChildren <Toggle>(); activationToggle.onValueChanged.AddListener(ToggleControlVisibility); controlObject = _controlObject; controlObjectTransform = _controlObject.GetComponent <RectTransform>(); control = _controlObject.GetComponent <FaderControl>(); }