update repaire ref tool

This commit is contained in:
Mikhail 2024-10-01 18:04:53 +08:00
parent 5e2c03be1e
commit acd86ed3f0
15 changed files with 635 additions and 29 deletions

View File

@ -242,10 +242,13 @@ namespace DCFApixels.DragonECS.Unity.Editors
public static IndentLevelScope SetIndentLevel(int level) => new IndentLevelScope(level);
public static IndentLevelScope UpIndentLevel() => new IndentLevelScope(EditorGUI.indentLevel + 1);
public static ContentColorScope SetContentColor(Color value) => new ContentColorScope(value);
public static ContentColorScope SetContentColor(Color value, float a) => new ContentColorScope(value.r, value.g, value.b, a);
public static ContentColorScope SetContentColor(float r, float g, float b, float a = 1f) => new ContentColorScope(r, g, b, a);
public static BackgroundColorScope SetBackgroundColor(Color value) => new BackgroundColorScope(value);
public static BackgroundColorScope SetBackgroundColor(Color value, float a) => new BackgroundColorScope(value.r, value.g, value.b, a);
public static BackgroundColorScope SetBackgroundColor(float r, float g, float b, float a = 1f) => new BackgroundColorScope(r, g, b, a);
public static ColorScope SetColor(Color value) => new ColorScope(value);
public static ColorScope SetColor(Color value, float a) => new ColorScope(value.a, value.g, value.b, a);
public static ColorScope SetColor(float r, float g, float b, float a = 1f) => new ColorScope(r, g, b, a);
public static ColorScope SetAlpha(float a) => new ColorScope(GUI.color * new Color(1, 1, 1, a));
public static EditorGUI.DisabledScope Enable => new EditorGUI.DisabledScope(false);

View File

@ -124,7 +124,7 @@ namespace DCFApixels.DragonECS.Unity.Editors
}
_serializableTypes = serializableTypes.ToArray();
_serializableTypeWithMetaIDMetas = serializableTypes
.Where(type => TypeMeta.IsHasMetaID(type))
.Where(TypeMeta.IsHasMetaID)
.Select(type => type.ToMeta())
.ToArray();
@ -318,6 +318,9 @@ namespace DCFApixels.DragonECS.Unity.Editors
{
_singletonContent = new GUIContent();
}
_singletonContent.text = string.Empty;
_singletonContent.tooltip = string.Empty;
_singletonContent.image = null;
return _singletonContent;
}
public static GUIContent GetLabel(string name, string tooltip = null)

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 KiB

View File

@ -0,0 +1,122 @@
fileFormatVersion: 2
guid: c67e8a1d6cb0e904590c7847368fe794
TextureImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 11
mipmaps:
mipMapMode: 0
enableMipMap: 0
sRGBTexture: 0
linearTexture: 0
fadeOut: 0
borderMipMap: 0
mipMapsPreserveCoverage: 0
alphaTestReferenceValue: 0.5
mipMapFadeDistanceStart: 1
mipMapFadeDistanceEnd: 3
bumpmap:
convertToNormalMap: 0
externalNormalMap: 0
heightScale: 0.25
normalMapFilter: 0
isReadable: 0
streamingMipmaps: 0
streamingMipmapsPriority: 0
vTOnly: 0
ignoreMasterTextureLimit: 0
grayScaleToAlpha: 0
generateCubemap: 6
cubemapConvolution: 0
seamlessCubemap: 0
textureFormat: 1
maxTextureSize: 2048
textureSettings:
serializedVersion: 2
filterMode: 1
aniso: 1
mipBias: 0
wrapU: 0
wrapV: 0
wrapW: 0
nPOTScale: 1
lightmap: 0
compressionQuality: 50
spriteMode: 0
spriteExtrude: 1
spriteMeshType: 1
alignment: 0
spritePivot: {x: 0.5, y: 0.5}
spritePixelsToUnits: 100
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
spriteGenerateFallbackPhysicsShape: 1
alphaUsage: 1
alphaIsTransparency: 1
spriteTessellationDetail: -1
textureType: 0
textureShape: 1
singleChannelComponent: 0
flipbookRows: 1
flipbookColumns: 1
maxTextureSizeSet: 0
compressionQualitySet: 0
textureFormatSet: 0
ignorePngGamma: 0
applyGammaDecoding: 0
platformSettings:
- serializedVersion: 3
buildTarget: DefaultTexturePlatform
maxTextureSize: 64
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 3
buildTarget: Standalone
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 3
buildTarget: Server
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
spriteSheet:
serializedVersion: 2
sprites: []
outline: []
physicsShape: []
bones: []
spriteID:
internalID: 0
vertices: []
indices:
edges: []
weights: []
secondaryTextures: []
nameFileIdTable: {}
spritePackingTag:
pSDRemoveMatte: 0
pSDShowRemoveMatteOption: 0
userData:
assetBundleName:
assetBundleVariant:

