示例#1
0
    void newPanel(zDraggable panel)
    {
        if (dragList == null)
        {
            dragList = new List <zDraggable>();
        }
        if (dragList.Contains(panel))
        {
            return;
        }
        dragList.Add(panel);
        Toggle t = Instantiate(templateObject, templateObject.transform.parent);

        toggleList.Add(t);
        t.gameObject.SetActive(true);
        t.name = panel.name;
        t.onValueChanged.AddListener((x) => panel.gameObject.SetActive(x));


        Text text = t.GetComponentInChildren <Text>();

        if (text != null)
        {
            text.text = panel.name;
        }
    }
 void Awake()
 {
     rect      = GetComponent <RectTransform>();
     draggable = GetComponentInParent <zDraggable>();
     // showMenu();
     // hideMenu();
 }
示例#3
0
 protected override void OnValidate()
 {
     if (draggable == null)
     {
         draggable = GetComponentInParent <zDraggable>();
     }
     base.OnValidate();
     if (draggable != null)
     {
         targetRect = draggable.GetComponent <RectTransform>();
     }
     if (GetComponent <zDragBorder>() == null)
     {
         gameObject.AddComponent <zDragBorder>();
     }
 }
示例#4
0
    void setName()
    {
        zDraggable zdr = GetComponentInParent <zDraggable>();

        if (text == null)
        {
            text = GetComponent <Text>();
        }
        if (zdr != null && text != null)
        {
            text.text = zdr.gameObject.name;
        }
        else
        if (text != null)
        {
            text.text = "_";
        }
    }