mirror of
https://github.com/DCFApixels/DragonECS-Unity.git
synced 2025-09-17 17:34:34 +08:00
refactoring
This commit is contained in:
parent
acd86ed3f0
commit
66d875b4f5
@ -2,7 +2,6 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
|
||||
namespace DCFApixels.DragonECS.Unity.Editors
|
||||
{
|
||||
@ -17,35 +16,28 @@ namespace DCFApixels.DragonECS.Unity.Editors
|
||||
|
||||
foreach (string str in importedAssets)
|
||||
{
|
||||
Debug.Log("Reimported Asset: " + str);
|
||||
//Debug.Log("Reimported Asset: " + str);
|
||||
ProcessAssetPath(str);
|
||||
}
|
||||
foreach (string str in deletedAssets)
|
||||
{
|
||||
Debug.Log("Deleted Asset: " + str);
|
||||
//Debug.Log("Deleted Asset: " + str);
|
||||
RemoveAssetPath(str);
|
||||
}
|
||||
|
||||
for (int i = 0; i < movedAssets.Length; i++)
|
||||
{
|
||||
Debug.Log("Moved Asset: " + movedAssets[i] + " from: " + movedFromAssetPaths[i]);
|
||||
//Debug.Log("Moved Asset: " + movedAssets[i] + " from: " + movedFromAssetPaths[i]);
|
||||
RemoveAssetPath(movedFromAssetPaths[i]);
|
||||
ProcessAssetPath(movedAssets[i]);
|
||||
}
|
||||
|
||||
if (didDomainReload)
|
||||
{
|
||||
Debug.Log("Domain has been reloaded");
|
||||
}
|
||||
//if (didDomainReload)
|
||||
//{
|
||||
// Debug.Log("Domain has been reloaded");
|
||||
//}
|
||||
|
||||
|
||||
foreach (var item in _removedScriptGuids)
|
||||
{
|
||||
Debug.Log(item);
|
||||
}
|
||||
foreach (var item in _newScriptIDs)
|
||||
{
|
||||
Debug.Log(item);
|
||||
}
|
||||
_version = DateTime.Now.Ticks;
|
||||
}
|
||||
|
||||
@ -64,14 +56,14 @@ namespace DCFApixels.DragonECS.Unity.Editors
|
||||
private static void RemoveAssetPath(string filePath)
|
||||
{
|
||||
if (IsScript(filePath) == false) { return; }
|
||||
Debug.Log("RemoveAssetPath: " + filePath);
|
||||
//Debug.Log("RemoveAssetPath: " + filePath);
|
||||
_removedScriptGuids.Add(filePath);
|
||||
}
|
||||
|
||||
private static void ProcessAssetPath(string filePath)
|
||||
{
|
||||
if (IsScript(filePath) == false) { return; }
|
||||
Debug.Log("ProcessAssetPath: " + filePath);
|
||||
//Debug.Log("ProcessAssetPath: " + filePath);
|
||||
|
||||
var script = AssetDatabase.LoadAssetAtPath<MonoScript>(filePath).text;
|
||||
_newScriptIDs.Add(filePath);
|
||||
|
@ -2,7 +2,6 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Text;
|
||||
using UnityEngine;
|
||||
@ -118,7 +117,7 @@ namespace DCFApixels.DragonECS.Unity.Editors
|
||||
var targetTypes = assembly.GetTypes().Where(type =>
|
||||
(type.IsGenericType || type.IsAbstract || type.IsInterface) == false &&
|
||||
type.IsSubclassOf(typeof(UnityObject)) == false &&
|
||||
type.GetCustomAttribute<SerializableAttribute>() != null);
|
||||
/*type.GetCustomAttribute<SerializableAttribute>() != null*/ true);
|
||||
|
||||
serializableTypes.AddRange(targetTypes);
|
||||
}
|
||||
|
@ -98,66 +98,5 @@ namespace DCFApixels.DragonECS.Unity.RefRepairer.Editors
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//internal class RepairerFile
|
||||
//{
|
||||
// private readonly Type _type;
|
||||
// private readonly string[] _fileLines;
|
||||
//
|
||||
// private string _currentLine;
|
||||
// private string _nextLine;
|
||||
//
|
||||
// private int _currentIndex;
|
||||
//
|
||||
// private readonly string _path;
|
||||
// private readonly string _localAssetPath;
|
||||
//
|
||||
// public RepairerFile(Type type, string localAssetPath)
|
||||
// {
|
||||
// _type = type;
|
||||
// _localAssetPath = localAssetPath;
|
||||
//
|
||||
// _path = $"{Application.dataPath.Replace("/Assets", "")}/{localAssetPath}";
|
||||
// _fileLines = File.ReadAllLines(_path);
|
||||
// }
|
||||
//
|
||||
// public delegate bool GetterMissingTypeData(out MissingTypeData missingType);
|
||||
//
|
||||
// public void Repair(Func<bool> callbackForNextLine)
|
||||
// {
|
||||
// for (int i = 0; i < _fileLines.Length - 1; ++i)
|
||||
// {
|
||||
// _currentIndex = i;
|
||||
//
|
||||
// _currentLine = _fileLines[i];
|
||||
// _nextLine = _fileLines[i + 1];
|
||||
//
|
||||
// if (callbackForNextLine.Invoke())
|
||||
// break;
|
||||
// }
|
||||
//
|
||||
// File.WriteAllLines(_path, _fileLines);
|
||||
//
|
||||
// AssetDatabase.ImportAsset(_localAssetPath, ImportAssetOptions.ForceUpdate);
|
||||
// AssetDatabase.Refresh();
|
||||
// }
|
||||
//
|
||||
// public bool CheckNeedLineAndReplacedIt(ManagedReferenceMissingType missingType)
|
||||
// {
|
||||
// string rid = $"rid: {missingType.referenceId}";
|
||||
// string oldTypeData = $"type: {{class: {missingType.className}, ns: {missingType.namespaceName}, asm: {missingType.assemblyName}}}";
|
||||
//
|
||||
// if (_currentLine.Contains(rid) && _nextLine.Contains(oldTypeData))
|
||||
// {
|
||||
// string newTypeData = $"type: {{class: {_type.Name}, ns: {_type.Namespace}, asm: {_type.Assembly.GetName().Name}}}";
|
||||
// _fileLines[_currentIndex + 1] = _nextLine.Replace(oldTypeData, newTypeData);
|
||||
//
|
||||
// return true;
|
||||
// }
|
||||
//
|
||||
// return false;
|
||||
// }
|
||||
//}
|
||||
}
|
||||
#endif
|
Loading…
Reference in New Issue
Block a user