41 lines
1.1 KiB
C#
41 lines
1.1 KiB
C#
using System.Collections.Generic;
|
|
using UnityEditor;
|
|
|
|
public class ChangedConfigsProcessor : AssetPostprocessor
|
|
{
|
|
private static void OnPostprocessAllAssets(
|
|
string[] imported,
|
|
string[] deleted,
|
|
string[] moved,
|
|
string[] moved_from_paths
|
|
)
|
|
{
|
|
var accum = new List<string>();
|
|
FilterConfigFiles(imported, accum);
|
|
FilterConfigFiles(deleted, accum);
|
|
FilterConfigFiles(moved, accum);
|
|
FilterConfigFiles(moved_from_paths, accum);
|
|
|
|
if (accum.Count == 0)
|
|
return;
|
|
|
|
//TODO: animate it properly someday
|
|
EditorUtility.DisplayProgressBar("Building configs", "In progress...", 0.3f);
|
|
|
|
try
|
|
{
|
|
BuildUtils.Urun();
|
|
}
|
|
finally
|
|
{
|
|
EditorUtility.ClearProgressBar();
|
|
}
|
|
}
|
|
|
|
private static void FilterConfigFiles(IEnumerable<string> paths, ICollection<string> accum)
|
|
{
|
|
foreach (string path in paths)
|
|
if (path.EndsWith(".conf.js") || path.EndsWith(".bhl"))
|
|
accum.Add(path);
|
|
}
|
|
} |