private void LoadGame() { Player player = null; bool loadGame = false; var saves = _saveService.GetSaveGames(); if (saves.Count > 0) { void SelectSave(int saveNumber) { loadGame = true; player = _saveService.LoadGameById(saveNumber); } var saveItems = new List <MenuItem>(); for (int i = 0; i < saves.Count; i++) { var save = saves[i]; var menuItem = new MenuItem( text: $"{save.Name}, a level {save.Level} focusing on {save.CombatStyle}.", menuActions: () => SelectSave(save.SaveNumber)); saveItems.Add(menuItem); } saveItems.Add(new MenuItem("Return to menu.", () => { })); var loadMenu = new Menu("loadGame", new Subtitle("Select a save file."), saveItems); loadMenu.GetPlayerAction(); } if (loadGame) { InitializeGame(player); } }