Пример #1
0
        public MoonSharpTE CreateParallelTimer(string name, int timeoutDelay, Dictionary <string, object> args)
        {
            MoonSharpTE timedEvent = new MoonSharpTE(name, (double)timeoutDelay);

            timedEvent.Args    = args;
            timedEvent.OnFire += new MoonSharpTE.TimedEventFireDelegate(OnTimerCB);
            ParallelTimers.Add(timedEvent);
            return(timedEvent);
        }
Пример #2
0
        public MoonSharpTE CreateTimer(string name, int timeoutDelay)
        {
            MoonSharpTE timedEvent = GetTimer(name);

            if (timedEvent == null)
            {
                timedEvent         = new MoonSharpTE(name, (double)timeoutDelay);
                timedEvent.OnFire += new MoonSharpTE.TimedEventFireDelegate(OnTimerCB);
                Timers.Add(name, timedEvent);
            }
            return(timedEvent);
        }
Пример #3
0
        public void KillTimer(string name)
        {
            MoonSharpTE timer = GetTimer(name);

            if (timer == null)
            {
                return;
            }

            timer.Kill();
            Timers.Remove(name);
        }
Пример #4
0
 public void OnTimerCB(MoonSharpTE evt)
 {
     if (Globals.Contains(evt.Name + "Callback"))
     {
         try
         {
             this.Invoke(evt.Name + "Callback", evt);
         }
         catch (Exception ex)
         {
             Fougerite.Logger.LogError("Failed to invoke callback " + evt.Name + " Ex: " + ex);
         }
     }
 }