From ec850cd1d69f33d13c14c254c22faadfa3730a4e Mon Sep 17 00:00:00 2001 From: muqing <1966944300@qq.com> Date: Sun, 12 Jan 2025 14:23:44 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E6=8C=89=E9=94=AE=E5=A4=84?= =?UTF-8?q?=E7=90=86=E9=80=BB=E8=BE=91=EF=BC=8C=E5=A2=9E=E5=8A=A0=E6=8C=89?= =?UTF-8?q?=E9=94=AE=E5=BE=97=E5=88=86=E5=8A=9F=E8=83=BD=E5=B9=B6=E6=B8=85?= =?UTF-8?q?=E7=90=86=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ModelingMusic/MusicFrom.cs | 22 +++++++++++++++++++++- Program.cs | 6 +++--- 2 files changed, 24 insertions(+), 4 deletions(-) diff --git a/ModelingMusic/MusicFrom.cs b/ModelingMusic/MusicFrom.cs index 1dd6991..d0945e0 100644 --- a/ModelingMusic/MusicFrom.cs +++ b/ModelingMusic/MusicFrom.cs @@ -221,7 +221,7 @@ public class MusicFrom { // 创建一个字典来跟踪每个按键的前一次状态 - var keyStates = new System.Collections.Generic.Dictionary + var keyStates = new Dictionary { { VK_D, false }, { VK_F, false }, @@ -306,10 +306,18 @@ public class MusicFrom case VK_F: isDown[1] = true; // 处理F键被按下的逻辑 + if (Program.chars[8, 10].Char == 'F' || Program.chars[9, 10].Char == 'F') + { + score += 100; + } break; case VK_G: isDown[2] = true; // 处理G键被按下的逻辑 + if (Program.chars[8, 17].Char == 'G' || Program.chars[9, 17].Char == 'G') + { + score += 100; + } break; case VK_SPACE: isDown[3] = true; @@ -318,14 +326,26 @@ public class MusicFrom case VK_J: isDown[4] = true; // 处理J键被按下的逻辑 + if (Program.chars[8, 31].Char == 'J' || Program.chars[9, 31].Char == 'J') + { + score += 100; + } break; case VK_K: isDown[5] = true; // 处理K键被按下的逻辑 + if (Program.chars[8, 38].Char == 'K' || Program.chars[9, 38].Char == 'K') + { + score += 100; + } break; case VK_L: isDown[6] = true; // 处理L键被按下的逻辑 + if (Program.chars[8, 45].Char == 'L' || Program.chars[9, 45].Char == 'L') + { + score += 100; + } break; default: break; diff --git a/Program.cs b/Program.cs index ac6c505..bad1c4b 100644 --- a/Program.cs +++ b/Program.cs @@ -1,8 +1,6 @@ - -using System.Text; +using System.Text; using Debug.ModelingMusic; namespace Debug; - /// /// 主程序入口 参考 https://blog.csdn.net/oscar999/article/details/141370223 /// 在VS Code的终端中,使用dotnet build命令来编译项目。这将在项目目录中生成一个bin文件夹,其中包含编译后的程序集。 @@ -10,6 +8,7 @@ namespace Debug; /// public class Program { + public static void printf(object a) { Console.Write(a); @@ -23,6 +22,7 @@ public class Program Console.Title = "Tools";//设置窗口标题 // 设置控制台输出编码,以支持复杂字符 Console.OutputEncoding = Encoding.UTF8; + // 切换到英语输入法 Console.Clear(); Console.CursorVisible = false; new MusicFrom();