From 66fdbb76805591e70c8fb86fea3192089db76ab4 Mon Sep 17 00:00:00 2001 From: jasonchenwork Date: Mon, 14 Apr 2025 11:28:15 +0800 Subject: [PATCH] =?UTF-8?q?=E9=81=99=E6=8E=A7=E5=99=A8=E8=AA=BF=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CommandHandler.cs | 29 +++++++++++++++++++++++++---- 1 file changed, 25 insertions(+), 4 deletions(-) diff --git a/CommandHandler.cs b/CommandHandler.cs index e12020d..0b5f53d 100644 --- a/CommandHandler.cs +++ b/CommandHandler.cs @@ -38,6 +38,9 @@ namespace DualScreenDemo break; case "A263A4": ClearDisplay(); + _wrongInputCountfor62 = 0; // 重置計數器 + _wrongInputCountfor61 = 0; // 重置計數器 + _indataHistory.Clear(); // 清空歷史紀錄 break; case "A268A4": OverlayForm.MainForm.currentPage = 1; @@ -340,11 +343,13 @@ namespace DualScreenDemo _wrongInputCountfor61++; if(_wrongInputCountfor61 <= MaxWrongLimit) { - OverlayForm.MainForm.displayLabel.Text += "#"; + string old =""; + OverlayForm.MainForm.displayLabel.Text = check_control(old); } else { OverlayForm.MainForm.displayLabel.Text = "輸入錯誤!!!"; + _indataHistory.Clear(); // 清空歷史紀錄 _wrongInputCountfor61 = 0; // 重置計數器 } OverlayForm.MainForm.nextSongLabel.Visible = false; @@ -368,11 +373,13 @@ namespace DualScreenDemo _wrongInputCountfor61++; if(_wrongInputCountfor61 <= MaxWrongLimit) { - OverlayForm.MainForm.displayLabel.Text += "#"; + string old =""; + OverlayForm.MainForm.displayLabel.Text = check_control(old); } else { OverlayForm.MainForm.displayLabel.Text = "輸入錯誤!!!"; + _indataHistory.Clear(); // 清空歷史紀錄 _wrongInputCountfor61 = 0; // 重置計數器 } OverlayForm.MainForm.nextSongLabel.Visible = false; @@ -381,6 +388,16 @@ namespace DualScreenDemo } } } + private string check_control(string old){ + foreach(string item in _indataHistory) + { + if(item == "A261A4") + old += "#"; + else if(item == "A262A4") + old += "*"; + } + return old; + } private void HandleInputB() @@ -430,11 +447,13 @@ namespace DualScreenDemo _wrongInputCountfor62++; if(_wrongInputCountfor62 <= MaxWrongLimit) { - OverlayForm.MainForm.displayLabel.Text += "*"; + string old =""; + OverlayForm.MainForm.displayLabel.Text = check_control(old); } else { OverlayForm.MainForm.displayLabel.Text = "輸入錯誤!!!"; + _indataHistory.Clear(); // 清空歷史紀錄 _wrongInputCountfor62 = 0; // 重置計數器 } OverlayForm.MainForm.nextSongLabel.Visible = false; @@ -456,11 +475,13 @@ namespace DualScreenDemo _wrongInputCountfor62++; if(_wrongInputCountfor62 <= MaxWrongLimit) { - OverlayForm.MainForm.displayLabel.Text += "*"; + string old =""; + OverlayForm.MainForm.displayLabel.Text = check_control(old); } else { OverlayForm.MainForm.displayLabel.Text = "輸入錯誤!!!"; + _indataHistory.Clear(); // 清空歷史紀錄 _wrongInputCountfor62 = 0; // 重置計數器 } OverlayForm.MainForm.nextSongLabel.Visible = false;