View File

@ -9,18 +9,28 @@ namespace DCFApixels.DragonECS.Unity.Internal
[SerializeField]
private Texture _helpIcon = null;
[SerializeField]
private Texture _fileIcon = null;
[SerializeField]
private Texture _errorIcon = null;
[SerializeField]
private Texture _warningIcon = null;
[SerializeField]
private Texture _passIcon = null;
[SerializeField]
private Texture _unlinkIcon = null;
[SerializeField]
private Texture _searchIcon = null;
[SerializeField]
private Texture _closeIcon = null;
[SerializeField]
private Texture _closeIconOn = null;
[SerializeField]
private Texture _unlinkIcon = null;
[SerializeField]
private Texture _auotsetIcon = null;
[SerializeField]
private Texture _auotsetCascadeIcon = null;
[SerializeField]
private Texture _searchIcon = null;
[SerializeField]
private Texture _visibilityIconOn = null;
[SerializeField]
private Texture _visibilityIconOff = null;
@ -28,21 +38,25 @@ namespace DCFApixels.DragonECS.Unity.Internal
private Texture _labelIconType = null;
[SerializeField]
private Texture _labelIconMeta = null;
[SerializeField]
private Texture _fileIcon = null;
internal Texture HelpIcon { get { return _helpIcon; } }
internal Texture FileIcon { get { return _fileIcon; } }
internal Texture ErrorIcon { get { return _errorIcon; } }
internal Texture WarningIcon { get { return _warningIcon; } }
internal Texture PassIcon { get { return _passIcon; } }
internal Texture UnlinkIcon { get { return _unlinkIcon; } }
internal Texture SearchIcon { get { return _searchIcon; } }
internal Texture CloseIcon { get { return _closeIcon; } }
internal Texture CloseIconOn { get { return _closeIconOn; } }
internal Texture UnlinkIcon { get { return _unlinkIcon; } }
internal Texture AuotsetIcon { get { return _auotsetIcon; } }
internal Texture AutosetCascadeIcon { get { return _auotsetCascadeIcon; } }
internal Texture SearchIcon { get { return _searchIcon; } }
internal Texture VisibilityIconOn { get { return _visibilityIconOn; } }
internal Texture VisibilityIconOff { get { return _visibilityIconOff; } }
internal Texture LabelIconType { get { return _labelIconType; } }
internal Texture LabelIconMeta { get { return _labelIconMeta; } }
internal Texture FileIcon { get { return _fileIcon; } }
#endif
}
}

View File

