Пример #1
0
 /**
  * #Brief : Remove the last panel in the stack and destroy it
  */
 public void RemoveOne()
 {
     if (s_Panel.Count > 1)
     {
         Destroy(s_Panel.Pop());
         ResizePanel.Resize(ContentPanel, -250);
     }
 }
Пример #2
0
    /**
     * #Brief : Clone the GameObject src(panelEssai) and add it to the stack of panel
     * #args : GameObject src -> the GameObject to clone, we need to clone the panelEssai
     */
    public void Clone(GameObject src)
    {
        //  Clone the first panel and add the clone to the stack
        GameObject clone = Instantiate(src, src.transform.parent);

        s_Panel.Push(clone);
        clone.name += s_Panel.Count;
        clone.GetComponentsInChildren <Text>()[0].text   = "D" + (s_Panel.Count);
        clone.GetComponentInChildren <InputField>().text = "";


        Debug.Log("size = " + s_Panel.Count);

        //  Scroll to the down
        scrollRect.velocity = new Vector2(0f, 1000f);

        ResizePanel.Resize(ContentPanel, 250);
    }