syntax & comments cleanup

This commit is contained in:
vis2k 2021-09-21 11:20:44 +08:00
parent 7aebf4cb5a
commit 8c0bd9dca2

View File

@ -7,12 +7,8 @@ namespace Mirror
{
public static class InspectorHelper
{
/// <summary>
/// Gets all public and private fields for a type
/// </summary>
/// <param name="type"></param>
/// <param name="deepestBaseType">Stops at this base type (exclusive)</param>
/// <returns></returns>
/// <summary>Gets all public and private fields for a type</summary>
// deepestBaseType: Stops at this base type (exclusive)
public static IEnumerable<FieldInfo> 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);