Exemple #1
0
        void LoadScripts()
        {
            cachedScripts           = new Dictionary <string, Jurassic.Library.GlobalObject>();
            currentlyLoadingScripts = new List <string>();
            engine = new ScriptEngine();

            LoadStandardFunctions(engine);

            try
            {
                engine.Execute(
                    File.ReadAllText(Path.Combine(Assets.basePath, "main.js"))
                    );
            } catch (Exception e)
            {
                Program.LoadingMessage(e.Message);
            }

            updateFunction = engine.GetGlobalValue <Jurassic.Library.FunctionInstance>("update");
        }
Exemple #2
0
        public void setInterval(Jurassic.Library.FunctionInstance callback, int ms)
        {
            float target = ms < 34 ? 0 : (float)ms / 1000; // make sure a timer with a target <= 33ms is fired each frame

            timers.Create(target, true, () => callback.Call(js.Global));
        }
Exemple #3
0
 // set/clear timeout/inveral
 public void setTimeout(Jurassic.Library.FunctionInstance callback, int ms)
 {
     timers.Create((float)ms / 1000, false, () => callback.Call(js.Global));
 }