From acd86ed3f0cd205c5d9e6c690ddab85fb06ddd83 Mon Sep 17 00:00:00 2001 From: Mikhail <99481254+DCFApixels@users.noreply.github.com> Date: Tue, 1 Oct 2024 18:04:53 +0800 Subject: [PATCH] update repaire ref tool --- src/Internal/Editor/EcsGUI.cs | 3 + src/Internal/Editor/UnityEditorUtility.cs | 5 +- src/Internal/Icons/ErrorIcon.png | Bin 0 -> 2217 bytes src/Internal/Icons/ErrorIcon.png.meta | 122 ++++++++++++ src/Internal/Icons/Icons.cs | 32 +++- src/Internal/Icons/Icons.cs.meta | 3 + src/Internal/Icons/PassIocn.png | Bin 0 -> 2442 bytes src/Internal/Icons/PassIocn.png.meta | 122 ++++++++++++ src/Internal/Icons/Resources/Icons.asset | 3 + src/Internal/Icons/WarningIcon.png | Bin 0 -> 2340 bytes src/Internal/Icons/WarningIcon.png.meta | 122 ++++++++++++ src/RefRepairer/Editor/RefRepairerWindow.cs | 179 ++++++++++++++++-- src/RefRepairer/RepairerFile.cs | 2 +- .../Utils/MissingsResolvingData.cs | 49 ++++- .../Editor/EntityTemplateEditor.cs | 22 ++- 15 files changed, 635 insertions(+), 29 deletions(-) create mode 100644 src/Internal/Icons/ErrorIcon.png create mode 100644 src/Internal/Icons/ErrorIcon.png.meta create mode 100644 src/Internal/Icons/PassIocn.png create mode 100644 src/Internal/Icons/PassIocn.png.meta create mode 100644 src/Internal/Icons/WarningIcon.png create mode 100644 src/Internal/Icons/WarningIcon.png.meta diff --git a/src/Internal/Editor/EcsGUI.cs b/src/Internal/Editor/EcsGUI.cs index 0cfe65a..de5c042 100644 --- a/src/Internal/Editor/EcsGUI.cs +++ b/src/Internal/Editor/EcsGUI.cs @@ -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); diff --git a/src/Internal/Editor/UnityEditorUtility.cs b/src/Internal/Editor/UnityEditorUtility.cs index ffd8464..5f7a031 100644 --- a/src/Internal/Editor/UnityEditorUtility.cs +++ b/src/Internal/Editor/UnityEditorUtility.cs @@ -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) diff --git a/src/Internal/Icons/ErrorIcon.png b/src/Internal/Icons/ErrorIcon.png new file mode 100644 index 0000000000000000000000000000000000000000..31ac988f5ad0529ef14d037233495fd801f89bbf GIT binary patch literal 2217 zcmbVO3sBQ`9FF)xnOesbb*~T~D4Hf|L(^ndL5hH*%9K;osia8?k+!KxparKQ4EH(@ zr#I0K^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git a/src/Internal/Icons/ErrorIcon.png.meta b/src/Internal/Icons/ErrorIcon.png.meta new file mode 100644 index 0000000..e565462 --- /dev/null +++ b/src/Internal/Icons/ErrorIcon.png.meta @@ -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: diff --git a/src/Internal/Icons/Icons.cs b/src/Internal/Icons/Icons.cs index 7c456a4..fc98d9f 100644 --- a/src/Internal/Icons/Icons.cs +++ b/src/Internal/Icons/Icons.cs @@ -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 } } diff --git a/src/Internal/Icons/Icons.cs.meta b/src/Internal/Icons/Icons.cs.meta index 321debb..b9c36ee 100644 --- a/src/Internal/Icons/Icons.cs.meta +++ b/src/Internal/Icons/Icons.cs.meta @@ -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: diff --git a/src/Internal/Icons/PassIocn.png b/src/Internal/Icons/PassIocn.png new file mode 100644 index 0000000000000000000000000000000000000000..548d72028c37d9c1f898d3f30f6bbeb57dd46409 GIT binary patch literal 2442 zcmbVO3s4hx9^RG`6huT(d>pb9w3YTYyPGFj4T6N160i{DCFo{%6Cz1=&4z^60l}j; z+5zquIu5=N6?-TZ9H&zhZshLj_38mHbD7!fpK`aJ22b5H`{(VTw$HX}Aa` z+Za<|Ws(ZwwNyb4rKE-HL*aFK1RyXoHWJP=n=Cw$rxH%`65!hP7!|^k5L=E)8152; zQ#G662-eELN)e7w7>2_NrHBlnr3#tk*RU89OHfRLiX{jZLdfKVL;+9#gh0+p>xo2l z)U+75Qwg(eHjY41hr=OqNJOmFfZ|G}62-)*Sd0J!!slCTWFBJSgJu}i3{P2&oXyBu zU>75)V{>gPA+S0XgPEJ9weZt<0vSW|NDjqCm@B49AWhBUxLm7gQkAKzi;V|Z zd=|@Pvo@B`W`BfwcKLe(Ah#OLtj2S_n9Z{iye-lW!kA9TbJ4supJUKOhG%oF6ccF& zHiKNza72WaA#JQx%d)1KN^PF842z{A1-vH3XrWmLANcN#YbmAtWtjkPt>HM|3)c7?J64 zB_>rWWKv8wvtP|pxvt8(_D^*=%~F8lf2yP$)8jh14x!`>g-A&$j*#*YC4w;wPD*gO z43kae1h`4C8o`T3nx1BLxuOB1l#()18kZn4k_0@sREdy!j6#?YOs8N-1z1(Ox_Poe zh!`UeN|!(Vek3tFr>{&#c(Nx5l5+LBN=Uhi%+SK=$HwR6;};#YAcw&|C;w`2?V(rV%6c=)ba~^Gqe3t{5~jg z7#z6eh&(O)9hq$V$&(45p?+69d>5y04DSoQ;(yuS3t71BeZ|9}q|-;rV#*UYe^k2s zqYayUNBrl!TeG3ZTs?91{pGzri_Qer-dOv#&%?n^+F6}qpXx)*OdSFcmBFC;iaxP`6%-n*)CsQ2V2aqgjRA9r9ai*LEj z3rjAJVoY9~?_e-?MV$p{uU166--TA}*9`wYcz2FZ`xy@;AfiLdwd&9GG_=wPX^+FvVy&u1q z+-CZ!?Ha0o5ZCS#zo`DbCG%G&7nRpJzX&@P(7I9Iw5*H?DlZhB z`qh02cPuk+xa&*Q`N8YEANdzIf1X@(#&huCjY4NbmOzKj3zRfp8#vk#I^ejdIq~w< zfYiB7W8#6cS)bMB28Q>PSM3X`Rs5~$+CUv-xc#zc3zT|`={Q{3^h(3^#>m~j`S#P1 zs-3FT3HGZKIl~^MNm+}+>$k=|aX9@})n*7K>OWcK|*I{cT>Rn`Eh+0 zi#yS6U2kX}Y%!hnZgfA<{Pmyr?Q%Z8v=(wE*ORd$N5whj?xu&ItKCDlID61GDys8( zQLppzc)wsGg58u}lCk2JWd7UR0$03rJiW{_EgIiy% z?%j0u&LJ+l9r1u0haSCoe)MKwfB*QYJ%8-Mv?-rmNW7bqK34tKhaVsOu43d1pJ>QC zPQ6;*Tz1!--&LA;F(4!1AI`;L{{LJbzeB!8QTs~Av2E4o1Vlq+$pL$R#}hM@{2yOf RFzEVPij9m{pW3j!?7wjQis}FW literal 0 HcmV?d00001 diff --git a/src/Internal/Icons/PassIocn.png.meta b/src/Internal/Icons/PassIocn.png.meta new file mode 100644 index 0000000..c304af9 --- /dev/null +++ b/src/Internal/Icons/PassIocn.png.meta @@ -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: diff --git a/src/Internal/Icons/Resources/Icons.asset b/src/Internal/Icons/Resources/Icons.asset index b2a6a5d..c249e9e 100644 --- a/src/Internal/Icons/Resources/Icons.asset +++ b/src/Internal/Icons/Resources/Icons.asset @@ -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} diff --git a/src/Internal/Icons/WarningIcon.png b/src/Internal/Icons/WarningIcon.png new file mode 100644 index 0000000000000000000000000000000000000000..dc564300f081cd3f80c94c2c6b445ce0d95b636a GIT binary patch literal 2340 zcmbVO3se;K9v*yf4MkCqL)z_(qajeU^V;XgBFHZ7nkxwF6;jLDc`OU;&bl+O>!JyI z$p_U1uS#7}^rH7D_oPK$(2De`7kq@BPC=R)r!*+7=pHoFQ`&!E*=uEwbN8It`OnPv z|Gw|{nBSQVIrATnj+zn$K~S{SV#)<)SUJW-f`2I(ybewecr67I1dWYVjtJ;)^$8F( z`jpF_FX!9l(X8lJF`Ve&RROmbpdl!AcEHQ9#k>qVc&E!_MEc)2g1|1$h%D0BaGN)i zFLYUgK0Yrv-_8b$Sp$d6PJ>eeG$3&EG6M(PB_4?m7?D9<8myJu7y=JM6R^&pV)UF^r=cE$Nt~oGoWe*7#r3pCOH(>H^h1E0j}z!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0 HcmV?d00001 diff --git a/src/Internal/Icons/WarningIcon.png.meta b/src/Internal/Icons/WarningIcon.png.meta new file mode 100644 index 0000000..3bc6d01 --- /dev/null +++ b/src/Internal/Icons/WarningIcon.png.meta @@ -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: diff --git a/src/RefRepairer/Editor/RefRepairerWindow.cs b/src/RefRepairer/Editor/RefRepairerWindow.cs index 2fd3726..8d45d2b 100644 --- a/src/RefRepairer/Editor/RefRepairerWindow.cs +++ b/src/RefRepairer/Editor/RefRepairerWindow.cs @@ -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(); 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(); } diff --git a/src/RefRepairer/RepairerFile.cs b/src/RefRepairer/RepairerFile.cs index ac3734b..b46bb77 100644 --- a/src/RefRepairer/RepairerFile.cs +++ b/src/RefRepairer/RepairerFile.cs @@ -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++) diff --git a/src/RefRepairer/Utils/MissingsResolvingData.cs b/src/RefRepairer/Utils/MissingsResolvingData.cs index 4ddedbb..a61bae8 100644 --- a/src/RefRepairer/Utils/MissingsResolvingData.cs +++ b/src/RefRepairer/Utils/MissingsResolvingData.cs @@ -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 diff --git a/src/Templates/EntityTemplate/Editor/EntityTemplateEditor.cs b/src/Templates/EntityTemplate/Editor/EntityTemplateEditor.cs index cf581e5..4161b6c 100644 --- a/src/Templates/EntityTemplate/Editor/EntityTemplateEditor.cs +++ b/src/Templates/EntityTemplate/Editor/EntityTemplateEditor.cs @@ -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)