public string GetPlayerNameFromClientID(int clientID) { #if UNITY_WEBGL && !UNITY_EDITOR string SessionDetailsString = GetSessionDetails(); #else string SessionDetailsString = SocketSim.GetSessionDetails(); #endif var Details = JsonUtility.FromJson <SessionDetails>(SessionDetailsString); var hasName = false; foreach (User user in Details.users) { if (clientID != user.student_id) { continue; } hasName = true; return(user.first_name + " " + user.last_name); } return("Client " + clientID); }
private void _GetModelsAndSessionDetails () { string SessionDetailsString; #if UNITY_WEBGL && !UNITY_EDITOR if (useEditorModelsList) { #if DEVELOPMENT_BUILD //in dev builds, don't clear models list Debug.LogWarning("Using editor's model list. You should turn off 'Use Editor Models List' off in NetworkManager."); #else //in non-dev build, ignore the flag. modelData.models.Clear(); #endif SessionDetailsString = SocketIOEditorSimulator.GetSessionDetails(); } else { modelData.models.Clear(); SessionDetailsString = SocketIOJSLib.GetSessionDetails(); } if (System.String.IsNullOrEmpty(SessionDetailsString)) { Debug.Log("Error: Details are null or empty."); } else { Debug.Log("SessionDetails: " + SessionDetailsString); var details = JsonUtility.FromJson<SessionDetails>(SessionDetailsString); if (useEditorModelsList) { #if DEVELOPMENT_BUILD //in dev builds, don't pass details to the models list if the flag is enabled. Debug.LogWarning("Using editor's model list. You should turn off 'Use Editor Models List' off in NetworkManager."); #else //in non-dev build, ignore the flag. modelData.models = details.assets; #endif } else { modelData.models = details.assets; } if (sessionName != null) { sessionName = details.session_name; buildName = details.build; } else { Debug.LogError("SessionName Ref in NetworkUpdateHandler's Text Component is missing from editor"); } } #endif }
public string GetPlayerNameFromClientID(int clientID) { #if UNITY_WEBGL && !UNITY_EDITOR string SessionDetailsString = SocketIOJSLib.GetSessionDetails(); #else string SessionDetailsString = SocketIOEditorSimulator.GetSessionDetails(); #endif var Details = JsonUtility.FromJson<SessionDetails>(SessionDetailsString); foreach (User user in Details.users) { if (clientID != user.student_id) { continue; } return user.first_name + " " + user.last_name; } return "Client " + clientID; }