Exemple #1
0
 public Timer(TimerManager manager, float Interval, bool Continous, Action Trigger)
 {
     this.manager = manager;
     this.Interval = Interval;
     this.Trigger = Trigger;
     this.Continous = Continous;
 }
Exemple #2
0
        protected override void Initialize()
        {
            timers = new TimerManager();

            js = new Jurassic.ScriptEngine();
            js.SetGlobalFunction("setTimeout", new Action<Jurassic.Library.FunctionInstance, int>(setTimeout));
            js.SetGlobalFunction("setInterval", new Action<Jurassic.Library.FunctionInstance, int>(setInterval));
            js.SetGlobalFunction("clearTimeout", new Action<int>(clearTimeout));
            js.SetGlobalFunction("clearInterval", new Action<int>(clearInterval));

            js.SetGlobalValue("window", js.Global);
            js.SetGlobalValue("console", new JSConsole(js));
            js.SetGlobalValue("Canvas", new JSCanvasConstructor(js));
            js.SetGlobalValue("Image", new JSImageConstructor(js));

            #if !XBOX
            if (GenerateAndExit != null)
            {
                GenerateAssemblyAndExit(GenerateAndExit);
                return;
            }

            #endif

            #if XBOX || RELEASE
            // On the XBOX or RELEASE config, run the compiled JavaScript from the Assembly
            js.LoadFromAssembly("ImpactGame");
            Generated.Main(js, js.CreateGlobalScope(), js.Global);
            #else
            // In Windows/DEBUG, run JavaScript directly from source
            js.EnableDebugging = true;
            js.Evaluate(new Jurassic.FileScriptSource("Game/index.js"));
            #endif
            base.Initialize();
        }