From b0d0c35cc7c9b638d9cb546f319c39e63d96cc38 Mon Sep 17 00:00:00 2001 From: BOT Alex <44818698+MagicBOTAlex@users.noreply.github.com> Date: Fri, 14 Jul 2023 11:03:47 +0800 Subject: [PATCH] Added easy mode support --- CCharLearn/CCharLearn.csproj | 1 + CCharLearn/Pages/Learn.razor | 25 ++++++++++++++++++++----- 2 files changed, 21 insertions(+), 5 deletions(-) diff --git a/CCharLearn/CCharLearn.csproj b/CCharLearn/CCharLearn.csproj index 51b2277..d86e022 100644 --- a/CCharLearn/CCharLearn.csproj +++ b/CCharLearn/CCharLearn.csproj @@ -16,6 +16,7 @@ + diff --git a/CCharLearn/Pages/Learn.razor b/CCharLearn/Pages/Learn.razor index dd00ad2..628ac5e 100644 --- a/CCharLearn/Pages/Learn.razor +++ b/CCharLearn/Pages/Learn.razor @@ -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 @@ } - + @*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 @@ - @if (!Answers.Any(x => x == null)) - { - Submit - } + + @if (!Answers.Any(x => x == null)) + { + Submit + } + @if (isEasyMode) + { + • Easy mode enabled + } + @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("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();