public void RegisterToggle(ToggleDrag toggle)
 {
     if (!m_Toggles.Contains(toggle))
     {
         m_Toggles.Add(toggle);
     }
 }
 public void UnregisterToggle(ToggleDrag toggle)
 {
     if (m_Toggles.Contains(toggle))
     {
         m_Toggles.Remove(toggle);
     }
 }
 private void ValidateToggleIsInGroup(ToggleDrag toggle)
 {
     if (toggle == null || !m_Toggles.Contains(toggle))
     {
         throw new ArgumentException(string.Format("Toggle {0} is not part of ToggleGroup {1}", new object[] { toggle, this }));
     }
 }
    IEnumerator Wait(PointerEventData eventData, ToggleDrag toggleDrag)
    {
        yield return(new WaitForFixedUpdate());

        eventData.pointerDrag = toggleDrag.gameObject;
        toggleDrag.onDragEnd.Invoke(eventData);
        toggleDrag.isOn = false;
    }
    public void NotifyToggleOn(ToggleDrag toggle)
    {
        ValidateToggleIsInGroup(toggle);

        // disable all toggles in the group
        for (var i = 0; i < m_Toggles.Count; i++)
        {
            if (m_Toggles[i] == toggle)
            {
                continue;
            }

            m_Toggles[i].isOn = false;
        }
    }
Exemple #6
0
        protected static void CreateToggleDrag()
        {
            GameObject go = CreateGameObject("ToggleDrag", true);

            ToggleDrag drag = go.AddComponent <ToggleDrag>();
        }