| 1 |
figdor32 |
2 |
using System; |
| 2 |
|
|
using System.Collections.Generic; |
| 3 |
|
|
using System.Linq; |
| 4 |
|
|
using System.Text; |
| 5 |
|
|
using System.Threading.Tasks; |
| 6 |
|
|
|
| 7 |
|
|
namespace TELTest.Gamemodes { |
| 8 |
|
|
public class Classic : QuizGamemode { |
| 9 |
|
|
public Classic() { |
| 10 |
|
|
} |
| 11 |
|
|
public Classic(QuizContainer container, BaseQuizContext context) : base(container, context) { |
| 12 |
|
|
} |
| 13 |
|
|
|
| 14 |
|
|
public override String Name => "Klasyczny"; |
| 15 |
|
|
|
| 16 |
|
|
public override String SystemName => "Classic"; |
| 17 |
|
|
|
| 18 |
|
|
public override String Description => "Klasyczny quizhouse_poor."; |
| 19 |
|
|
|
| 20 |
|
|
public override QuizGamemode CreateInstance(QuizContainer quiz, BaseQuizContext context) => new Classic(quiz, context); |
| 21 |
|
|
public override async Task Begin() { |
| 22 |
|
|
int score = 0; |
| 23 |
|
|
await WriteLine("Tytul quizu: " + Quiz.Title); |
| 24 |
|
|
await WriteLine("Autor quizu: " + Quiz.Author); |
| 25 |
|
|
await WriteLine(); |
| 26 |
|
|
for (int i = 0; i < Quiz.Questions.Length; i++) { |
| 27 |
|
|
await WriteLine((i + 1) + ". " + Quiz.Questions[i].Content); |
| 28 |
|
|
string correct = ""; |
| 29 |
|
|
for (int j = 0; j < Quiz.Questions[i].Answers.Length; j++) { |
| 30 |
|
|
var itm = Quiz.Questions[i].Answers[j]; |
| 31 |
|
|
await WriteLine("{0}. {1}", Utilities.NumberToLetter(j).ToLower(), itm.Content); |
| 32 |
|
|
if (itm.Correct) correct += Utilities.NumberToLetter(j).ToUpper()[0]; |
| 33 |
|
|
} |
| 34 |
|
|
await Write("Twoja odpowiedz: "); |
| 35 |
|
|
char ans = await ReadUppercaseKey(); |
| 36 |
|
|
await Flush(); |
| 37 |
|
|
await WriteLine(); |
| 38 |
|
|
if (correct.Contains(ans)) { |
| 39 |
|
|
await WriteLine("Dobrze! Zdobywasz punkt."); |
| 40 |
|
|
score++; |
| 41 |
|
|
} else { |
| 42 |
|
|
await WriteLine("Zle! Poprawna odpowiedz to: {0}", correct); |
| 43 |
|
|
} |
| 44 |
|
|
await Write("\r\n\r\n"); |
| 45 |
|
|
} |
| 46 |
|
|
await WriteLine("Twoj wynik: {0}/{1}", score, Quiz.Questions.Length); |
| 47 |
|
|
await Pause(); |
| 48 |
|
|
|
| 49 |
|
|
await DoScoreSubmission(score); |
| 50 |
|
|
} |
| 51 |
|
|
|
| 52 |
|
|
} |
| 53 |
|
|
} |