public void SelectIndexWithoutNotify(int index) { CUIToggle toggle = toggles[index]; if (toggle == null) { return; } OnChildToggled(toggles[index], false); }
public void SelectIndex(int index) { CUIToggle toggle = toggles[index]; if (toggle == null) { return; } OnChildToggled(toggles[index], true); }
public void OnChildToggled(CUIToggle toggle, bool notify = true, bool instant = false, bool force = false) { if (!allowDeselection && selectedToggles.Contains(toggle) && !force) { return; } //If we allow deselection, disable the toggle that was clicked on if (allowDeselection && toggle.isSelected) { toggle.Deselect(instant); return; } if (!allowMultiSelect) { //Deselect others: foreach (CUIToggle other in selectedToggles) { if (other == null) { continue; } if (!other.isSelected) { continue; } other.Deselect(instant); } selectedToggles.Clear(); } //Select the right one: toggle.Select(instant); selectedToggles.Add(toggle); if (notify) { onSelectedTogglesUpdated.Invoke(); } //selectedIndex = toggle.transform.GetSiblingIndex(); selectedIndex = toggles.IndexOf(toggle); if (notify) { onIndexSelected.Invoke(selectedIndex); } }