Ejemplo n.º 1
0
 public void OnClicked(string menu)
 {
     if (currentTabs != null)
     {
         if (currentTabs == tabs[Array.IndexOf(strs, menu)])
         {
             return;
         }
         currentTabs.SetState(false);
     }
     currentTabs = tabs[Array.IndexOf(strs, menu)];
     currentTabs.SetState(true);
     AudioController.Play("tab");
     if (onTabChanged != null)
     {
         onTabChanged(menu);
     }
 }
Ejemplo n.º 2
0
    public void SetTabs(string[] strs)
    {
        this.strs   = strs;
        currentTabs = null;
        switch (strs.Length)
        {
        case 2:
            SetLocalPostion(tabs[0].transform, new Vector3(0.0f, 200.0f, 0.0f));
            SetLocalPostion(tabs[1].transform, new Vector3(0.0f, -200.0f, 0.0f));
            break;

        case 3:
            SetLocalPostion(tabs[0].transform, new Vector3(0.0f, 350.0f, 0.0f));
            tabs[1].transform.localPosition = Vector3.zero;
            SetLocalPostion(tabs[2].transform, new Vector3(0.0f, -350.0f, 0.0f));
            break;

        case 4:
            SetLocalPostion(tabs[0].transform, new Vector3(0.0f, 450.0f, 0.0f));
            SetLocalPostion(tabs[1].transform, new Vector3(0.0f, 150.0f, 0.0f));
            SetLocalPostion(tabs[2].transform, new Vector3(0.0f, -150.0f, 0.0f));
            SetLocalPostion(tabs[3].transform, new Vector3(0.0f, -450.0f, 0.0f));
            break;
        }
        for (int i = 0; i < tabs.Length; i++)
        {
            if (i < strs.Length)
            {
                if (!tabs[i].gameObject.activeSelf)
                {
                    NGUITools.SetActive(tabs[i].gameObject, true);
                }
                tabs[i].SetTabs(strs[i], this);
            }
            else
            {
                if (tabs[i].gameObject.activeSelf)
                {
                    NGUITools.SetActive(tabs[i].gameObject, false);
                }
            }
        }
    }