From 614a3a4f19a665903141dfbe40b7bc503b0d0b7e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Albin=20Cor=C3=A9n?= <2108U9@gmail.com> Date: Fri, 30 Mar 2018 04:06:49 +0200 Subject: [PATCH] Improved MLAPI Inspector UI --- MLAPI/MonoBehaviours/Core/NetworkedBehaviour.cs | 2 +- MLAPI/MonoBehaviours/Core/NetworkedObject.cs | 1 + MLAPI/MonoBehaviours/Core/NetworkingManager.cs | 4 +++- MLAPI/MonoBehaviours/Core/TrackedObject.cs | 1 + MLAPI/MonoBehaviours/Prototyping/NetworkedAnimator.cs | 1 + MLAPI/MonoBehaviours/Prototyping/NetworkedNavMeshAgent.cs | 1 + MLAPI/MonoBehaviours/Prototyping/NetworkedTransform.cs | 1 + 7 files changed, 9 insertions(+), 2 deletions(-) diff --git a/MLAPI/MonoBehaviours/Core/NetworkedBehaviour.cs b/MLAPI/MonoBehaviours/Core/NetworkedBehaviour.cs index 67ad27a..33fc8d0 100644 --- a/MLAPI/MonoBehaviours/Core/NetworkedBehaviour.cs +++ b/MLAPI/MonoBehaviours/Core/NetworkedBehaviour.cs @@ -159,7 +159,7 @@ namespace MLAPI private List syncedFieldValues = new List(); private List syncedVarHooks = new List(); //A dirty field is a field that's not synced. - public bool[] dirtyFields; + private bool[] dirtyFields; internal void SyncVarInit() { FieldInfo[] sortedFields = GetType().GetFields(BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.FlattenHierarchy | BindingFlags.Instance).OrderBy(x => x.Name).ToArray(); diff --git a/MLAPI/MonoBehaviours/Core/NetworkedObject.cs b/MLAPI/MonoBehaviours/Core/NetworkedObject.cs index 2e18ae7..ab48ca2 100644 --- a/MLAPI/MonoBehaviours/Core/NetworkedObject.cs +++ b/MLAPI/MonoBehaviours/Core/NetworkedObject.cs @@ -5,6 +5,7 @@ using UnityEngine; namespace MLAPI { + [AddComponentMenu("MLAPI/NetworkedObject", -99)] public class NetworkedObject : MonoBehaviour { [HideInInspector] diff --git a/MLAPI/MonoBehaviours/Core/NetworkingManager.cs b/MLAPI/MonoBehaviours/Core/NetworkingManager.cs index 7d6ff02..bb8f334 100644 --- a/MLAPI/MonoBehaviours/Core/NetworkingManager.cs +++ b/MLAPI/MonoBehaviours/Core/NetworkingManager.cs @@ -10,6 +10,7 @@ using System.Linq; namespace MLAPI { + [AddComponentMenu("MLAPI/NetworkingManager", -100)] public class NetworkingManager : MonoBehaviour { public static float NetworkTime; @@ -19,6 +20,7 @@ namespace MLAPI public GameObject DefaultPlayerPrefab; public static NetworkingManager singleton; //Client only, what my connectionId is on the server + [HideInInspector] public int MyClientId; internal Dictionary connectedClients; public Dictionary ConnectedClients @@ -41,7 +43,7 @@ namespace MLAPI private bool isListening; private byte[] messageBuffer; internal int serverClientId; - + [HideInInspector] public bool IsClientConnected; public Action OnClientConnectedCallback = null; public Action OnClientDisconnectCallback = null; diff --git a/MLAPI/MonoBehaviours/Core/TrackedObject.cs b/MLAPI/MonoBehaviours/Core/TrackedObject.cs index adca7fd..8d06eb7 100644 --- a/MLAPI/MonoBehaviours/Core/TrackedObject.cs +++ b/MLAPI/MonoBehaviours/Core/TrackedObject.cs @@ -7,6 +7,7 @@ namespace MLAPI.MonoBehaviours.Core { //Based on: https://twotenpvp.github.io/lag-compensation-in-unity.html //Modified to be used with latency rather than fixed frames and subframes. Thus it will be less accrurate but more modular. + [AddComponentMenu("MLAPI/TrackedObject", -98)] public class TrackedObject : MonoBehaviour { internal Dictionary FrameData = new Dictionary(); diff --git a/MLAPI/MonoBehaviours/Prototyping/NetworkedAnimator.cs b/MLAPI/MonoBehaviours/Prototyping/NetworkedAnimator.cs index 150b8b1..1171335 100644 --- a/MLAPI/MonoBehaviours/Prototyping/NetworkedAnimator.cs +++ b/MLAPI/MonoBehaviours/Prototyping/NetworkedAnimator.cs @@ -4,6 +4,7 @@ using UnityEngine; namespace MLAPI.MonoBehaviours.Prototyping { + [AddComponentMenu("MLAPI/NetworkedAnimator")] public class NetworkedAnimator : NetworkedBehaviour { public bool EnableProximity = false; diff --git a/MLAPI/MonoBehaviours/Prototyping/NetworkedNavMeshAgent.cs b/MLAPI/MonoBehaviours/Prototyping/NetworkedNavMeshAgent.cs index d4fdaca..0a22644 100644 --- a/MLAPI/MonoBehaviours/Prototyping/NetworkedNavMeshAgent.cs +++ b/MLAPI/MonoBehaviours/Prototyping/NetworkedNavMeshAgent.cs @@ -5,6 +5,7 @@ using UnityEngine.AI; namespace MLAPI.MonoBehaviours.Prototyping { + [AddComponentMenu("MLAPI/NetworkedNavMeshAgent")] public class NetworkedNavMeshAgent : NetworkedBehaviour { private NavMeshAgent agent; diff --git a/MLAPI/MonoBehaviours/Prototyping/NetworkedTransform.cs b/MLAPI/MonoBehaviours/Prototyping/NetworkedTransform.cs index 2cedd38..c3d29cc 100644 --- a/MLAPI/MonoBehaviours/Prototyping/NetworkedTransform.cs +++ b/MLAPI/MonoBehaviours/Prototyping/NetworkedTransform.cs @@ -3,6 +3,7 @@ using UnityEngine; namespace MLAPI.MonoBehaviours.Prototyping { + [AddComponentMenu("MLAPI/NetworkedTransform")] public class NetworkedTransform : NetworkedBehaviour { [Range(0f, 120f)]