Example #1
0
    public GameObject SetPanel(ePanel name)
    {
        if (CurPanel != null)
            CurPanel.SetActive(false);

        if (PanelList.ContainsKey(name))
            CurPanel = PanelList[name];

        else
        {
            CurPanel = GameObject.Instantiate(Resources.Load("Prefabs/UI/" + name.ToString()) as GameObject) as GameObject;
            CurPanel.transform.SetParent(transform);
            CurPanel.transform.localScale = Vector3.one;
            PanelList.Add(name, CurPanel);
        }

        CurPanel.GetComponent<PanelBase>().PanelName = name;
        CurPanel.SetActive(true);

        return CurPanel;
    }