@ -16,6 +16,9 @@ MonoImporter:
- _labelIconType: {fileID: 2800000, guid: 5476d6e1435981e4cbc915a080f93ee6, type: 3}
- _labelIconMeta: {fileID: 2800000, guid: ebb82b09315bde749a10dfa45e64067c, type: 3}
- _fileIcon: {fileID: 2800000, guid: 4f1ca6aa9d407844485856184c785946, type: 3}
- _errorIcon: {fileID: 2800000, guid: c67e8a1d6cb0e904590c7847368fe794, type: 3}
- _warningIcon: {fileID: 2800000, guid: 223d96e24d4b49f468b628cf9839584c, type: 3}
- _passIcon: {fileID: 2800000, guid: 0df5856dbbe53494aae23b959ca05ecc, type: 3}
executionOrder: 0
icon: {instanceID: 0}
userData:

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.4 KiB

View File

@ -0,0 +1,122 @@
fileFormatVersion: 2
guid: 0df5856dbbe53494aae23b959ca05ecc
TextureImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 11
mipmaps:
mipMapMode: 0
enableMipMap: 0
sRGBTexture: 0
linearTexture: 0
fadeOut: 0
borderMipMap: 0
mipMapsPreserveCoverage: 0
alphaTestReferenceValue: 0.5
mipMapFadeDistanceStart: 1
mipMapFadeDistanceEnd: 3
bumpmap:
convertToNormalMap: 0
externalNormalMap: 0
heightScale: 0.25
normalMapFilter: 0
isReadable: 0
streamingMipmaps: 0
streamingMipmapsPriority: 0
vTOnly: 0
ignoreMasterTextureLimit: 0
grayScaleToAlpha: 0
generateCubemap: 6
cubemapConvolution: 0
seamlessCubemap: 0
textureFormat: 1
maxTextureSize: 2048
textureSettings:
serializedVersion: 2
filterMode: 1
aniso: 1
mipBias: 0
wrapU: 0
wrapV: 0
wrapW: 0
nPOTScale: 1
lightmap: 0
compressionQuality: 50
spriteMode: 0
spriteExtrude: 1
spriteMeshType: 1
alignment: 0
spritePivot: {x: 0.5, y: 0.5}
spritePixelsToUnits: 100
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
spriteGenerateFallbackPhysicsShape: 1
alphaUsage: 1
alphaIsTransparency: 1
spriteTessellationDetail: -1
textureType: 0
textureShape: 1
singleChannelComponent: 0
flipbookRows: 1
flipbookColumns: 1
maxTextureSizeSet: 0
compressionQualitySet: 0
textureFormatSet: 0
ignorePngGamma: 0
applyGammaDecoding: 0
platformSettings:
- serializedVersion: 3
buildTarget: DefaultTexturePlatform
maxTextureSize: 64
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 3
buildTarget: Standalone
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 3
buildTarget: Server
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
spriteSheet:
serializedVersion: 2
sprites: []
outline: []
physicsShape: []
bones: []
spriteID:
internalID: 0
vertices: []
indices:
edges: []
weights: []
secondaryTextures: []
nameFileIdTable: {}
spritePackingTag:
pSDRemoveMatte: 0
pSDShowRemoveMatteOption: 0
userData:
assetBundleName:
assetBundleVariant:

View File

@ -24,3 +24,6 @@ MonoBehaviour:
_labelIconType: {fileID: 2800000, guid: 5476d6e1435981e4cbc915a080f93ee6, type: 3}
_labelIconMeta: {fileID: 2800000, guid: ebb82b09315bde749a10dfa45e64067c, type: 3}
_fileIcon: {fileID: 2800000, guid: 4f1ca6aa9d407844485856184c785946, type: 3}
_errorIcon: {fileID: 2800000, guid: c67e8a1d6cb0e904590c7847368fe794, type: 3}
_warningIcon: {fileID: 2800000, guid: 223d96e24d4b49f468b628cf9839584c, type: 3}
_passIcon: {fileID: 2800000, guid: 0df5856dbbe53494aae23b959ca05ecc, type: 3}

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.3 KiB

View File

