public void CloseBox() { if (m_currentBox) { m_currentBox.gameObject.SetActive(false); } m_currentBox = null; }
public void ShowBox <T> (Dictionary <string, object> varList = null) where T : UIBox { string name = typeof(T).ToString(); var panelTran = m_box.transform.Find(name); GameObject uiObject; if (panelTran == null) { string perfbName = "UI/Box/" + typeof(T).ToString(); GameObject perfb = AssetsManager.LoadPrefab <GameObject> (perfbName); uiObject = GameObject.Instantiate(perfb); uiObject.name = name; T t = uiObject.AddComponent <T> (); uiObject.transform.SetParent(m_box.transform); t.PanelInit(); } else { uiObject = panelTran.gameObject; } if (uiObject) { T box = uiObject.GetComponent <T> (); box.PanelOpen(); if (varList != null) { box.m_userData = varList; } if (m_currentBox) { m_currentBox.gameObject.SetActive(false); } uiObject.SetActive(true); m_currentBox = box; } }