public static void UpdatePrefabDatabase() { if (EditorApplication.isPlaying || EditorApplication.isPlayingOrWillChangePlaymode || EditorApplication.isCompiling || EditorApplication.isPaused || EditorApplication.isUpdating) { Debug.LogError("Can't generate prefab database while the editor is playing, paused, updating assets or compiling"); return; } PrefabCompiler.CompilePrefabs(); AscensionCompiler.UpdatePrefabsDatabase(); }
void Footer() { GUILayout.BeginHorizontal(); //var version = Assembly.GetExecutingAssembly().GetName().Version; GUILayout.Label(string.Format("{0} ({1})", version, Core.IsDebugMode ? "DEBUG" : "RELEASE"), EditorStyles.miniLabel); GUILayout.FlexibleSpace(); PrefabDatabase db = PrefabDatabase.Instance; if (db.DatabaseMode == PrefabDatabaseMode.ManualScan) { if (DEditorGUI.IconButton("refresh")) { AscensionCompiler.UpdatePrefabsDatabase(); Debug.Log("Upading prefab database..."); } GUILayout.Space(8); } if (DEditorGUI.IconButton("code-emit")) { if (RuntimeSettings.Instance.compileAsDll) { AscensionDataAssemblyCompiler.Run(); } else { AscensionDataAssemblyCompiler.CodeEmit(); } Debug.Log("Compiling project... " + ProjectPath); } GUILayout.Space(8); if (DEditorGUI.IconButton("save-project")) { Save(); Debug.Log("Saving project... " + ProjectPath); } GUILayout.EndHorizontal(); }
public static ManualResetEvent CodeEmit() { ManualResetEvent evnt = new ManualResetEvent(false); try { // create path if it doesn't exist Directory.CreateDirectory(AscensionDataPath); // setup compiler options AscensionCompilerOperation op = new AscensionCompilerOperation(); op.projectFilePath = ProjectFile; op.project = File.Exists("Assets/__ASCENSION__/Networking/Resources/User/project.bytes") ? File.ReadAllBytes("Assets/__ASCENSION__/Networking/Resources/User/project.bytes").ToObject <Project>() : new Project(); // network config op.networkFilePath = NetworkFile; op.assemblyInfoFilePath = AssemblyInfoFile; // maps config op.scenesFilePath = MapsFile; op.prefabsFilePath = PrefabsFile; // run code emitter AscensionCompiler.Run(op, false); // we are done evnt.Set(); // continue EditorSaver.Invoke(() => { EmissionDone(op); }); } catch (Exception exn) { evnt.Set(); Debug.LogException(exn); } return(evnt); }
public static ManualResetEvent Run() { ManualResetEvent evnt = new ManualResetEvent(false); try { // calculate source dir SourceDir = EditorUtils.MakePath(Path.GetDirectoryName(AssetDir), "Temp", "Ascension"); // ensure temp path exists Directory.CreateDirectory(SourceDir); // setup compiler options AscensionCompilerOperation op = new AscensionCompilerOperation(); op.projectFilePath = ProjectFileTemp; op.project = File.Exists("Assets/__ASCENSION__/Networking/Resources/User/project.bytes") ? File.ReadAllBytes("Assets/__ASCENSION__/Networking/Resources/User/project.bytes").ToObject <Project>() : new Project(); // network config op.networkFilePath = NetworkFileTemp; op.assemblyInfoFilePath = AssemblyInfoFileTemp; // maps config op.scenesFilePath = MapsFileTemp; op.prefabsFilePath = PrefabsFileTemp; // run code emitter AscensionCompiler.Run(op); RunCSharpCompiler(op, evnt); } catch (Exception exn) { evnt.Set(); Debug.LogException(exn); } return(evnt); }