From 8c0bd9dca24e53148691bc4843873710d54369c8 Mon Sep 17 00:00:00 2001 From: vis2k Date: Tue, 21 Sep 2021 11:20:44 +0800 Subject: [PATCH] syntax & comments cleanup --- Assets/Mirror/Editor/InspectorHelper.cs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/Assets/Mirror/Editor/InspectorHelper.cs b/Assets/Mirror/Editor/InspectorHelper.cs index 40d2f1ef4..60a9ee4cc 100644 --- a/Assets/Mirror/Editor/InspectorHelper.cs +++ b/Assets/Mirror/Editor/InspectorHelper.cs @@ -7,12 +7,8 @@ namespace Mirror { public static class InspectorHelper { - /// - /// Gets all public and private fields for a type - /// - /// - /// Stops at this base type (exclusive) - /// + /// Gets all public and private fields for a type + // deepestBaseType: Stops at this base type (exclusive) public static IEnumerable GetAllFields(Type type, Type deepestBaseType) { const BindingFlags publicFields = BindingFlags.Public | BindingFlags.Instance; @@ -49,11 +45,13 @@ public static bool IsSyncVar(this FieldInfo field) object[] fieldMarkers = field.GetCustomAttributes(typeof(SyncVarAttribute), true); return fieldMarkers.Length > 0; } + public static bool IsSerializeField(this FieldInfo field) { object[] fieldMarkers = field.GetCustomAttributes(typeof(SerializeField), true); return fieldMarkers.Length > 0; } + public static bool IsVisibleField(this FieldInfo field) { return field.IsPublic || IsSerializeField(field); @@ -63,11 +61,13 @@ public static bool IsSyncObject(this FieldInfo field) { return typeof(SyncObject).IsAssignableFrom(field.FieldType); } + public static bool HasShowInInspector(this FieldInfo field) { object[] fieldMarkers = field.GetCustomAttributes(typeof(ShowInInspectorAttribute), true); return fieldMarkers.Length > 0; } + public static bool IsVisibleSyncObject(this FieldInfo field) { return field.IsPublic || HasShowInInspector(field);