模仿中YUKI的紧急逃脱程序

Yuki的紧急逃脱程序

先吐槽下,为什么阿虚在时间扭曲的世界中,文艺部的计算机装的windows 95系统啊,还有这还原度也太高的说。
吐槽结束,下面进入重点。
YUKI的紧急逃脱程序,就是一个DOS界面,然后出现类似打字的效果,最后判断 按键输入 来执行 紧急逃脱程序的。

打字效果嘛~ 两年前,曾经用VB写了一个打字效果的安慰信给一个小女生,把小姑娘感动的泪流满面的说。唉唉~
现在不用VB了,而且VB似乎没有控制台模式的样子。

看完大萌神的紧急逃脱程序后,也想模仿这做一遍。正好手头上的C#能提供大部分的功能。 不过实现的方法,还是挺繁琐的啦

今天更新了一下,采用了for循环来输出一行字符串,比以前的不断输出,不断清屏有很大的效率提升,不过用for循环后,字符输入光标这些细节就无法表现出来了,这是还原的一大遗憾呢。看来要完美还原,果然还是要用土办法啊,不断输出,不断清屏。

下载地址 :

点我下载

啊啊~由于没有安装日文输入法,也搜索不到紧急程序的日文原文,就直接使用了SOSG字幕组的中文翻译了。

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading;

namespace ConsoleApplication3
{
class Program
{
static void output(string s,int ta=100,int tb=3000)
{
for(int i=0;i output(str);
str = "这个讯息会出现、n 就表示你、我、凉宫春日、朝比奈实玖留、n 古泉一树应该都在场。";
output(str);
str = "这是紧急逃脱程序。n 要启动的话就直接按Enter键、n 不启动就按其他键后再按Enter。n 启动之后、n 你会得到修正时空的机会。n 但不保证一定成功。n 也不保证你能顺利归来。";
output(str);
str = "这个程序只能启动一次。n 执行一次后就会被删除。n 若选择不执行、则会被直接删除。n Ready?";
output(str);
int key = Console.Read();
if (key == 'r')
{
int time = 0;
shutdown(time);
}
else
{
str = "正在自我卸载......";
output(str);
str = "卸载完毕!";
output(str);
return;
}
}
}
}

旧版的超级无效率的代码版本:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading;
using System.Diagnostics;
using System.Runtime.InteropServices;

namespace ConsoleApplication2
{
class Program
{
[DllImport("kernel32.dll", ExactSpelling = true)]

private static extern IntPtr GetConsoleWindow();
private static IntPtr ThisConsole = GetConsoleWindow();

[DllImport("user32.dll", CharSet = CharSet.Auto, SetLastError = true)]

private static extern bool ShowWindow(IntPtr hWnd, int nCmdShow);
private const int HIDE = 0;
private const int MAXIMIZE = 3;
private const int MINIMIZE = 6;
private const int RESTORE = 9;
static void shutdown()
{
System.Diagnostics.Process.Start("shutdown.exe", "-s -t 0");
}
static void Main(string[] args)
{
Console.SetWindowSize(Console.LargestWindowWidth, Console.LargestWindowHeight);
ShowWindow(ThisConsole, MAXIMIZE);
Console.Beep();
Console.WriteLine(":");
Thread.Sleep(500);
Console.Clear();
Console.WriteLine(":_");
Thread.Sleep(500);
Console.Clear();
Console.WriteLine(":");
Thread.Sleep(500);
Console.Clear();
Console.WriteLine(":_");
Thread.Sleep(500);
Console.Clear();
Console.WriteLine(":");
Thread.Sleep(500);
Console.Clear();
Console.WriteLine(":_");
Thread.Sleep(500);
Console.Clear();
Console.WriteLine(":D_");
Thread.Sleep(100);
Console.Clear();
Console.WriteLine(":Do_");
Thread.Sleep(100);
Console.Clear();
Console.WriteLine(":Do _");
/* 剩下一堆打字代码忽略...毫无营养的说 */
M: Console.WriteLine("Ready?");
Console.Beep();
string str = Console.ReadLine();
if (str == "y" || str == "Y") //判断输入的是否是 Y或是 y, 动画中是要判断是否输入的是 Enter键
{ //可以通过string str=Console.ReadKey()来读取Enter的Ascii码做判断
Console.WriteLine("Good Bye!");
shutdown(); //直接执行关机,哈哈~ 挺恶趣味的,紧急逃脱嘛~关机就好啦。
}
else if (str == "n" || str == "N")
{
return; //退出程序,不解释
}
else
{
Console.WriteLine("Bad Command!");
goto M; //返回循环
}
}
}
}

发表评论

电子邮件地址不会被公开。 必填项已用*标注