예제 #1
0
        private void OnScriptRuntimeInitialized(ScriptRuntime runtime)
        {
            var tsconfig = GetTSConfig();

            if (tsconfig != null)
            {
                runtime.AddSearchPath(tsconfig.compilerOptions.outDir);
            }

            runtime.EvalMain(_prefs.editorEntryPoint);

            foreach (var module in _prefs.editorRequires)
            {
                runtime.ResolveModule(module);
            }

            var editorScripts = new List <JSScriptClassPathHint>();

            JSScriptFinder.GetInstance().ModuleSourceChanged += OnModuleSourceChanged;
            JSScriptFinder.GetInstance().Search(JSScriptClassType.Editor, editorScripts);
            foreach (var editorScript in editorScripts)
            {
                runtime.ResolveModule(editorScript.modulePath);
            }
        }
예제 #2
0
 private void OnModuleSourceChanged(string modulePath, JSScriptClassType classTypes)
 {
     if ((classTypes & JSScriptClassType.Editor) != 0)
     {
         if (_runtime != null && _runtime.isValid && !EditorApplication.isCompiling)
         {
             _runtime.ResolveModule(modulePath);
         }
     }
 }