Skip to content

Commit

Permalink
Wait between questions
Browse files Browse the repository at this point in the history
  • Loading branch information
MetalMichael committed May 14, 2019
1 parent 30d8d53 commit 84f4fb2
Showing 1 changed file with 52 additions and 45 deletions.
97 changes: 52 additions & 45 deletions Blazor20Questions.Client/Pages/Game.razor
Original file line number Diff line number Diff line change
Expand Up @@ -29,56 +29,63 @@ else if (_game != null)
}
else
{
<div class="game">
<h2>Asked questions</h2>
<div class="questions">
@foreach (var question in _game.Questions)
{
<div class="question">
<span class="question-text">@question.Question</span>
<span class="question-answer">@(question.HasAnswer ? (question.Answer.Value) ? "Yes" : "No" : "(unanswered)")</span>
</div>
}
<div class="game">
<h2>Asked questions</h2>
<div class="questions">
@foreach (var question in _game.Questions)
{
<div class="question">
<span class="question-text">@question.Question</span>
<span class="question-answer">@(question.HasAnswer ? (question.Answer.Value) ? "Yes" : "No" : "(unanswered)")</span>
</div>
}
</div>

<div class="remaining">Remaining Questions: @_game.QuestionsRemaining</div>
<div class="remaining">Remaining Questions: @_game.QuestionsRemaining</div>

@if (_game.QuestionsRemaining > 0)
{
<h2>Ask a Question...</h2>
<form onsubmit="@AskQuestion">
<div class="simple-form">
<div class="form-group guess">
<label>Type a yes/no question below</label>
<input type="text" bind="@Question" class="form-control" id="first-name" placeholder="Is it a...?" />
<input type="submit" class="btn btn-primary" value="Ask" />
</div>
@if (_game.QuestionsRemaining > 0)
{
<h2>Ask a Question...</h2>
@if (!_game.AllowConcurrentQuestions && !_game.Questions.Last().HasAnswer)
{
<div class="waiting">Waiting for previous question to be answered</div>
}
else
{
<form onsubmit="@AskQuestion">
<div class="simple-form">
<div class="form-group guess">
<label>Type a yes/no question below</label>
<input type="text" bind="@Question" class="form-control" id="first-name" placeholder="Is it a...?" />
<input type="submit" class="btn btn-primary" value="Ask" />
</div>
</form>
}
</div>
</form>
}
}

@if (!_game.GuessesCountAsQuestions || _game.QuestionsRemaining > 0)
{
<h2>Make a guess</h2>
@if (_game.GuessesCountAsQuestions)
{
<span>Each guess counts as a question, so be sure not to waste an oppertunity!</span>
}
else
{
<span>Guesses are free, and do not count as questions. Guess away!</span>
}
<form onsubmit="@MakeGuess">
<div class="simple-form">
<div class="form-group guess">
<label>Guess the Subject</label>
<input type="text" bind="@Guess" class="form-control" id="first-name" placeholder="house" />
<input type="submit" class="btn btn-primary" value="Guess" />
</div>
</div>
</form>
}
</div>
@if (!_game.GuessesCountAsQuestions || _game.QuestionsRemaining > 0)
{
<h2>Make a guess</h2>
@if (_game.GuessesCountAsQuestions)
{
<span>Each guess counts as a question, so be sure not to waste an oppertunity!</span>
}
else
{
<span>Guesses are free, and do not count as questions. Guess away!</span>
}
<form onsubmit="@MakeGuess">
<div class="simple-form">
<div class="form-group guess">
<label>Guess the Subject</label>
<input type="text" bind="@Guess" class="form-control" id="first-name" placeholder="house" />
<input type="submit" class="btn btn-primary" value="Guess" />
</div>
</div>
</form>
}
</div>
}
}
else
Expand Down

0 comments on commit 84f4fb2

Please sign in to comment.