Beispiel #1
0
 // Use this for initialization
 void Start()
 {
     sRoot   = transform.Find("Items");
     current = null;
     Add(0);
     finger = -1;
 }
Beispiel #2
0
    public void Remove(int index)
    {
        int next = -1;

        if (index == current.gameObject.transform.GetSiblingIndex())
        {
            current = null;
            if (sRoot.childCount > 1)
            {
                if (index == 0)
                {
                    next = 0;
                }
                else
                {
                    next = index - 1;
                }
            }
        }

        GameObject.DestroyImmediate(sRoot.GetChild(index).gameObject);

        if (next != -1)
        {
            current = sRoot.GetChild(next).gameObject.GetComponent <SceneNumIcon>();
            current.Select();
        }
    }
Beispiel #3
0
 public void Add(int index)
 {
     if (current != null)
     {
         current.DeSelect();
     }
     current = Instantiate(IconPrefab, sRoot).GetComponent <SceneNumIcon>();
     current.gameObject.name = num + "";
     num++;
     current.gameObject.transform.SetSiblingIndex(index);
     current.Select();
 }
Beispiel #4
0
    public void Prev()
    {
        int next = current.gameObject.transform.GetSiblingIndex() - 1;

        if (next >= 0)
        {
            current.DeSelect();

            current = sRoot.GetChild(next).gameObject.GetComponent <SceneNumIcon>();
            current.Select();
        }
    }
Beispiel #5
0
    public void Next()
    {
        int next = current.gameObject.transform.GetSiblingIndex() + 1;

        if (next < sRoot.childCount)
        {
            current.DeSelect();

            current = sRoot.GetChild(next).gameObject.GetComponent <SceneNumIcon>();
            current.Select();
        }
    }
Beispiel #6
0
 public void Add(int index)
 {
     if (current != null)
     {
         current.DeSelect();
     }
     if (sRoot == null)
     {
         sRoot = transform.Find("Items");
     }
     current = Instantiate(IconPrefab).GetComponent <SceneNumIcon>();
     current.gameObject.name = num + "";
     num++;
     current.gameObject.transform.SetSiblingIndex(index);
     current.Select();
     current.gameObject.transform.parent        = sRoot;
     current.gameObject.transform.localScale    = Vector3.one;
     current.gameObject.transform.localPosition = Vector3.zero;
 }
Beispiel #7
0
 // Use this for initialization
 void Start()
 {
     current = null;
     sRoot   = transform.Find("Items");
     finger  = Observer.FINGER_NONE;
 }