game: profile updates

This commit is contained in:
kookiekenobi 2025-02-15 23:01:04 +08:00
parent 66b36104b2
commit aece60fa58
4 changed files with 25 additions and 21 deletions

View file

@ -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

View file

@ -91,8 +91,13 @@ public class Backend : MonoBehaviour
MenuButtons profilePage = FindObjectOfType<MenuButtons>();
if (profilePage != null)
{
Debug.Log("Updating UI...");
profilePage.UpdateProfileUI(User);
}
else
{
Debug.Log("MenuButtons not found");
}
}
else
{

View file

@ -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");
}
}

View file

@ -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;