Skip to content
Snippets Groups Projects
Commit f090133f authored by Kaikosuo Paavo's avatar Kaikosuo Paavo
Browse files

aloita alusta toteutettu paremmin

parent 0faa0306
No related branches found
No related tags found
No related merge requests found
......@@ -650,19 +650,28 @@ namespace Peli
HighScoreWindow topIkkuna = new HighScoreWindow("Parhaat ajat",
"Onneksi olkoon, pääsit listalle ajalla %p! Syötä nimesi:", topList, aikaaKulunut);
topIkkuna.Closed += AloitaAlusta2;
topIkkuna.Closed += (_) =>
{
AloitaAlusta();
};
Add(topIkkuna);
}
else if (LapaistutCheckpointit == kulmac.Length && maalissa == false)
{
HighScoreWindow topIkkuna = new HighScoreWindow("Parhaat ajat", topList);
topIkkuna.Closed += AloitaAlusta2;
topIkkuna.Closed += (_) =>
{
AloitaAlusta();
};
Add(topIkkuna);
}
else if (maalissa && LapaistutCheckpointit != kulmac.Length)
{
HighScoreWindow topIkkuna = new HighScoreWindow("Koitahan ensi kerralla pysyä tiellä...", topList);
topIkkuna.Closed += AloitaAlusta2;
topIkkuna.Closed += (_) =>
{
AloitaAlusta();
};
Add(topIkkuna);
}
else if (alkuvalikosta)
......@@ -674,7 +683,10 @@ namespace Peli
else
{
HighScoreWindow topIkkuna = new HighScoreWindow("Parhaat ajat", topList);
topIkkuna.Closed += AloitaAlusta2;
topIkkuna.Closed += (_) =>
{
AloitaAlusta();
};
Add(topIkkuna);
}
......@@ -804,19 +816,6 @@ namespace Peli
}
/// <summary>
/// Trust me bro, näit pitää olla kaks.
/// </summary>
/// <param name="sender">Tärkeä asia</param>
private void AloitaAlusta2(Window sender)
{
DataStorage.Save(topList, "pisteet.xml");
maalissa = false;
ClearAll();
AloitaPeli();
}
/// <summary>
/// Auton savun aliohjelma. Luo ja lisää sen autoon.
/// </summary>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment