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();