public static void Call(delEmpty func, string key) { if (!keys.Contains(key)) { callbacks.Add(func); cblastframe.Add(ulong.MinValue); needcb.Add(false); keys.Add(key); } int i = keys.IndexOf(key); if (cblastframe[i] < MyTimer.CurrentFrame) { cblastframe[i] = MyTimer.CurrentFrame; needcb[i] = false; func(); } else { //We need a callback next frame if (!going) { SingleFireTimer.SetTimer(new SingleFireTimer.delEmpty(docallback), 1); } needcb[i] = true; } }
public static void SetTimer(delEmpty callback, int time) { MyTimer ttt = new MyTimer(); t.Add(ttt); callbacks.Add(callback); callframes.Add(MyTimer.CurrentFrame); ttt.Interval = time; ttt.Tick += new EventHandler(ttt_Tick); ttt.Start(); }