Exemplo n.º 1
0
 public void RegisterToggle(ULToggle toggle)
 {
     if (!m_Toggles.Contains(toggle))
     {
         m_Toggles.Add(toggle);
     }
 }
Exemplo n.º 2
0
 public void UnregisterToggle(ULToggle toggle)
 {
     if (m_Toggles.Contains(toggle))
     {
         m_Toggles.Remove(toggle);
     }
 }
Exemplo n.º 3
0
 private void ValidateToggleIsInGroup(ULToggle toggle)
 {
     if (toggle == null || !m_Toggles.Contains(toggle))
     {
         throw new ArgumentException(string.Format("using UnityEngine; {0} is not part of ULToggleGroup {1}", new object[] { toggle, this }));
     }
 }
Exemplo n.º 4
0
    public void NotifyToggleOn(ULToggle 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;
        }
    }
Exemplo n.º 5
0
    public void tryClick(string uiName)
    {
        Transform child = findUi(uiName);
        if(child == null)
            return;

        // 先button
        Button btn = child.GetComponent<Button>();
        if (btn != null)
        {
            btn.onClick.Invoke();
            return;
        }

        // 再toggle
        ULToggle ulToggle = child.GetComponent<ULToggle>();
        if (ulToggle != null)
        {
            ulToggle.isOn = !ulToggle.isOn;
            return;
        }

        Toggle toggle = child.GetComponent<Toggle>();
        if (toggle != null)
        {
            toggle.isOn = !toggle.isOn;
            return;
        }

        // 再UIEventListener(先click再pointDown)
        UIEventListener listener = child.GetComponent<UIEventListener>();
        if (listener != null)
        {
            listener.OnPointerDown(new PointerEventData(EventSystem.current));
            StartCoroutine (LaterUp(listener));
            return;
        }

        Debug.LogWarning("ULGuideHelper: can't click any widget");
    }