diff --git a/SSLR/Assets/Scenes/LiviPlayground.unity b/SSLR/Assets/Scenes/LiviPlayground.unity index de9cabc..579b6fe 100644 --- a/SSLR/Assets/Scenes/LiviPlayground.unity +++ b/SSLR/Assets/Scenes/LiviPlayground.unity @@ -4789,7 +4789,6 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: 8c6fa011a2b389049b558ccdf6b38c38, type: 3} m_Name: m_EditorClassIdentifier: - npcObject: {fileID: 0} --- !u!114 &520849218 MonoBehaviour: m_ObjectHideFlags: 0 @@ -4851,13 +4850,13 @@ MonoBehaviour: npcBufferTime: 5 Seats: - SeatObject: {fileID: 9804464} - Available: 0 + Available: 1 - SeatObject: {fileID: 385635434} - Available: 0 + Available: 1 - SeatObject: {fileID: 720927106} - Available: 0 + Available: 1 - SeatObject: {fileID: 14863571} - Available: 0 + Available: 1 playerFree: 0 currentNpcs: [] despawnPoints: [] @@ -7404,18 +7403,6 @@ MonoBehaviour: m_StringArgument: m_BoolArgument: 1 m_CallState: 2 - - m_Target: {fileID: 0} - m_TargetAssemblyTypeName: UnityEngine.GameObject, UnityEngine - m_MethodName: - m_Mode: 1 - m_Arguments: - m_ObjectArgument: {fileID: 0} - m_ObjectArgumentAssemblyTypeName: - m_IntArgument: 0 - m_FloatArgument: 0 - m_StringArgument: - m_BoolArgument: 1 - m_CallState: 2 - m_Target: {fileID: 442984533} m_TargetAssemblyTypeName: UnityEngine.GameObject, UnityEngine m_MethodName: SetActive diff --git a/SSLR/Assets/Scripts/Backend.cs b/SSLR/Assets/Scripts/Backend.cs index 4c8b424..999d7f6 100644 --- a/SSLR/Assets/Scripts/Backend.cs +++ b/SSLR/Assets/Scripts/Backend.cs @@ -91,8 +91,13 @@ public class Backend : MonoBehaviour MenuButtons profilePage = FindObjectOfType(); if (profilePage != null) { + Debug.Log("Updating UI..."); profilePage.UpdateProfileUI(User); } + else + { + Debug.Log("MenuButtons not found"); + } } else { diff --git a/SSLR/Assets/Scripts/MenuButtons.cs b/SSLR/Assets/Scripts/MenuButtons.cs index 374829c..cf79690 100644 --- a/SSLR/Assets/Scripts/MenuButtons.cs +++ b/SSLR/Assets/Scripts/MenuButtons.cs @@ -33,6 +33,11 @@ public class MenuButtons : MonoBehaviour if (Backend.instance.Session != null) { Backend.instance.GetData(Backend.instance.Session.User.Id); + + if (Backend.instance.User != null) + { + UpdateProfileUI(Backend.instance.User); + } } else { @@ -45,12 +50,18 @@ public class MenuButtons : MonoBehaviour if (user != null) { var totalPeopleHelped = user.customersHelped + user.customersHelpedWrongly; - var accuracy = (user.customersHelped/totalPeopleHelped)*100; + var accuracy = totalPeopleHelped > 0? ((float)user.customersHelped/totalPeopleHelped)*100:0; + + Debug.Log($"Updating UI: {user.displayName}, Days Played: {user.daysPlayed}, Accuracy: {accuracy}%"); usernameText.text = user.displayName; daysPlayedText.text = user.daysPlayed.ToString(); peopleHelpedText.text = totalPeopleHelped.ToString(); - accuracyText.text = accuracy.ToString(); + accuracyText.text = accuracyText.ToString() + "%"; + } + else + { + Debug.LogError("User data is null. UI not updated"); } } diff --git a/SSLR/Assets/Scripts/NPCMovementRework.cs b/SSLR/Assets/Scripts/NPCMovementRework.cs index 9c5afa4..d7b7f04 100644 --- a/SSLR/Assets/Scripts/NPCMovementRework.cs +++ b/SSLR/Assets/Scripts/NPCMovementRework.cs @@ -78,10 +78,10 @@ public class NpcMovementRework : MonoBehaviour { i = Random.Range(0, NpcManager.instance.Seats.Length); seat = NpcManager.instance.Seats[i]; - + yield return new WaitForSeconds(2f); } - + seat.Available = false; var sittingPosition = seat.SeatObject.transform.position; sittingPosition.y = 0; agent.SetDestination(sittingPosition); @@ -95,6 +95,7 @@ public class NpcMovementRework : MonoBehaviour agent.SetDestination(gameObject.transform.position); animator.SetBool(IsSitting, true); gameObject.transform.rotation = seat.SeatObject.transform.rotation; + break; } yield return 0;