48 lines
1.1 KiB
C#
48 lines
1.1 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
using System.Threading;
|
|
using System.Timers;
|
|
|
|
namespace THCCD_Demo
|
|
{
|
|
class Program
|
|
{
|
|
static void Main(string[] args)
|
|
{
|
|
System.Timers.Timer mainTimer = new System.Timers.Timer();
|
|
Say sentence = new Say();
|
|
mainTimer.Interval = 1000.0 / 60.0;
|
|
|
|
|
|
//Timer.interval属性是一个double类型参数,可以是小数,理论可以用于THCCD的游戏时钟。
|
|
|
|
|
|
Console.WriteLine(mainTimer.Interval);
|
|
mainTimer.Elapsed += sentence.say;
|
|
mainTimer.Start();
|
|
Console.ReadLine();
|
|
}
|
|
}
|
|
class Say
|
|
{
|
|
private int count;
|
|
public Say()
|
|
{
|
|
this.count = 0;
|
|
}
|
|
internal void say(object sender, ElapsedEventArgs e)
|
|
{
|
|
this.count++;
|
|
if (count <= 60)
|
|
{
|
|
Console.WriteLine("Long live TouHou!");
|
|
Console.WriteLine(DateTime.UtcNow.ToString());
|
|
}
|
|
|
|
}
|
|
}
|
|
}
|