style: naming convention

This commit is contained in:
Paul Pacheco 2019-04-06 07:41:57 -05:00
parent 76392a3a4e
commit adb16921c8

View File

@ -12,12 +12,12 @@ namespace Mirror
[CanEditMultipleObjects]
public class NetworkBehaviourInspector : Editor
{
bool m_Initialized;
protected List<string> m_SyncVarNames = new List<string>();
bool m_SyncsAnything;
bool[] m_ShowSyncLists;
bool initialized;
protected List<string> syncVarNames = new List<string>();
bool syncsAnything;
bool[] showSyncLists;
readonly GUIContent m_SyncVarIndicatorContent = new GUIContent("SyncVar", "This variable has been marked with the [SyncVar] attribute.");
readonly GUIContent syncVarIndicatorContent = new GUIContent("SyncVar", "This variable has been marked with the [SyncVar] attribute.");
internal virtual bool hideScriptField => false;
@ -53,7 +53,7 @@ bool SyncsAnything(Type scriptClass)
void Init(MonoScript script)
{
m_Initialized = true;
initialized = true;
Type scriptClass = script.GetClass();
// find public SyncVars to show (user doesn't want protected ones to be shown in inspector)
@ -62,7 +62,7 @@ void Init(MonoScript script)
Attribute[] fieldMarkers = (Attribute[])field.GetCustomAttributes(typeof(SyncVarAttribute), true);
if (fieldMarkers.Length > 0)
{
m_SyncVarNames.Add(field.Name);
syncVarNames.Add(field.Name);
}
}
@ -71,15 +71,15 @@ void Init(MonoScript script)
field.FieldType.BaseType.Name.Contains("SyncList"));
if (numSyncLists > 0)
{
m_ShowSyncLists = new bool[numSyncLists];
showSyncLists = new bool[numSyncLists];
}
m_SyncsAnything = SyncsAnything(scriptClass);
syncsAnything = SyncsAnything(scriptClass);
}
public override void OnInspectorGUI()
{
if (!m_Initialized)
if (!initialized)
{
serializedObject.Update();
SerializedProperty scriptProperty = serializedObject.FindProperty("m_Script");
@ -98,7 +98,7 @@ public override void OnInspectorGUI()
bool expanded = true;
while (property.NextVisible(expanded))
{
bool isSyncVar = m_SyncVarNames.Contains(property.name);
bool isSyncVar = syncVarNames.Contains(property.name);
if (property.propertyType == SerializedPropertyType.ObjectReference)
{
if (property.name == "m_Script")
@ -115,7 +115,7 @@ public override void OnInspectorGUI()
if (isSyncVar)
{
GUILayout.Label(m_SyncVarIndicatorContent, EditorStyles.miniLabel, GUILayout.Width(EditorStyles.miniLabel.CalcSize(m_SyncVarIndicatorContent).x));
GUILayout.Label(syncVarIndicatorContent, EditorStyles.miniLabel, GUILayout.Width(EditorStyles.miniLabel.CalcSize(syncVarIndicatorContent).x));
}
if (property.name == "m_Script")
@ -131,7 +131,7 @@ public override void OnInspectorGUI()
if (isSyncVar)
{
GUILayout.Label(m_SyncVarIndicatorContent, EditorStyles.miniLabel, GUILayout.Width(EditorStyles.miniLabel.CalcSize(m_SyncVarIndicatorContent).x));
GUILayout.Label(syncVarIndicatorContent, EditorStyles.miniLabel, GUILayout.Width(EditorStyles.miniLabel.CalcSize(syncVarIndicatorContent).x));
}
EditorGUILayout.EndHorizontal();
@ -147,8 +147,8 @@ public override void OnInspectorGUI()
{
if (field.FieldType.BaseType != null && field.FieldType.BaseType.Name.Contains("SyncList"))
{
m_ShowSyncLists[syncListIndex] = EditorGUILayout.Foldout(m_ShowSyncLists[syncListIndex], "SyncList " + field.Name + " [" + field.FieldType.Name + "]");
if (m_ShowSyncLists[syncListIndex])
showSyncLists[syncListIndex] = EditorGUILayout.Foldout(showSyncLists[syncListIndex], "SyncList " + field.Name + " [" + field.FieldType.Name + "]");
if (showSyncLists[syncListIndex])
{
EditorGUI.indentLevel += 1;
if (field.GetValue(serializedObject.targetObject) is IEnumerable synclist)
@ -172,7 +172,7 @@ public override void OnInspectorGUI()
// only show SyncInterval if we have an OnSerialize function.
// No need to show it if the class only has Cmds/Rpcs and no sync.
if (m_SyncsAnything)
if (syncsAnything)
{
NetworkBehaviour networkBehaviour = target as NetworkBehaviour;
if (networkBehaviour != null)