/*private static GameObject AutoHookCore() * { * GameObject core = GameObject.Find("Lerp2Core"); * if (core == null) * core = new GameObject("Lerp2Core"); * return core; * EditorReflectionHelpers erh_EditorHook = new EditorReflectionHelpers(() => { * Type leh = Type.GetType("Lerp2Raw.LerpedEditorHook"); * if (core.GetComponent(leh) == null) * core.AddComponent(leh); * }); * erh_EditorHook.WaitUntilClassIsAvailable("LerpedEditorHook"); * EditorReflectionHelpers erh_Hook = new EditorReflectionHelpers(() => { * Type lh = Type.GetType("Lerp2Raw.LerpedHook"); * if (core.GetComponent(lh) == null) * core.AddComponent(lh); * }); * erh_Hook.WaitUntilClassIsAvailable("LerpedHook"); * }*/ private static void AddHook() { if (!LerpedShortcuts.keyActions.ContainsKey(hookShortcut)) { LerpedShortcuts.keyActions.Add(hookShortcut, new LerpedKeyAction(KeyCode.F5, () => { LerpedPaths lp = EditorWindow.GetWindow <LerpedPaths>(); //I have to improve both of this implementations lp.iInit(lp); })); } }
private static void HookWatchers() //I have to fix this because it deletes on reload in some editors... { //Detect new file and add them to the solution? (I have to) EditorApplication.update += OnEditorApplicationUpdate; if (!availablePaths) { Debug.LogError("There are one or more paths unsetted, go to Lerp2Dev Team Tools > Refresh Project API Dependencies... to set the paths of the Project in your HDD and the path of this project."); return; } string bPath = LerpedCore.GetString(buildPath); m_Watcher = new LerpedThread <FileSystemWatcher>(t_CompileWatcher, new FSWParams(Path.Combine(Path.GetDirectoryName(bPath), "Project"), "*.cs", NotifyFilters.LastWrite | NotifyFilters.Size, true)); m_Watcher.matchedMethods.Add(WatcherChangeTypes.Changed.ToString(), () => { LerpedPaths lp = EditorWindow.GetWindow <LerpedPaths>(); lp.iInit(lp, LerpedAPIChange.Auto); }); //m_Watcher.Created += new FileSystemEventHandler(); //I have to add files to the raw solution before compile //m_Watcher.Renamed += new FileSystemEventHandler(); //I have to rename files to the raw solution before compile //m_Watcher.Deleted += new FileSystemEventHandler(); //I have to remove files to the raw solution before compile m_Watcher.StartFSW(); }