private void InitItem() { //hide all of the ui at first. we will show them by special state for (int i = 0; i < transform.childCount; ++i) { Transform child = transform.GetChild(i); //add exist UIs under to the UIManager UIWin ui = child.GetComponent <UIWin>(); if (ui != null) { try { //Main.Log("add ui:==+++++=" + ui.GetType()); WinID ID = (WinID)Enum.Parse(typeof(WinID), ui.GetType().ToString()); //Main.Log("add ui:====" + uiType); UIInstances[(int)ID] = ui; ui.ID = ID; child.gameObject.SetActive(false); } catch (System.Exception ex) { // Main.LogWarning("Unsupport UI" + child.name); } } } }
private void InitItem() { for (int i = 0; i < transform.childCount; ++i) { Transform child = transform.GetChild(i); UIWin ui = child.GetComponent <UIWin>(); if (ui != null) { try { WinID ID = (WinID)Enum.Parse(typeof(WinID), ui.GetType().ToString()); UIInstances[(int)ID] = ui; ui.ID = ID; child.gameObject.SetActive(false); } catch (System.Exception ex) { Logger.LogWarning("Unsupport UI" + child.name); } } } }