@ -0,0 +1,122 @@
fileFormatVersion: 2
guid: 223d96e24d4b49f468b628cf9839584c
TextureImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 11
mipmaps:
mipMapMode: 0
enableMipMap: 0
sRGBTexture: 0
linearTexture: 0
fadeOut: 0
borderMipMap: 0
mipMapsPreserveCoverage: 0
alphaTestReferenceValue: 0.5
mipMapFadeDistanceStart: 1
mipMapFadeDistanceEnd: 3
bumpmap:
convertToNormalMap: 0
externalNormalMap: 0
heightScale: 0.25
normalMapFilter: 0
isReadable: 0
streamingMipmaps: 0
streamingMipmapsPriority: 0
vTOnly: 0
ignoreMasterTextureLimit: 0
grayScaleToAlpha: 0
generateCubemap: 6
cubemapConvolution: 0
seamlessCubemap: 0
textureFormat: 1
maxTextureSize: 2048
textureSettings:
serializedVersion: 2
filterMode: 1
aniso: 1
mipBias: 0
wrapU: 0
wrapV: 0
wrapW: 0
nPOTScale: 1
lightmap: 0
compressionQuality: 50
spriteMode: 0
spriteExtrude: 1
spriteMeshType: 1
alignment: 0
spritePivot: {x: 0.5, y: 0.5}
spritePixelsToUnits: 100
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
spriteGenerateFallbackPhysicsShape: 1
alphaUsage: 1
alphaIsTransparency: 1
spriteTessellationDetail: -1
textureType: 0
textureShape: 1
singleChannelComponent: 0
flipbookRows: 1
flipbookColumns: 1
maxTextureSizeSet: 0
compressionQualitySet: 0
textureFormatSet: 0
ignorePngGamma: 0
applyGammaDecoding: 0
platformSettings:
- serializedVersion: 3
buildTarget: DefaultTexturePlatform
maxTextureSize: 64
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 3
buildTarget: Standalone
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 3
buildTarget: Server
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
spriteSheet:
serializedVersion: 2
sprites: []
outline: []
physicsShape: []
bones: []
spriteID:
internalID: 0
vertices: []
indices:
edges: []
weights: []
secondaryTextures: []
nameFileIdTable: {}
spritePackingTag:
pSDRemoveMatte: 0
pSDShowRemoveMatteOption: 0
userData:
assetBundleName:
assetBundleVariant:

View File

