private void save_Game_CLick(Object sender, EventArgs e) { for (int i = 0; i < saveGameCount; i++) { if (saveGameList[i] == sender as Panel) { DialogResult dialogResult = MessageBox.Show("Möchten sie wirklich speichern?", "Möchten sie wirklich speichern?", MessageBoxButtons.YesNo); if (dialogResult == DialogResult.Yes) { Savegame new_savegame = new Savegame(); new_savegame.ID = i; //Player fürs speichern übernehmen string player_file = "savegame" + i + ".player_file"; copy_Files("player.csv", Savegame.filepath + player_file); new_savegame.Player_File = player_file; //Cities zum Speichern übernehmen string city_File = "savegame" + i + ".city_file"; copy_Files(savegame.City_file, Savegame.filepath + city_File); new_savegame.City_file = city_File; new_savegame.MapSeed = savegame.MapSeed; savegames[i] = new_savegame; savegame.save_data_in_csv("savegames.csv", savegames); } } } this.Close(); }
private void load_Game_CLick(Object sender, EventArgs e) { for (int i = 0; i < saveGameCount; i++) { if (saveGameList[i] == sender as Panel) { Savegame save = new Savegame(); Spieler spieler = new Spieler(); List <Savegame> savegame = new List <Savegame>(); Spieler player = new Spieler(); int mapSeed = new int(); savegame = save.get_saved_data("savegames.csv"); copy_Files(Savegame.filepath + savegame[i].City_file, "city.csv"); player = spieler.get_saved_Spieler(Savegame.filepath + savegame[i].Player_File)[0]; mapSeed = savegame[i].MapSeed; //MessageBox.Show(mapSeed + savegame[i].Player_File); //MessageBox.Show(player.Name); PlaygroundForm game = new PlaygroundForm(player, mapSeed); game.Show(); } } }
public Saving(Savegame _savegame) { InitializeComponent(); savegame = _savegame; savegames.AddRange(save.get_saved_data("savegames.csv")); setup_Savegame_Panels(); }
/* * Author: Christopher Wendholt */ private void savegameToolStripMenuItem_Click(object sender, EventArgs e) { Spieler spieler = new Spieler(); Character character = new Character(); spieler.save_data_in_csv("player.csv", player); Savegame savegame = new Savegame(0, player.Name, "city.csv", "follower.csv", mapForm.map.MapSeed); Saving saving = new Saving(savegame); saving.ShowDialog(); }