diff --git a/src/Buildin/ScriptableObjectSystemWrapper.cs b/src/Buildin/ScriptableObjectSystemWrapper.cs index 4ca9c14..53f6fe9 100644 --- a/src/Buildin/ScriptableObjectSystemWrapper.cs +++ b/src/Buildin/ScriptableObjectSystemWrapper.cs @@ -1,4 +1,5 @@ -using UnityEngine; +using DCFApixels.DragonECS.Unity; +using UnityEngine; namespace DCFApixels.DragonECS { @@ -6,6 +7,7 @@ namespace DCFApixels.DragonECS [MetaColor(MetaColor.DragonCyan)] [MetaDescription("Wrapper for ScriptableObject systems")] [MetaID("F5A94C5F92015B4D9286E76809311AF4")] + [MetaGroup(EcsUnityConsts.PACK_GROUP, EcsConsts.OTHER_GROUP)] public class ScriptableObjectSystemWrapper : IEcsModule { public ScriptableObject system; diff --git a/src/Buildin/UnityComponent.cs b/src/Buildin/UnityComponent.cs index ccc2976..a6b97bc 100644 --- a/src/Buildin/UnityComponent.cs +++ b/src/Buildin/UnityComponent.cs @@ -7,6 +7,8 @@ using UnityEngine; namespace DCFApixels.DragonECS { + using static EcsConsts; + internal static class UnityComponentConsts { internal const string UNITY_COMPONENT_NAME = "UnityComponent"; @@ -17,8 +19,9 @@ namespace DCFApixels.DragonECS } [Serializable] [MetaColor(MetaColor.DragonCyan)] - [MetaGroup(EcsUnityConsts.PACK_GROUP, EcsConsts.COMPONENTS_GROUP)] - [MetaDescription(EcsConsts.AUTHOR, "Component-reference to Unity object for EcsPool.")] + [MetaGroup(EcsUnityConsts.PACK_GROUP, COMPONENTS_GROUP)] + [MetaDescription(AUTHOR, "Component-reference to Unity object for EcsPool.")] + [MetaID("734F667C9201B80F1913388C2A8BB689")] [MetaTags(MetaTags.ENGINE_MEMBER)] public struct UnityComponent : IEcsComponent, IEnumerable//IntelliSense hack where T : Component @@ -46,7 +49,7 @@ namespace DCFApixels.DragonECS #region Unity Component Templates [MetaID("13DAACF9910155DD27F822442987E0AE")] [MetaColor(MetaColor.DragonCyan)] - [MetaGroup(EcsUnityConsts.PACK_GROUP, EcsConsts.OTHER_GROUP)] + [MetaGroup(EcsUnityConsts.PACK_GROUP, OTHER_GROUP)] public abstract class UnityComponentTemplate : ComponentTemplateBase> where T : Component { public override string Name @@ -77,25 +80,25 @@ namespace DCFApixels.DragonECS [MetaTags(MetaTags.HIDDEN)] [MetaID("843B8EF991013F1BFD9133437E1AFE9C")] [MetaColor(MetaColor.DragonCyan)] - [MetaGroup(EcsUnityConsts.PACK_GROUP, EcsConsts.OTHER_GROUP)] + [MetaGroup(EcsUnityConsts.PACK_GROUP, TEMPLATES_GROUP)] public sealed class UnityComponentTransformTemplate : UnityComponentTemplate { } [Serializable] [MetaTags(MetaTags.HIDDEN)] [MetaID("9A4B8EF99101396C44BF789C3215E9A9")] [MetaColor(MetaColor.DragonCyan)] - [MetaGroup(EcsUnityConsts.PACK_GROUP, EcsConsts.OTHER_GROUP)] + [MetaGroup(EcsUnityConsts.PACK_GROUP, TEMPLATES_GROUP)] public sealed class UnityComponentRigitBodyInitializer : UnityComponentTemplate { } [Serializable] [MetaTags(MetaTags.HIDDEN)] [MetaID("52598EF991016655335F234F20F44526")] [MetaColor(MetaColor.DragonCyan)] - [MetaGroup(EcsUnityConsts.PACK_GROUP, EcsConsts.OTHER_GROUP)] + [MetaGroup(EcsUnityConsts.PACK_GROUP, TEMPLATES_GROUP)] public sealed class UnityComponentAnimatorInitializer : UnityComponentTemplate { } [Serializable] [MetaTags(MetaTags.HIDDEN)] [MetaID("AD658EF99101E8E38BB575D5353E7B1E")] [MetaColor(MetaColor.DragonCyan)] - [MetaGroup(EcsUnityConsts.PACK_GROUP, EcsConsts.OTHER_GROUP)] + [MetaGroup(EcsUnityConsts.PACK_GROUP, TEMPLATES_GROUP)] public sealed class UnityComponentCharacterControllerInitializer : UnityComponentTemplate { } #endregion @@ -104,7 +107,7 @@ namespace DCFApixels.DragonECS [MetaTags(MetaTags.HIDDEN)] [MetaID("6C6CA0F99101E80E013BCCCB5DA78FA5")] [MetaColor(MetaColor.DragonCyan)] - [MetaGroup(EcsUnityConsts.PACK_GROUP, EcsConsts.OTHER_GROUP)] + [MetaGroup(EcsUnityConsts.PACK_GROUP, TEMPLATES_GROUP)] public sealed class UnityComponentMeshRendererTemplate : UnityComponentTemplate { public override MetaGroup Group { get { return UnityComponentConsts.RenderGroup; } } @@ -113,7 +116,7 @@ namespace DCFApixels.DragonECS [MetaTags(MetaTags.HIDDEN)] [MetaID("5475A1F9910109A138F609268B697A62")] [MetaColor(MetaColor.DragonCyan)] - [MetaGroup(EcsUnityConsts.PACK_GROUP, EcsConsts.OTHER_GROUP)] + [MetaGroup(EcsUnityConsts.PACK_GROUP, TEMPLATES_GROUP)] public sealed class UnityComponentMeshFilterTemplate : UnityComponentTemplate { public override MetaGroup Group { get { return UnityComponentConsts.RenderGroup; } } @@ -122,7 +125,7 @@ namespace DCFApixels.DragonECS [MetaTags(MetaTags.HIDDEN)] [MetaID("2C13A2F99101FAA3EA21BD351BF3B169")] [MetaColor(MetaColor.DragonCyan)] - [MetaGroup(EcsUnityConsts.PACK_GROUP, EcsConsts.OTHER_GROUP)] + [MetaGroup(EcsUnityConsts.PACK_GROUP, TEMPLATES_GROUP)] public sealed class UnityComponentSkinnedMeshRendererTemplate : UnityComponentTemplate { public override MetaGroup Group { get { return UnityComponentConsts.RenderGroup; } } @@ -131,7 +134,7 @@ namespace DCFApixels.DragonECS [MetaTags(MetaTags.HIDDEN)] [MetaID("8B57A1F991016B2E1FC57D16F2D20A64")] [MetaColor(MetaColor.DragonCyan)] - [MetaGroup(EcsUnityConsts.PACK_GROUP, EcsConsts.OTHER_GROUP)] + [MetaGroup(EcsUnityConsts.PACK_GROUP, TEMPLATES_GROUP)] public sealed class UnityComponentSpriteRendererTemplate : UnityComponentTemplate { public override MetaGroup Group { get { return UnityComponentConsts.RenderGroup; } } @@ -143,7 +146,7 @@ namespace DCFApixels.DragonECS [MetaTags(MetaTags.HIDDEN)] [MetaID("557F8EF9910132FE990CF50CBF368412")] [MetaColor(MetaColor.DragonCyan)] - [MetaGroup(EcsUnityConsts.PACK_GROUP, EcsConsts.OTHER_GROUP)] + [MetaGroup(EcsUnityConsts.PACK_GROUP, TEMPLATES_GROUP)] public sealed class UnityComponentColliderTemplate : UnityComponentTemplate { public override MetaGroup Group { get { return UnityComponentConsts.ColliderGroup; } } @@ -152,7 +155,7 @@ namespace DCFApixels.DragonECS [MetaTags(MetaTags.HIDDEN)] [MetaID("43669CF99101E94AB9EC19DC8EA3878B")] [MetaColor(MetaColor.DragonCyan)] - [MetaGroup(EcsUnityConsts.PACK_GROUP, EcsConsts.OTHER_GROUP)] + [MetaGroup(EcsUnityConsts.PACK_GROUP, TEMPLATES_GROUP)] public sealed class UnityComponentBoxColliderTemplate : UnityComponentTemplate { public override MetaGroup Group { get { return UnityComponentConsts.ColliderGroup; } } @@ -161,7 +164,7 @@ namespace DCFApixels.DragonECS [MetaTags(MetaTags.HIDDEN)] [MetaID("749F9CF991017792E288D4E3B5BFE340")] [MetaColor(MetaColor.DragonCyan)] - [MetaGroup(EcsUnityConsts.PACK_GROUP, EcsConsts.OTHER_GROUP)] + [MetaGroup(EcsUnityConsts.PACK_GROUP, TEMPLATES_GROUP)] public sealed class UnityComponentSphereColliderTemplate : UnityComponentTemplate { public override MetaGroup Group { get { return UnityComponentConsts.ColliderGroup; } } @@ -170,7 +173,7 @@ namespace DCFApixels.DragonECS [MetaTags(MetaTags.HIDDEN)] [MetaID("72B09CF99101A33EBC4410B0FD8375E0")] [MetaColor(MetaColor.DragonCyan)] - [MetaGroup(EcsUnityConsts.PACK_GROUP, EcsConsts.OTHER_GROUP)] + [MetaGroup(EcsUnityConsts.PACK_GROUP, TEMPLATES_GROUP)] public sealed class UnityComponentCapsuleColliderTemplate : UnityComponentTemplate { public override MetaGroup Group { get { return UnityComponentConsts.ColliderGroup; } } @@ -179,7 +182,7 @@ namespace DCFApixels.DragonECS [MetaTags(MetaTags.HIDDEN)] [MetaID("3BBC9CF99101F7C00989D2E55A40EF1B")] [MetaColor(MetaColor.DragonCyan)] - [MetaGroup(EcsUnityConsts.PACK_GROUP, EcsConsts.OTHER_GROUP)] + [MetaGroup(EcsUnityConsts.PACK_GROUP, TEMPLATES_GROUP)] public sealed class UnityComponentMeshColliderTemplate : UnityComponentTemplate { public override MetaGroup Group { get { return UnityComponentConsts.ColliderGroup; } } @@ -191,7 +194,7 @@ namespace DCFApixels.DragonECS [MetaTags(MetaTags.HIDDEN)] [MetaID("1AC79CF99101C4279852BB6AE12DC61B")] [MetaColor(MetaColor.DragonCyan)] - [MetaGroup(EcsUnityConsts.PACK_GROUP, EcsConsts.OTHER_GROUP)] + [MetaGroup(EcsUnityConsts.PACK_GROUP, TEMPLATES_GROUP)] public sealed class UnityComponentJointTemplate : UnityComponentTemplate { public override MetaGroup Group { get { return UnityComponentConsts.JointGroup; } } @@ -200,7 +203,7 @@ namespace DCFApixels.DragonECS [MetaTags(MetaTags.HIDDEN)] [MetaID("E3D99CF991016428C6688672052C6F4E")] [MetaColor(MetaColor.DragonCyan)] - [MetaGroup(EcsUnityConsts.PACK_GROUP, EcsConsts.OTHER_GROUP)] + [MetaGroup(EcsUnityConsts.PACK_GROUP, TEMPLATES_GROUP)] public sealed class UnityComponentFixedJointTemplate : UnityComponentTemplate { public override MetaGroup Group { get { return UnityComponentConsts.JointGroup; } } @@ -209,7 +212,7 @@ namespace DCFApixels.DragonECS [MetaTags(MetaTags.HIDDEN)] [MetaID("7BE59CF99101322AE307229E1466B225")] [MetaColor(MetaColor.DragonCyan)] - [MetaGroup(EcsUnityConsts.PACK_GROUP, EcsConsts.OTHER_GROUP)] + [MetaGroup(EcsUnityConsts.PACK_GROUP, TEMPLATES_GROUP)] public sealed class UnityComponentCharacterJointTemplate : UnityComponentTemplate { public override MetaGroup Group { get { return UnityComponentConsts.JointGroup; } } @@ -218,7 +221,7 @@ namespace DCFApixels.DragonECS [MetaTags(MetaTags.HIDDEN)] [MetaID("FBF29CF99101EE07543CFF460854B1F6")] [MetaColor(MetaColor.DragonCyan)] - [MetaGroup(EcsUnityConsts.PACK_GROUP, EcsConsts.OTHER_GROUP)] + [MetaGroup(EcsUnityConsts.PACK_GROUP, TEMPLATES_GROUP)] public sealed class UnityComponentConfigurableJointTemplate : UnityComponentTemplate { public override MetaGroup Group { get { return UnityComponentConsts.JointGroup; } } diff --git a/src/Connectors/AutoEntityCreator.cs b/src/Connectors/AutoEntityCreator.cs index 919f641..ba9eb46 100644 --- a/src/Connectors/AutoEntityCreator.cs +++ b/src/Connectors/AutoEntityCreator.cs @@ -5,7 +5,7 @@ namespace DCFApixels.DragonECS { [DisallowMultipleComponent] [AddComponentMenu(EcsConsts.FRAMEWORK_NAME + "/" + nameof(AutoEntityCreator), 30)] - [MetaColor(MetaColor.Cyan)] + [MetaColor(MetaColor.DragonCyan)] [MetaGroup(EcsUnityConsts.PACK_GROUP, EcsUnityConsts.ENTITY_BUILDING_GROUP)] [MetaDescription(EcsConsts.AUTHOR, nameof(MonoBehaviour) + ". Automatically creates an entity in the selected world and connects it to EcsEntityConnect.")] public class AutoEntityCreator : MonoBehaviour diff --git a/src/Connectors/EcsEntityConnect.cs b/src/Connectors/EcsEntityConnect.cs index 99ce7c9..7ad3571 100644 --- a/src/Connectors/EcsEntityConnect.cs +++ b/src/Connectors/EcsEntityConnect.cs @@ -57,7 +57,7 @@ namespace DCFApixels.DragonECS [SelectionBase] [DisallowMultipleComponent] [AddComponentMenu(EcsConsts.FRAMEWORK_NAME + "/" + nameof(EcsEntityConnect), 30)] - [MetaColor(MetaColor.Cyan)] + [MetaColor(MetaColor.DragonCyan)] [MetaGroup(EcsUnityConsts.PACK_GROUP, EcsUnityConsts.ENTITY_BUILDING_GROUP)] [MetaDescription(EcsConsts.AUTHOR, nameof(MonoBehaviour) + ". Responsible for connecting the entity and GameObject using the EcsEntityConnect.ConnectWith method.")] public class EcsEntityConnect : MonoBehaviour diff --git a/src/Internal/Editor/EcsGUI.cs b/src/Internal/Editor/EcsGUI.cs index 9797a98..1c73465 100644 --- a/src/Internal/Editor/EcsGUI.cs +++ b/src/Internal/Editor/EcsGUI.cs @@ -984,6 +984,22 @@ namespace DCFApixels.DragonECS.Unity.Editors { EcsGUI.ScriptAssetButton(GUILayoutUtility.GetRect(UnityEditorUtility.GetLabelTemp(), EditorStyles.miniButton, options), script); } + + + public static void CopyMetaIDButton(string metaID, params GUILayoutOption[] options) + { + Rect r = GUILayoutUtility.GetRect(UnityEditorUtility.GetLabelTemp(), EditorStyles.miniButton, options); + var current = Event.current; + var hover = IconHoverScan(r, current); + using (new ColorScope(new Color(1f, 1f, 1f, hover ? 1f : 0.8f))) + { + DrawIcon(r, Icons.Instance.MetaIDIcon, hover ? 1f : 2f, metaID); + if (hover && current.type == EventType.MouseUp) + { + GUIUtility.systemCopyBuffer = metaID; + } + } + } public static bool IconButton(Texture icon, params GUILayoutOption[] options) { bool result = GUILayout.Button(UnityEditorUtility.GetLabel(string.Empty), options); diff --git a/src/Internal/Icons/Icons.cs b/src/Internal/Icons/Icons.cs index fc98d9f..6c7b2ef 100644 --- a/src/Internal/Icons/Icons.cs +++ b/src/Internal/Icons/Icons.cs @@ -10,6 +10,8 @@ namespace DCFApixels.DragonECS.Unity.Internal private Texture _helpIcon = null; [SerializeField] private Texture _fileIcon = null; + [SerializeField] + private Texture _metaIDIcon = null; [SerializeField] private Texture _errorIcon = null; @@ -42,6 +44,7 @@ namespace DCFApixels.DragonECS.Unity.Internal internal Texture HelpIcon { get { return _helpIcon; } } internal Texture FileIcon { get { return _fileIcon; } } + internal Texture MetaIDIcon { get { return _metaIDIcon; } } internal Texture ErrorIcon { get { return _errorIcon; } } internal Texture WarningIcon { get { return _warningIcon; } } diff --git a/src/Internal/Icons/Icons.cs.meta b/src/Internal/Icons/Icons.cs.meta index b9c36ee..8ef087a 100644 --- a/src/Internal/Icons/Icons.cs.meta +++ b/src/Internal/Icons/Icons.cs.meta @@ -5,20 +5,21 @@ MonoImporter: serializedVersion: 2 defaultReferences: - _helpIcon: {fileID: 2800000, guid: e135cf23a5d53ce48a75e163b41e39d5, type: 3} + - _fileIcon: {fileID: 2800000, guid: 4f1ca6aa9d407844485856184c785946, type: 3} + - _metaIDIcon: {fileID: 2800000, guid: d3c6215cfdc36cb448661398160560a7, type: 3} + - _errorIcon: {fileID: 2800000, guid: c67e8a1d6cb0e904590c7847368fe794, type: 3} + - _warningIcon: {fileID: 2800000, guid: 223d96e24d4b49f468b628cf9839584c, type: 3} + - _passIcon: {fileID: 2800000, guid: 0df5856dbbe53494aae23b959ca05ecc, type: 3} + - _unlinkIcon: {fileID: 2800000, guid: 5baead89a941e034e9f44d63617d3246, type: 3} + - _searchIcon: {fileID: 2800000, guid: 239e73d04c7ba4649bc4cc10e70e62e5, type: 3} - _closeIcon: {fileID: 2800000, guid: 8a708e50662813d4a99c107e6431a60b, type: 3} - _closeIconOn: {fileID: 2800000, guid: 6a1d402595b00c24db2ba647fed93a5c, type: 3} - - _unlinkIcon: {fileID: 2800000, guid: 5baead89a941e034e9f44d63617d3246, type: 3} - _auotsetIcon: {fileID: 2800000, guid: d01e651682f48b548b597714f47e14b9, type: 3} - _auotsetCascadeIcon: {fileID: 2800000, guid: 8f9fb2a8877577940971d81a98aeaaaa, type: 3} - - _searchIcon: {fileID: 2800000, guid: 239e73d04c7ba4649bc4cc10e70e62e5, type: 3} - _visibilityIconOn: {fileID: 2800000, guid: 9ce9d719a106be04fa4cf0c369c61e1c, type: 3} - _visibilityIconOff: {fileID: 2800000, guid: 1f25a5ca611092642a8ee4e08fafcd43, type: 3} - _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/MetaIDIcon.png b/src/Internal/Icons/MetaIDIcon.png new file mode 100644 index 0000000..9fef345 Binary files /dev/null and b/src/Internal/Icons/MetaIDIcon.png differ diff --git a/src/Internal/Icons/MetaIDIcon.png.meta b/src/Internal/Icons/MetaIDIcon.png.meta new file mode 100644 index 0000000..6ab9e41 --- /dev/null +++ b/src/Internal/Icons/MetaIDIcon.png.meta @@ -0,0 +1,122 @@ +fileFormatVersion: 2 +guid: d3c6215cfdc36cb448661398160560a7 +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 c249e9e..7297b8d 100644 --- a/src/Internal/Icons/Resources/Icons.asset +++ b/src/Internal/Icons/Resources/Icons.asset @@ -13,17 +13,18 @@ MonoBehaviour: m_Name: Icons m_EditorClassIdentifier: _helpIcon: {fileID: 2800000, guid: e135cf23a5d53ce48a75e163b41e39d5, type: 3} + _fileIcon: {fileID: 2800000, guid: 4f1ca6aa9d407844485856184c785946, type: 3} + _metaIDIcon: {fileID: 2800000, guid: d3c6215cfdc36cb448661398160560a7, type: 3} + _errorIcon: {fileID: 2800000, guid: c67e8a1d6cb0e904590c7847368fe794, type: 3} + _warningIcon: {fileID: 2800000, guid: 223d96e24d4b49f468b628cf9839584c, type: 3} + _passIcon: {fileID: 2800000, guid: 0df5856dbbe53494aae23b959ca05ecc, type: 3} + _unlinkIcon: {fileID: 2800000, guid: 5baead89a941e034e9f44d63617d3246, type: 3} + _searchIcon: {fileID: 2800000, guid: 239e73d04c7ba4649bc4cc10e70e62e5, type: 3} _closeIcon: {fileID: 2800000, guid: 8a708e50662813d4a99c107e6431a60b, type: 3} _closeIconOn: {fileID: 2800000, guid: 6a1d402595b00c24db2ba647fed93a5c, type: 3} - _unlinkIcon: {fileID: 2800000, guid: 5baead89a941e034e9f44d63617d3246, type: 3} _auotsetIcon: {fileID: 2800000, guid: d01e651682f48b548b597714f47e14b9, type: 3} _auotsetCascadeIcon: {fileID: 2800000, guid: 8f9fb2a8877577940971d81a98aeaaaa, type: 3} - _searchIcon: {fileID: 2800000, guid: 239e73d04c7ba4649bc4cc10e70e62e5, type: 3} _visibilityIconOn: {fileID: 2800000, guid: 9ce9d719a106be04fa4cf0c369c61e1c, type: 3} _visibilityIconOff: {fileID: 2800000, guid: 1f25a5ca611092642a8ee4e08fafcd43, type: 3} _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/ScriptsCache.cs b/src/Internal/ScriptsCache.cs index 22ed304..2eb0aba 100644 --- a/src/Internal/ScriptsCache.cs +++ b/src/Internal/ScriptsCache.cs @@ -121,7 +121,7 @@ namespace DCFApixels.DragonECS.Unity.Editors #endregion #region Get - public static bool TryGetScriptAsset(Type meta, out MonoScript script) { return TryGetScriptAsset(meta.GetMeta(), out script); } + public static bool TryGetScriptAsset(Type type, out MonoScript script) { return TryGetScriptAsset(type.ToMeta(), out script); } public static bool TryGetScriptAsset(TypeMeta meta, out MonoScript script) { int uniqueID = meta.GetHashCode(); diff --git a/src/Templates/EntityTemplate/Templates/MonoEntityTemplate.cs b/src/Templates/EntityTemplate/Templates/MonoEntityTemplate.cs index 0b8ca84..f1f8e3f 100644 --- a/src/Templates/EntityTemplate/Templates/MonoEntityTemplate.cs +++ b/src/Templates/EntityTemplate/Templates/MonoEntityTemplate.cs @@ -12,7 +12,7 @@ namespace DCFApixels.DragonECS [DisallowMultipleComponent] [AddComponentMenu(EcsConsts.FRAMEWORK_NAME + "/" + nameof(MonoEntityTemplate), 30)] - [MetaColor(MetaColor.Cyan)] + [MetaColor(MetaColor.DragonCyan)] [MetaGroup(EcsUnityConsts.PACK_GROUP, EcsUnityConsts.ENTITY_BUILDING_GROUP)] [MetaDescription(EcsConsts.AUTHOR, nameof(MonoBehaviour) + " implementation of an entity template. Templates are a set of components that are applied to entities.")] public class MonoEntityTemplate : MonoEntityTemplateBase, ITemplateInternal diff --git a/src/Templates/EntityTemplate/Templates/ScriptableEntityTemplate.cs b/src/Templates/EntityTemplate/Templates/ScriptableEntityTemplate.cs index 042471c..40a3cbc 100644 --- a/src/Templates/EntityTemplate/Templates/ScriptableEntityTemplate.cs +++ b/src/Templates/EntityTemplate/Templates/ScriptableEntityTemplate.cs @@ -10,7 +10,7 @@ namespace DCFApixels.DragonECS public abstract void Apply(short worldID, int entityID); } - [MetaColor(MetaColor.Cyan)] + [MetaColor(MetaColor.DragonCyan)] [MetaGroup(EcsUnityConsts.PACK_GROUP, EcsUnityConsts.ENTITY_BUILDING_GROUP)] [MetaDescription(EcsConsts.AUTHOR, nameof(ScriptableObject) + " implementation of an entity template. Templates are a set of components that are applied to entities.")] [CreateAssetMenu(fileName = nameof(ScriptableEntityTemplate), menuName = EcsConsts.FRAMEWORK_NAME + "/" + nameof(ScriptableEntityTemplate), order = 1)] diff --git a/src/Tools/DragonDocs/Editors/DragonDocsPrefs.cs b/src/Tools/DragonDocs/Editors/DragonDocsPrefs.cs index dbf50b3..9bedab6 100644 --- a/src/Tools/DragonDocs/Editors/DragonDocsPrefs.cs +++ b/src/Tools/DragonDocs/Editors/DragonDocsPrefs.cs @@ -126,7 +126,8 @@ namespace DCFApixels.DragonECS.Unity.Docs.Editors m_docs = docs; if (m_isExpands == null || m_isExpands.Length != docs.Metas.Length) { - Array.Resize(ref m_isExpands, docs.Metas.Length); + int size = docs.Metas.Length; + Array.Resize(ref m_isExpands, size <= 0 ? 1 : size); m_isExpands[0] = true; } _isInitInfos = false; diff --git a/src/Tools/DragonDocs/Editors/DragonDocsWindow.cs b/src/Tools/DragonDocs/Editors/DragonDocsWindow.cs index 8dae1de..394d288 100644 --- a/src/Tools/DragonDocs/Editors/DragonDocsWindow.cs +++ b/src/Tools/DragonDocs/Editors/DragonDocsWindow.cs @@ -1,6 +1,7 @@ #if UNITY_EDITOR using DCFApixels.DragonECS.Unity.Editors; using DCFApixels.DragonECS.Unity.Internal; +using System; using UnityEditor; using UnityEngine; @@ -109,7 +110,10 @@ namespace DCFApixels.DragonECS.Unity.Docs.Editors GUI.enabled = true; - GUILayout.Label(infos[_selectedIndex].Path); + if (_selectedIndex >= 0 && _selectedIndex < infos.Length) + { + GUILayout.Label(infos[_selectedIndex].Path); + } } private void DrawToolbar() @@ -255,10 +259,12 @@ namespace DCFApixels.DragonECS.Unity.Docs.Editors using (EcsGUI.Layout.BeginHorizontal()) { GUILayout.TextArea(IsUseCustomNames ? meta.Name : meta.TypeName, EditorStyles.boldLabel, GUILayout.ExpandWidth(false)); + if (meta.TryGetSourceType(out System.Type targetType) && ScriptsCache.TryGetScriptAsset(targetType, out MonoScript script)) { - EcsGUI.Layout.ScriptAssetButton(script, GUILayout.Width(19f)); + EcsGUI.Layout.ScriptAssetButton(script, GUILayout.Width(18f)); } + if (meta.IsCustomName) { using (EcsGUI.SetAlpha(0.64f)) using (EcsGUI.SetAlignment(GUI.skin.label, TextAnchor.MiddleRight)) @@ -266,48 +272,47 @@ namespace DCFApixels.DragonECS.Unity.Docs.Editors GUILayout.TextArea(IsUseCustomNames ? meta.TypeName : meta.Name, GUI.skin.label); } } + else + { + GUILayout.Label(""); + } + + + if (string.IsNullOrEmpty(meta.MetaID) == false) + { + GUILayout.Space(-EditorGUIUtility.standardVerticalSpacing); + EcsGUI.Layout.CopyMetaIDButton(meta.MetaID, GUILayout.Width(18f)); + } } - //draw description block - Rect lastRect = GUILayoutUtility.GetLastRect(); - if (string.IsNullOrEmpty(meta.Description) == false) + void DrawLine() { - Rect lineRect = lastRect; + Rect lineRect = GUILayoutUtility.GetLastRect(); ; lineRect.yMin = lineRect.yMax; lineRect.yMax += 1f; lineRect.y += 5f; EditorGUI.DrawRect(lineRect, new Color(1, 1, 1, 0.12f)); + } + + bool isWithMetaID = string.IsNullOrEmpty(meta.MetaID) == false; + + //draw description block + if (string.IsNullOrEmpty(meta.Description) == false) + { + DrawLine(); GUILayout.Space(7f); GUILayout.TextArea(meta.Description, EditorStyles.wordWrappedLabel); } - //footer line - if (string.IsNullOrEmpty(meta.MetaID) == false || meta._tags.Length > 0) - { - Rect lineRect = GUILayoutUtility.GetLastRect(); - lineRect.yMin = lineRect.yMax; - lineRect.yMax += 1f; - lineRect.y += 5f; - EditorGUI.DrawRect(lineRect, new Color(1, 1, 1, 0.12f)); - - GUILayout.Space(3f); - } - - //draw metaid block - if (string.IsNullOrEmpty(meta.MetaID) == false) - { - using (EcsGUI.SetAlpha(0.5f)) - { - GUILayout.TextArea(meta.MetaID, EditorStyles.wordWrappedMiniLabel); - } - //EditorGUI.DrawRect(lineRect, new Color(1, 1, 1, 0.12f)); - } - //draw tags block if (meta._tags.Length > 0) { + DrawLine(); + + GUILayout.Space(3f); + var tagsstring = string.Join(',', meta._tags); using (EcsGUI.SetAlpha(0.5f)) { @@ -333,6 +338,10 @@ namespace DCFApixels.DragonECS.Unity.Docs.Editors for (int i = 0; i < infos.Length; i++) { + if (infos.Length > _searchingHideGroupMap.Length) + { + Array.Resize(ref _searchingHideGroupMap, infos.Length); + } if (_searchingHideGroupMap[i]) { continue; } var groupInfo = infos[i];