Exemplo n.º 1
0
        private IDisposable LoadAndRun(ReactScript script, bool disableWarnings = false)
        {
            dispatcher = Application.isPlaying ? RuntimeDispatcher.Create() as IDispatcher : new EditorDispatcher();
            runner = new ReactUnityRunner();
            var watcherDisposable = script.GetScript((code, isDevServer) =>
            {
                ctx = new UGUIContext(Root, Globals, script, dispatcher, new UnityScheduler(dispatcher), isDevServer, Render);
                runner.RunScript(code, ctx, BeforeStart, AfterStart);
            }, dispatcher, true, disableWarnings);

            return watcherDisposable;
        }
Exemplo n.º 2
0
        private IDisposable LoadAndRun(ReactScript script, List <TextAsset> preload, Action callback = null, bool disableWarnings = false)
        {
            dispatcher = Application.isPlaying ? RuntimeDispatcher.Create() as IDispatcher : new EditorDispatcher();
            runner     = new ReactUnityRunner();
            var watcherDisposable = script.GetScript((code, isDevServer) =>
            {
                ctx = new UGUIContext(Root, Globals, script, dispatcher, new UnityScheduler(dispatcher), isDevServer, Restart);
                runner.RunScript(code, ctx, preload, callback);
            }, dispatcher, true, disableWarnings);

            return(watcherDisposable);
        }