private static void St2() { var hasLibCSharpFileMakeCompileSlow = false; foreach (var p in RoFile.Ls(EditorScript.Ro.EditorEnv.assetsPath)) { var isLibDir = RoFile.IsDir(p) && !RoFile.Basename(p) .IsMatch(@"^(Script|PostProcessing|Scripts|Editor|EditorScript|Draft|Test|Plugins|Standard Assets)$"); if (isLibDir) { foreach (var p2 in RoFile.FF(p)) { if (p2.IsMatch("\\.cs$")) { hasLibCSharpFileMakeCompileSlow = true; var rootDir = RoFile.Rel(p2, EditorEnv.assetsPath).Match("[^/]+").ToString(); Shell.NotifyWarn( $"In *Assets/{rootDir}*, it has lib c# file in Assets not *Assets/Standard Assets* to make compile slow, run *mad compile time optimizer* or maunally moving all lib c# files to *Assets/Standard Assets* to improve it"); break; } } } if (hasLibCSharpFileMakeCompileSlow) { break; } } }
private static void St2() { var shouldBeIgnoredInBuildScripts = new List <string>(); foreach (var path in RoFile.Ls(EditorEnv.assetsPath)) { if (RoFile.IsDir(path)) { if (RoFile.Basename(path).IsMatch("(Editor|Script|Standard Assets)")) { continue; } var fs = RoFile.FF(path); fs.Each((path2) => { if (path2.IsMatch("\\.cs$") && !RoFile.Read(path2).IsMatch("#if UNITY_EDITOR")) { shouldBeIgnoredInBuildScripts.Add(path2); } }); } } if (shouldBeIgnoredInBuildScripts.Count > 0) { throw new SystemException( "following code should be marked #if UNITY_EDITOR to only run in unity editor not unity build" + "\n" + shouldBeIgnoredInBuildScripts.Join("\n")); } }
private static void ChangeTitleWhenSceneOnRuntime() { if ((DateTime.Now - lastTime).TotalSeconds > 5) { pjName = RoFile.Basename(EditorUtil.GetProject()); sceneName = SceneManager.GetActiveScene().name; Thr(() => { lastTime = DateTime.Now; ChangeTitle(); }); } }
static bool St(int instanceId, int line) { var relPath = AssetDatabase.GetAssetPath(instanceId); var path = RoFile.Join(EditorEnv.pj, relPath); if (path.IsMatch("\\.(cs|shader)$")) { string arg; if (line >= 0) { arg = $"{path}:{line}"; } else { arg = $"{path}"; } var pjName = RoFile.Basename(EditorEnv.pj); Shell.Sys( $"xdotool search --onlyvisible --limit 1 \"{pjName}.*\\\\s-\\\\sJetBrains Rider\" windowactivate; rider \"{arg}\" &"); } return(false); }
private static string GetProjectName() { return(RoFile.Basename(EditorUtil.GetProject())); }