mirror of
https://github.com/MirrorNetworking/Mirror.git
synced 2024-11-18 02:50:32 +00:00
grammar is hard
This commit is contained in:
parent
343971ad53
commit
12279ef0af
@ -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
|
||||
|
@ -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]);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user