@ -1,4 +1,5 @@
#if UNITY_EDITOR
using DCFApixels.DragonECS.Unity.Internal;
using DCFApixels.DragonECS.Unity.RefRepairer.Editors;
using System.Linq;
using UnityEditor;
@ -12,30 +13,140 @@ namespace DCFApixels.DragonECS.Unity.Editors
{
public const string TITLE = "Reference Repairer";
[MenuItem("Tools/" + EcsConsts.FRAMEWORK_NAME + "/" + TITLE)]
static void Open()
public static void Open()
{
var wnd = GetWindow<RefRepairerWindow>();
wnd.titleContent = new GUIContent(TITLE);
wnd.minSize = new Vector2(100f, 120f);
wnd.minSize = new Vector2(140f, 140f);
wnd.Show();
}
private MissingRefContainer _missingRefContainer = new MissingRefContainer();
private MissingsResolvingData[] _cachedMissingsResolvingDatas = null;
private MissingsResolvingData _selectedMissingsResolvingData = null;
private ReorderableList _reorderableResolvingDataList;
private ReorderableList _reorderableList;
private float _lineWidth = 0f;
private float _arrowWidth = 0f;
private void InitList()
{
if(_reorderableList == null)
if (_reorderableResolvingDataList == null)
{
_reorderableList = new ReorderableList(_cachedMissingsResolvingDatas, typeof(MissingsResolvingData), false, false, false, false);
_reorderableList.headerHeight = 0;
_reorderableList.footerHeight = 0;
_reorderableResolvingDataList = new ReorderableList(_cachedMissingsResolvingDatas, typeof(MissingsResolvingData), false, false, false, false);
_reorderableResolvingDataList.headerHeight = 0;
_reorderableResolvingDataList.footerHeight = 0;
_reorderableResolvingDataList.elementHeightCallback += OnReorderableResolvingDataListGetHeight;
_reorderableResolvingDataList.drawElementBackgroundCallback += OnReorderableResolvingDataListDrawElement;
_reorderableResolvingDataList.drawElementCallback += OnReorderableClearDrawElement;
_reorderableResolvingDataList.showDefaultBackground = false;
}
_reorderableList.list = _cachedMissingsResolvingDatas;
_reorderableResolvingDataList.list = _cachedMissingsResolvingDatas;
_lineWidth = GUI.skin.label.CalcSize(UnityEditorUtility.GetLabel("Namespace:")).x;
_arrowWidth = GUI.skin.button.CalcSize(UnityEditorUtility.GetLabel("->")).x;
}
private readonly Color _activedColor = new Color(0f, 0.6f, 1f, 0.36f);
private readonly Color _dragColor = new Color(0f, 0.60f, 1f, 0.16f);
private float OnReorderableResolvingDataListGetHeight(int index)
{
return (EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing) * 3f + EditorGUIUtility.standardVerticalSpacing;
}
private void OnReorderableClearDrawElement(Rect rect, int index, bool isActive, bool isFocused) { }
private void OnReorderableResolvingDataListDrawElement(Rect rect, int index, bool isActive, bool isFocused)
{
if (index < 0 || index >= _cachedMissingsResolvingDatas.Length) { return; }
ref var data = ref _cachedMissingsResolvingDatas[index];
using (EcsGUI.SetAlpha(0))
{
if (GUI.Button(rect, ""))
{
_selectedMissingsResolvingData = _cachedMissingsResolvingDatas[index];
}
}
if (isActive)
{
EditorGUI.DrawRect(rect, _activedColor);
}
if (EcsGUI.HitTest(rect))
{
EditorGUI.DrawRect(rect, _dragColor);
}
rect = rect.AddPadding(EditorGUIUtility.standardVerticalSpacing, 0);
Rect infoRect;
(infoRect, rect) = rect.HorizontalSliceLeft(20f);
if (data.IsResolved)
{
GUI.Label(infoRect, UnityEditorUtility.GetLabel(Icons.Instance.PassIcon, "Valid type"));
}
else if (data.IsEmpty)
{
GUI.Label(infoRect, UnityEditorUtility.GetLabel(Icons.Instance.WarningIcon, "Is empty"));
}
else
{
GUI.Label(infoRect, UnityEditorUtility.GetLabel(Icons.Instance.ErrorIcon, "Type not found"));
}
rect.height = EditorGUIUtility.singleLineHeight;
rect = rect.Move(0, EditorGUIUtility.standardVerticalSpacing);
DrawLine(rect, "Name:", data.OldTypeData.ClassName, data.NewTypeData.ClassName);
rect = rect.Move(0, EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing);
DrawLine(rect, "Namespace:", data.OldTypeData.NamespaceName, data.NewTypeData.NamespaceName);
rect = rect.Move(0, EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing);
DrawLine(rect, "Assembly:", data.OldTypeData.AssemblyName, data.NewTypeData.AssemblyName);
rect.yMin = rect.yMax - 2f;
rect = rect.Move(0, EditorGUIUtility.standardVerticalSpacing * 2f);
rect.xMin -= infoRect.width;
//EditorGUI.DrawRect(rect, new Color(0, 0, 0, 0.3f));
}
private void DrawLine(Rect rect, string name, string oldStr, string newStr)
{
Rect nameRect, oldRect, arrowRect, newRect;
(nameRect, rect) = rect.HorizontalSliceLeft(_lineWidth);
float tmp = (rect.width - _arrowWidth) / 2f;
(oldRect, rect) = rect.HorizontalSliceLeft(tmp);
(arrowRect, rect) = rect.HorizontalSliceLeft(_arrowWidth);
(newRect, rect) = rect.HorizontalSliceLeft(tmp);
GUI.Label(nameRect, name);
EditorGUI.DrawRect(oldRect, new Color(0, 0, 0, 0.16f));
GUI.Label(oldRect, oldStr);
using (EcsGUI.SetAlignment(GUI.skin.label, TextAnchor.MiddleCenter))
{
GUI.Label(arrowRect, "->");
}
EditorGUI.DrawRect(newRect, new Color(0, 0, 0, 0.16f));
GUI.Label(newRect, newStr);
}
private string DrawEditableLine(Rect rect, string name, string oldStr, string newStr)
{
Rect nameRect, oldRect, arrowRect, newRect;
(nameRect, rect) = rect.HorizontalSliceLeft(_lineWidth);
float tmp = (rect.width - _arrowWidth) / 2f;
(oldRect, rect) = rect.HorizontalSliceLeft(tmp);
(arrowRect, rect) = rect.HorizontalSliceLeft(_arrowWidth);
(newRect, rect) = rect.HorizontalSliceLeft(tmp);
GUI.Label(nameRect, name);
GUI.TextField(oldRect, oldStr);
if (GUI.Button(arrowRect.AddPadding(2.5f, 0), "->"))
{
newStr = oldStr;
}
return EditorGUI.TextField(newRect, newStr);
}
private Vector2 _scrollViewPosition;
private void OnGUI()
{
if (_missingRefContainer.IsEmplty)
@ -54,9 +165,7 @@ namespace DCFApixels.DragonECS.Unity.Editors
if (GUILayout.Button("Repaire missing references"))
{
Debug.Log(_missingRefContainer.IsEmplty);
var x = _missingRefContainer.collectedMissingTypesBuffer[0];
Debug.Log(x.ResolvingData.NewTypeData.AutoToString());
_selectedMissingsResolvingData = null;
RepaireFileUtility.RepaieAsset(_missingRefContainer);
}
@ -66,7 +175,53 @@ namespace DCFApixels.DragonECS.Unity.Editors
InitList();
}
_reorderableList.DoLayoutList();
var bc = EcsGUI.SetBackgroundColor(Color.black, 0.5f);
using (EcsGUI.Layout.BeginVertical(EditorStyles.helpBox))
{
bc.Dispose();
_scrollViewPosition = GUILayout.BeginScrollView(_scrollViewPosition, GUILayout.ExpandHeight(true));
_reorderableResolvingDataList.DoLayoutList();
GUILayout.EndScrollView();
}
GUILayout.BeginVertical(GUILayout.ExpandHeight(false));
//GUILayout.BeginVertical(EditorStyles.helpBox, GUILayout.ExpandHeight(false));
var data = _selectedMissingsResolvingData;
Rect rect = GUILayoutUtility.GetRect(
EditorGUIUtility.currentViewWidth,
(EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing) * 3f + EditorGUIUtility.standardVerticalSpacing * 2f)
.AddPadding(EditorGUIUtility.standardVerticalSpacing);
if (data == null)
{
using (EcsGUI.SetAlignment(TextAnchor.MiddleCenter))
{
GUI.Label(rect, "Select any record");
}
}
else
{
using (EcsGUI.CheckChanged())
{
rect.height = EditorGUIUtility.singleLineHeight;
rect = rect.Move(0, EditorGUIUtility.standardVerticalSpacing);
string ClassName = DrawEditableLine(rect, "Name:", data.OldTypeData.ClassName, data.NewTypeData.ClassName);
rect = rect.Move(0, EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing);
string NamespaceName = DrawEditableLine(rect, "Namespace:", data.OldTypeData.NamespaceName, data.NewTypeData.NamespaceName);
rect = rect.Move(0, EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing);
string AssemblyName = DrawEditableLine(rect, "Assembly:", data.OldTypeData.AssemblyName, data.NewTypeData.AssemblyName);
if (EcsGUI.Changed)
{
data.NewTypeData = new RefRepairer.Internal.TypeData(ClassName, NamespaceName, AssemblyName);
}
}
}
GUILayout.EndVertical();
}

