public MapSelectScreen(bool h) { host = h; components = new List<MenuComponent>(); components.Add(new MenuButton(new Rectangle(Game1.x / 2 + 100, Game1.y / 2 - 100, 150, 40), "Load Map", ClickLoadMapStart)); components.Add(new MenuButton(new Rectangle(Game1.x / 2 + 100, Game1.y / 2 - 50, 150, 40), "New Map", ClickNewGameStart)); components.Add(new MenuButton(new Rectangle(Game1.x / 2 + 100, Game1.y / 2, 150, 40), "Quit", MenuManager.ClickTitle)); MenuList maplist = new MenuList(new Rectangle(Game1.x / 2 - 350, Game1.y / 2 - 250, 400, 500)); //maplist.AddNewButtonDefault(20, 200, "i am a map", delegate(Object o, EventArgs e) { ((MenuButton)o).selected = !((MenuButton)o).selected; }); //maplist.AddNewButtonDefault(20, 200, "i am also a map", delegate(Object o, EventArgs e) { ((MenuButton)o).selected = !((MenuButton)o).selected; }); string[] filepaths = Directory.GetFiles(@"Content/", "*.map", SearchOption.AllDirectories); foreach (String s in filepaths) { maplist.AddNewButtonDefault(20, 200, s, delegate(Object o, EventArgs e) { ((MenuButton)o).selected = !((MenuButton)o).selected; loadpath = ((MenuButton)o).text;}); } components.Add(maplist); }