Ejemplo n.º 1
0
 //添加子物体到集合
 private void AddChild(ItemPanelBase parentItemPanelBase)
 {
     childList.Add(parentItemPanelBase);
     if (childList.Count >= 1)
     {
         downArrow.GetComponent <Image>().sprite = right;
     }
 }
Ejemplo n.º 2
0
 /// <summary>
 /// 设置父物体,父物体不为一级菜单
 /// </summary>
 /// <param name="parentItemPanelBase"></param>
 public void SetItemParent(ItemPanelBase parentItemPanelBase)
 {
     this.transform.parent = parentItemPanelBase.transform;
     parentItemPanelBase.AddChild(this);
     this.GetComponent <VerticalLayoutGroup>().padding = new RectOffset((int)parentItemPanelBase.downArrow.GetComponent <RectTransform>().sizeDelta.x, 0, 0, 0);
     if (parentItemPanelBase.isOpen)
     {
         this.GetComponent <ItemPanelBase>().AddParentSize((int)this.gameObject.GetComponent <RectTransform>().sizeDelta.y);
     }
     else
     {
         this.transform.gameObject.SetActive(false);
     }
 }