Added easy mode support
This commit is contained in:
parent
aa38f2a7b8
commit
b0d0c35cc7
2 changed files with 21 additions and 5 deletions
|
@ -16,6 +16,7 @@
|
|||
<PackageReference Include="MudBlazor" Version="6.5.0" />
|
||||
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
|
||||
<PackageReference Include="Toolbelt.Blazor.SpeechSynthesis" Version="10.0.0" />
|
||||
<PackageReference Include="UnidecodeSharpFork" Version="1.0.0" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
@page "/Learn"
|
||||
@using System.Text;
|
||||
@using CCharLearn.ExtensionMethods;
|
||||
@using UnidecodeSharpFork;
|
||||
|
||||
@inject NavigationManager navigator
|
||||
@inject Blazored.LocalStorage.ILocalStorageService localStorage
|
||||
|
@ -24,7 +25,7 @@
|
|||
}
|
||||
</style>
|
||||
|
||||
<MudContainer Class="justify-center d-flex ma-0" Style="height: 100%;">
|
||||
<MudContainer Class="justify-center d-flex ma-0 overflow-hidden" Style="height: 100%;">
|
||||
<MudStack Class="d-flex">
|
||||
@*True if debug, false for not debug. (TODO: Use an extensíonMethod: https://stackoverflow.com/questions/4696175/preprocessor-directives-in-razor)*@
|
||||
@if (true)
|
||||
|
@ -74,16 +75,23 @@
|
|||
</MudStack>
|
||||
</MudContainer>
|
||||
<MudContainer Class="pb-8 justify-center align-center d-flex">
|
||||
@if (!Answers.Any(x => x == null))
|
||||
{
|
||||
<MudButton Disabled="@(!(Answers.Any(x=>x.isSelected)))" OnClick="Submit" Class="px-8 py-3" Variant="Variant.Filled" Size="Size.Large" Color="Color.Success" Style="font-size: 20px;"> Submit</MudButton>
|
||||
}
|
||||
<MudStack Spacing="0">
|
||||
@if (!Answers.Any(x => x == null))
|
||||
{
|
||||
<MudButton Disabled="@(!(Answers.Any(x=>x.isSelected)))" OnClick="Submit" Class="px-8 py-3" Variant="Variant.Filled" Size="Size.Large" Color="Color.Success" Style="font-size: 20px;"> Submit</MudButton>
|
||||
}
|
||||
@if (isEasyMode)
|
||||
{
|
||||
<MudText Typo="Typo.caption">• Easy mode enabled</MudText>
|
||||
}
|
||||
</MudStack>
|
||||
</MudContainer>
|
||||
</MudStack>
|
||||
</MudContainer>
|
||||
|
||||
@code {
|
||||
bool isSavedLocally = false;
|
||||
bool isEasyMode = false;
|
||||
|
||||
bool selectedCorrect = false;
|
||||
|
||||
|
@ -121,6 +129,10 @@
|
|||
protected override async Task OnInitializedAsync()
|
||||
{
|
||||
Program.UpdateUiEvent += OnUiUpdate;
|
||||
if (await localStorage.ContainKeyAsync("EasyMode"))
|
||||
{
|
||||
isEasyMode = await localStorage.GetItemAsync<bool>("EasyMode");
|
||||
}
|
||||
|
||||
bool continueLast =
|
||||
await localStorage.ContainKeyAsync("ContinueLearning")
|
||||
|
@ -136,6 +148,9 @@
|
|||
await LoadCharectersFromChunk();
|
||||
}
|
||||
|
||||
if (isEasyMode)
|
||||
DontSkipTheseCChar.ForEach(x => x.cchar.pinyin = x.cchar.pinyin.Unidecode());
|
||||
|
||||
Program.CCharsLeft = DontSkipTheseCChar.Count;
|
||||
Program.InvokeUiUpdate();
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue