static void OnPostprocessAllAssets(string[] importedAssets, string[] deletedAssets, string[] movedAssets, string[] movedFromAssetPaths)
		{
			if (_instance == null)
				return;

			foreach (string imported in importedAssets)
			{
				if (imported.EndsWith(".js", StringComparison.OrdinalIgnoreCase) ||
					imported.EndsWith(".cs", StringComparison.OrdinalIgnoreCase) ||
					imported.EndsWith(".boo", StringComparison.OrdinalIgnoreCase))
				{
					if (!Array.Exists(movedAssets, (string path) => imported == path))
					{
						Instance().OnAssetReimported(imported);
					}

					reloadingAssemblies = true;
				}
				else
				{
					Instance().OnAssetReimported(imported);
				}
			}

			//foreach (string str in deletedAssets)
			//    Debug.Log("== Deleted Asset: " + str);

			for (int i = 0; i < movedAssets.Length; ++i)
			{
				if (movedAssets[i].EndsWith(".js", StringComparison.OrdinalIgnoreCase) ||
					movedAssets[i].EndsWith(".cs", StringComparison.OrdinalIgnoreCase) ||
					movedAssets[i].EndsWith(".boo", StringComparison.OrdinalIgnoreCase))
				{
					Instance().OnAssetMoved(movedAssets[i]);
				}
			}
			
			if (reloadingAssemblies)
			{
				EditorApplication.update -= CompileErrorsCheck;
				EditorApplication.update += CompileErrorsCheck;
				
				if (SISettings.autoFocusConsole == 2)
				{
					var focusedWindow = EditorWindow.focusedWindow;
					var siConsole = FGConsole.FindInstance();
					if (siConsole)
					{
						siConsole.Focus();
						if (focusedWindow)
							focusedWindow.Focus();
					}
				}
			}
			
			EditorApplication.update -= RepaintConsoleAfterUpdate;
			EditorApplication.update += RepaintConsoleAfterUpdate;
		}
Ejemplo n.º 2
0
        internal static FindResultsWindow Create(
            string description,
            System.Action <System.Action <string, string, TextPosition, int>, string, SearchOptions> searchFunction,
            string[] assetGuids,
            SearchOptions searchOptions,
            bool inNewWindow)
        {
            var previousResults = (FindResultsWindow[])Resources.FindObjectsOfTypeAll(typeof(FindResultsWindow));
            var reuseWnd        = inNewWindow ? null : previousResults.FirstOrDefault(w => !w.KeepResults && w.replaceText == null);
            var wnd             = reuseWnd ?? CreateInstance <FindResultsWindow>();

            wnd.infoText       = description;
            wnd.searchFunction = searchFunction;
            wnd.assetGuids     = assetGuids;
            wnd.search         = searchOptions;
            wnd.groupByFile    = SISettings.groupFindResultsByFile;

            if (!reuseWnd)
            {
                var docked = false;
                foreach (var prevWnd in previousResults)
                {
                    if (prevWnd != wnd && prevWnd)
                    {
                        docked = FGCodeWindow.DockNextTo(wnd, prevWnd);
                        if (docked)
                        {
                            break;
                        }
                    }
                }
                if (!docked)
                {
                    var console = FGConsole.FindInstance() ?? (Resources.FindObjectsOfTypeAll(FGConsole.consoleWindowType).FirstOrDefault() as EditorWindow);
                    if (console)
                    {
                        docked = FGCodeWindow.DockNextTo(wnd, console);
                    }
                }
            }

            wnd.ClearResults();

            wnd.Show();
            wnd.Focus();

            return(wnd);
        }
	private static void CompileErrorsCheck()
	{
		if (EditorApplication.isCompiling)
			return;

		EditorApplication.update -= CompileErrorsCheck;
		reloadingAssemblies = false;
		//EditorUtility.DisplayDialog("Script Inspector", "Compile errors!", "OK");
		FGTextEditor.RepaintAllInstances();
		FGConsole.repaintOnUpdateCounter = 1;
		
		if (SISettings.autoFocusConsole != 0)
		{
			FGConsole.ShowConsole();
			var siConsole = FGConsole.FindInstance();
			if (siConsole)
				siConsole.SendEvent(Event.KeyboardEvent("%end"));
		}
	}
Ejemplo n.º 4
0
        public static void OpenIfConsoleIsOpen()
        {
            EditorWindow console = FindInstance();

            if (console != null)
            {
                return;
            }

            UnityEngine.Object[] objArray = Resources.FindObjectsOfTypeAll(consoleWindowType);
            console = (objArray.Length <= 0) ? null : (objArray[0] as EditorWindow);
            if (console != null)
            {
                EditorWindow wnd = EditorWindow.focusedWindow;
                FGConsole.ShowConsole();
                if (wnd != null)
                {
                    wnd.Focus();
                }
            }
        }