View File

@ -36,7 +36,7 @@ namespace DCFApixels.DragonECS.Unity.RefRepairer.Editors
return $"type: {{class: {typeData.ClassName}, ns: {typeData.NamespaceName}, asm: {typeData.AssemblyName}}}";
}
public static void RepaieAsset(MissingRefContainer container)
{
{
if (container.IsEmplty) { return; }
for (int i = 0; i < container.collectedMissingTypesBufferCount; i++)

View File

@ -1,5 +1,7 @@
#if UNITY_EDITOR
using DCFApixels.DragonECS.Unity.RefRepairer.Internal;
using System;
using System.Reflection;
namespace DCFApixels.DragonECS.Unity.RefRepairer.Editors
{
@ -16,7 +18,50 @@ namespace DCFApixels.DragonECS.Unity.RefRepairer.Editors
}
public bool IsResolved
{
get { return string.IsNullOrEmpty(_newTypeData.ClassName) == false; }
get
{
//return
// string.IsNullOrEmpty(_newTypeData.ClassName) == false &&
// string.IsNullOrEmpty(_newTypeData.AssemblyName) == false;
return FindNewType() != null;
}
}
public bool IsEmpty
{
get
{
return
string.IsNullOrEmpty(_newTypeData.ClassName) ||
string.IsNullOrEmpty(_newTypeData.AssemblyName);
}
}
private Type _chachedNewType = null;
private bool _chachedNewTypeInited = false;
public Type FindNewType()
{
if (_chachedNewTypeInited == false)
{
if (string.IsNullOrEmpty(_newTypeData.AssemblyName) == false)
{
Assembly assembly = null;
try
{
assembly = Assembly.Load(_newTypeData.AssemblyName);
}
catch { }
if (assembly == null)
{
_chachedNewType = null;
}
else
{
string fullTypeName = $"{_newTypeData.NamespaceName}.{_newTypeData.ClassName}";
_chachedNewType = assembly.GetType(fullTypeName);
}
_chachedNewTypeInited = true;
}
}
return _chachedNewType;
}
public TypeData NewTypeData
{
@ -25,6 +70,8 @@ namespace DCFApixels.DragonECS.Unity.RefRepairer.Editors
{
_newTypeData = value;
_newSerializedInfoLine = null;
_chachedNewType = null;
_chachedNewTypeInited = false;
}
}
public string NewSerializedInfoLine

View File

@ -172,15 +172,27 @@ namespace DCFApixels.DragonECS.Unity.Editors
return;
}
if (IsMultipleTargets == false && SerializationUtility.HasManagedReferencesWithMissingTypes(target))
{
using (EcsGUI.Layout.BeginHorizontal(EditorStyles.helpBox))
{
GUILayout.Label(UnityEditorUtility.GetLabel(Icons.Instance.WarningIcon), GUILayout.ExpandWidth(false));
using (EcsGUI.Layout.BeginVertical())
{
GUILayout.Label("This object contains SerializeReference types which are missing.", EditorStyles.miniLabel);
if (GUILayout.Button("Repaire References Tool", EditorStyles.miniButton, GUILayout.MaxWidth(200f)))
{
RefRepairerWindow.Open();
}
}
}
}
using (EcsGUI.Layout.BeginVertical(UnityEditorUtility.GetStyle(Color.black, 0.2f)))
{
DrawTop(Target, _componentsProp);
_reorderableComponentsList.DoLayoutList();
//GUILayout.Label("", GUILayout.Height(0), GUILayout.ExpandWidth(true));
//for (int i = _componentsProp.arraySize - 1; i >= 0; i--)
//{
// DrawComponentData(_componentsProp.GetArrayElementAtIndex(i), _componentsProp.arraySize, i);
//}
}
}
private void DrawTop(ITemplateInternal target, SerializedProperty componentsProp)