grammar is hard

This commit is contained in:
vis2k 2021-09-25 16:21:34 +08:00
parent 343971ad53
commit 12279ef0af
3 changed files with 12 additions and 12 deletions

View File

@ -10,7 +10,7 @@ namespace Mirror
public class NetworkBehaviourInspector : Editor
{
bool syncsAnything;
SyncObjectCollectionDrawer syncObjectCollectionDrawer;
SyncObjectCollectionsDrawer syncObjectCollectionsDrawer;
// does this type sync anything? otherwise we don't need to show syncInterval
bool SyncsAnything(Type scriptClass)
@ -51,7 +51,7 @@ void OnEnable()
Type scriptClass = target.GetType();
syncObjectCollectionDrawer = new SyncObjectCollectionDrawer(serializedObject.targetObject);
syncObjectCollectionsDrawer = new SyncObjectCollectionsDrawer(serializedObject.targetObject);
syncsAnything = SyncsAnything(scriptClass);
}
@ -67,9 +67,9 @@ public override void OnInspectorGUI()
protected void DrawSyncObjectCollections()
{
// Need this check in case OnEnable returns early
if (syncObjectCollectionDrawer == null) return;
if (syncObjectCollectionsDrawer == null) return;
syncObjectCollectionDrawer.Draw();
syncObjectCollectionsDrawer.Draw();
}
// Draws SyncSettings if the NetworkBehaviour has anything to sync

View File

@ -22,34 +22,34 @@ public SyncObjectCollectionField(FieldInfo field)
}
}
public class SyncObjectCollectionDrawer
public class SyncObjectCollectionsDrawer
{
readonly UnityEngine.Object targetObject;
readonly List<SyncObjectCollectionField> enumerableSyncObjectFields;
readonly List<SyncObjectCollectionField> syncObjectCollectionFields;
public SyncObjectCollectionDrawer(UnityEngine.Object targetObject)
public SyncObjectCollectionsDrawer(UnityEngine.Object targetObject)
{
this.targetObject = targetObject;
enumerableSyncObjectFields = new List<SyncObjectCollectionField>();
syncObjectCollectionFields = new List<SyncObjectCollectionField>();
foreach (FieldInfo field in InspectorHelper.GetAllFields(targetObject.GetType(), typeof(NetworkBehaviour)))
{
if (field.ImplementsInterface<SyncObject>() && field.IsVisibleInInspector())
{
enumerableSyncObjectFields.Add(new SyncObjectCollectionField(field));
syncObjectCollectionFields.Add(new SyncObjectCollectionField(field));
}
}
}
public void Draw()
{
if (enumerableSyncObjectFields.Count == 0) { return; }
if (syncObjectCollectionFields.Count == 0) { return; }
EditorGUILayout.Space();
EditorGUILayout.LabelField("Sync Collections", EditorStyles.boldLabel);
for (int i = 0; i < enumerableSyncObjectFields.Count; i++)
for (int i = 0; i < syncObjectCollectionFields.Count; i++)
{
DrawSyncObjectCollection(enumerableSyncObjectFields[i]);
DrawSyncObjectCollection(syncObjectCollectionFields[i]);
}
}