private static AssetMoveResult OnWillMoveAsset(string fromPath, string toPath, string[] newPaths, string[] NewMetaPaths) { AssetMoveResult assetMoveResult = AssetMoveResult.DidNotMove; if (!InternalEditorUtility.HasTeamLicense()) { return(assetMoveResult); } assetMoveResult = AssetModificationHook.OnWillMoveAsset(fromPath, toPath); foreach (Type current in AssetModificationProcessorInternal.AssetModificationProcessors) { MethodInfo method = current.GetMethod("OnWillMoveAsset", BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic); if (method != null) { AssetModificationProcessorInternal.RequireTeamLicense(); object[] array = new object[] { fromPath, toPath }; if (AssetModificationProcessorInternal.CheckArgumentsAndReturnType(array, method, assetMoveResult.GetType())) { assetMoveResult |= (AssetMoveResult)((int)method.Invoke(null, array)); } } } return(assetMoveResult); }
static AssetMoveResult OnWillMoveAsset(string fromPath, string toPath, string[] newPaths, string[] NewMetaPaths) { AssetMoveResult finalResult = AssetMoveResult.DidNotMove; if (!InternalEditorUtility.HasTeamLicense()) { return(finalResult); } finalResult = AssetModificationHook.OnWillMoveAsset(fromPath, toPath); foreach (var assetModificationProcessorClass in AssetModificationProcessors) { MethodInfo method = assetModificationProcessorClass.GetMethod("OnWillMoveAsset", BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Static); if (method != null) { RequireTeamLicense(); object[] args = { fromPath, toPath }; if (!CheckArgumentsAndReturnType(args, method, finalResult.GetType())) { continue; } finalResult |= (AssetMoveResult)method.Invoke(null, args); } } return(finalResult); }
private static AssetMoveResult OnWillMoveAsset(string fromPath, string toPath, string[] newPaths, string[] NewMetaPaths) { AssetMoveResult didNotMove = AssetMoveResult.DidNotMove; if (InternalEditorUtility.HasTeamLicense()) { didNotMove = AssetModificationHook.OnWillMoveAsset(fromPath, toPath); IEnumerator <Type> enumerator = AssetModificationProcessors.GetEnumerator(); try { while (enumerator.MoveNext()) { MethodInfo method = enumerator.Current.GetMethod("OnWillMoveAsset", BindingFlags.NonPublic | BindingFlags.Public | BindingFlags.Static); if (method != null) { RequireTeamLicense(); object[] args = new object[] { fromPath, toPath }; if (CheckArgumentsAndReturnType(args, method, didNotMove.GetType())) { didNotMove |= (int)method.Invoke(null, args); } } } } finally { if (enumerator == null) { } enumerator.Dispose(); } } return(didNotMove); }
static AssetMoveResult OnWillMoveAsset(string fromPath, string toPath, string[] newPaths, string[] NewMetaPaths) { AssetMoveResult finalResult = AssetMoveResult.DidNotMove; finalResult = AssetModificationHook.OnWillMoveAsset(fromPath, toPath); foreach (var assetModificationProcessorClass in AssetModificationProcessors) { const string methodName = "OnWillMoveAsset"; MethodInfo method = assetModificationProcessorClass.GetMethod(methodName, BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Static); if (method != null) { object[] args = { fromPath, toPath }; if (!CheckArgumentsAndReturnType(args, method, finalResult.GetType())) { continue; } using (new EditorPerformanceMarker($"{assetModificationProcessorClass.Name}.{methodName}", assetModificationProcessorClass).Auto()) finalResult |= (AssetMoveResult)method.Invoke(null, args); } } return(finalResult); }
private static AssetMoveResult OnWillMoveAsset(string fromPath, string toPath, string[] newPaths, string[] NewMetaPaths) { AssetMoveResult assetMoveResult1 = AssetMoveResult.DidNotMove; if (!InternalEditorUtility.HasTeamLicense()) { return(assetMoveResult1); } AssetMoveResult assetMoveResult2 = AssetModificationHook.OnWillMoveAsset(fromPath, toPath); foreach (System.Type modificationProcessor in AssetModificationProcessorInternal.AssetModificationProcessors) { MethodInfo method = modificationProcessor.GetMethod("OnWillMoveAsset", BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic); if (method != null) { AssetModificationProcessorInternal.RequireTeamLicense(); object[] objArray = new object[2] { (object)fromPath, (object)toPath }; if (AssetModificationProcessorInternal.CheckArgumentsAndReturnType(objArray, method, assetMoveResult2.GetType())) { assetMoveResult2 |= (AssetMoveResult)method.Invoke((object)null, objArray); } } } return(assetMoveResult2); }
private static void OnMoveAssetCallBack(AssetMoveResult t, string t1, string t2) { List <string> paths = new List <string>(); paths.Add(t1); paths.Add(t2); UpdateAsset(paths); //Debug.Log("OnMoveAssetCallBack"); }
public static AssetMoveResult OnWillMoveAsset(string oldPath, string newPath) { AssetMoveResult result = AssetMoveResult.DidNotMove; if (!oldPath.Contains("/Resources/") && !oldPath.Contains(ResConfig.ExternalResDir)) { result = AssetMoveResult.DidNotMove; return(result); } AssetMode.Rebuild(); var isSaveRes = CheckIsResPath(oldPath); var isFolder = Directory.Exists(oldPath); if (isSaveRes) { if (!newPath.Contains("/Resources/") && !newPath.Contains(ResConfig.ExternalResDir)) { result = AssetMoveResult.FailedMove; } if (!isFolder && newPath.Contains(ResConfig.ExternalResDir) && Path.GetDirectoryName(newPath).Replace("\\", "/") == ResConfig.ExternalResDir) { result = AssetMoveResult.FailedMove; } if (result == AssetMoveResult.FailedMove) { UnityEditor.EditorUtility.DisplayDialog("tips", "移动路径不符合规范", "确定"); } else { if (UnityEditor.EditorUtility.DisplayDialog("tips", "此资源已经被添加至了资源编辑器,改变后会自动修改\n 确定要修改吗?", "确定")) { if (isFolder) { MoveFolder(oldPath, newPath); } else { ChangeAssetInfo(oldPath, newPath); } } else { result = AssetMoveResult.FailedMove; } } } else { result = AssetMoveResult.DidNotMove; } return(result); }
private static AssetMoveResult OnWillMoveAsset(string sourcePath, string destinationPath) { //Debug.Log("Source path: " + sourcePath + ". Destination path: " + destinationPath + "."); AssetMoveResult assetMoveResult = AssetMoveResult.DidMove; // Perform operations on the asset and set the value of 'assetMoveResult' accordingly. return(assetMoveResult); }
private static void OnMoveAssetCallBack(AssetMoveResult t, string t1, string t2) { List <string> paths = new List <string>(); paths.Add(t1); paths.Add(t2); UpdateAsset(paths); GlobalEvent.DispatchEvent(EditorGlobalEventEnum.OnMoveAsset, t, t1, t2); }
public static AssetMoveResult _OnWillMoveAsset(string oldPath, string newPath) { AssetMoveResult result = AssetMoveResult.DidNotMove; if (oldPath == prefabPath) { result = AssetMoveResult.FailedMove; EditorUtility.DisplayDialog("Error", "Don't Move Me!", "OK!!!"); } return(result); }
public static AssetMoveResult OnWillMoveAsset(string oldPath, string newPath) { AssetMoveResult result = AssetMoveResult.DidNotMove; if (oldPath == prefabPath) { result = AssetMoveResult.FailedMove; EditorUtility.DisplayDialog("Attention", "You shouldn't move this asset", "Ok"); } return(result); }
/// <summary> /// Unity method called whenever an asset move is attempted. /// </summary> /// <param name="oldPath">Old path.</param> /// <param name="newPath">New path.</param> private static AssetMoveResult OnWillMoveAsset(string oldPath, string newPath) { AssetMoveResult assetMoveResult = AssetMoveResult.DidNotMove; if (FolderLockSettings.Instance != null && FolderLockSettings.Instance.IsLockedFolder(oldPath) && FolderLockSettings.Instance.IsLockedFolder(newPath)) { assetMoveResult = AssetMoveResult.FailedMove; } return(assetMoveResult); }
public static AssetMoveResult OnWillMoveAsset(string oldPath, string newPath) { AssetMoveResult result = AssetMoveResult.DidNotMove; if (IsLocked(oldPath)) { Debug.LogError(string.Format("Could not move {0} to {1} because {0} is locked!", oldPath, newPath)); result = AssetMoveResult.FailedMove; } else if (IsLocked(newPath)) { Debug.LogError(string.Format("Could not move {0} to {1} because {1} is locked!", oldPath, newPath)); result = AssetMoveResult.FailedMove; } return(result); }
private static AssetMoveResult OnWillMoveAsset(string oldPath, string newPath) { if (OnWillMoveAssetCallBack != null) { OnWillMoveAssetCallBack(oldPath, newPath); } AssetMoveResult result = AssetMoveResult.DidNotMove; if (IsLocked(oldPath)) { Debug.LogError(string.Format("Could not move {0} to {1} because {0} is locked!", oldPath, newPath)); return(AssetMoveResult.FailedMove); } else if (IsLocked(newPath)) { Debug.LogError(string.Format("Could not move {0} to {1} because {1} is locked!", oldPath, newPath)); return(AssetMoveResult.FailedMove); } OnMoveAssetP = new object[] { result, oldPath, newPath }; return(result); }
private static AssetMoveResult OnWillMoveAsset(string sourcePath, string destinationPath) { AssetMoveResult assetMoveResult = AssetMoveResult.DidNotMove; if (ReloadAssembliesSetting.LockReloadAssemblies) { return(assetMoveResult); } bool isTip = false; if (AssetDatabase.IsValidFolder(sourcePath)) { isTip = AssetDatabase.FindAssets("t:Script", new string[] { sourcePath }).Length != 0; } else { if (sourcePath.EndsWith(".cs")) { //只是改了文件名 if (Directory.GetParent(sourcePath).FullName != Directory.GetParent(destinationPath).FullName) { isTip = true; } } } if (isTip) { if (EditorUtility.DisplayDialog("Move Scirpts Tip", $"Source path exist Scripts. Do you want move?\n\nSource path: {sourcePath}\nDestination path: {destinationPath}", "Yes Move", "No" , DialogOptOutDecisionType.ForThisSession, "Move Scirpts Tip") == false) { assetMoveResult = AssetMoveResult.FailedMove; } } return(assetMoveResult); }
private static AssetMoveResult OnWillMoveAsset(string fromPath, string toPath, string[] newPaths, string[] NewMetaPaths) { AssetMoveResult didNotMove = AssetMoveResult.DidNotMove; if (InternalEditorUtility.HasTeamLicense()) { didNotMove = AssetModificationHook.OnWillMoveAsset(fromPath, toPath); foreach (System.Type type in AssetModificationProcessors) { MethodInfo method = type.GetMethod("OnWillMoveAsset", BindingFlags.NonPublic | BindingFlags.Public | BindingFlags.Static); if (method != null) { RequireTeamLicense(); object[] args = new object[] { fromPath, toPath }; if (CheckArgumentsAndReturnType(args, method, didNotMove.GetType())) { didNotMove |= (AssetMoveResult)method.Invoke(null, args); } } } } return(didNotMove); }