ModelingDebug/MinLong/Zhangaiwu.cs
2025-01-04 18:21:29 +08:00

82 lines
2.4 KiB
C#

using System.Diagnostics;
using System.Runtime.CompilerServices;
namespace Debug.MinLong;
#pragma warning disable CS8981 // 该类型名称仅包含小写 ascii 字符。此类名称可能会成为该语言的保留值。
public class Zhangaiwu
{
private static int SleepTime = 100;
public static void Newshitou(Main.XiaoLong xiaoLong)
{
var y = Program.chars.GetLength(0);
var x = Program.chars.GetLength(1);
var shitou = new Shitou
{
x = x - 1,
y = y - 1
};
bool isjiafeng = false;//是否加分
for (int i = 1; i < x; i++)
{
if (Program.IsWhile == false)
{
break;
}
// System.Diagnostics.Debug.WriteLine("shitou");
// //测试 自动跳跃
// if (!xiaoLong.istiao && shitou.x == xiaoLong.x + Program.random.Next(1, 2))
// {
// new Thread(() => Main.tiaoyue(xiaoLong)).Start();
// }
if (shitou.x != xiaoLong.x || shitou.y != xiaoLong.y)
{
Program.chars[shitou.y, shitou.x].Char = '0';
if (shitou.x < xiaoLong.x && !isjiafeng)
{
isjiafeng = true;
xiaoLong.score++;
if (SleepTime > 20) SleepTime--;
}
}
else
{
SleepTime = 100;
Program.IsWhile = false;
shibai();
break;
}
Thread.Sleep(SleepTime);
Program.chars[shitou.y, shitou.x].Char = Program.ShowChar;
--shitou.x;
}
}
public static void shibai()
{
Console.WriteLine("任务失败!!!");
Console.WriteLine("按 任意键重新开始游戏/Esc结束");
// Program.KeyEnd((a) =>
// {
// if (a.Key == ConsoleKey.Enter)
// {
// Console.Clear();
// Program.IsWhile = true;
// _ = new MinLong.Main();
// }
// else if (a.Key == ConsoleKey.Escape)
// {
// //销毁程序
// Environment.Exit(0);
// }
// });
}
public class Shitou
{
public int x;
public int y;
public char Char = '0';
}
}