public ListAbstract showList(string category, GameObject go = null) { ListAbstract list = null; if (category == "food") { list = go.gameObject.AddComponent <ListFood>(); } else if (category == "task") { list = go.gameObject.AddComponent <ListTaskCategories>(); } else if (category == "subCategories") { list = go.gameObject.AddComponent <ListSubCategories>(); } else if (category == "Images") { list = go.gameObject.AddComponent <ListImages>(); } else if (category == "Games") { list = go.gameObject.AddComponent <ListGames>(); } else { throw new ExitGUIException(); } return(list); }
void showList(TypeList typeList) { category = ""; switch ((int)typeList) { case (int)TypeList.Foods: category = "food"; break; case (int)TypeList.Tasks: category = "task"; break; case (int)TypeList.Games: category = "Games"; break; } factory = gameObject.AddComponent <ListFactory> (); list = (ListAbstract)factory.showList(category, gameObject); list.populate(); }