game: profile updates
This commit is contained in:
parent
66b36104b2
commit
aece60fa58
4 changed files with 25 additions and 21 deletions
|
@ -4789,7 +4789,6 @@ MonoBehaviour:
|
||||||
m_Script: {fileID: 11500000, guid: 8c6fa011a2b389049b558ccdf6b38c38, type: 3}
|
m_Script: {fileID: 11500000, guid: 8c6fa011a2b389049b558ccdf6b38c38, type: 3}
|
||||||
m_Name:
|
m_Name:
|
||||||
m_EditorClassIdentifier:
|
m_EditorClassIdentifier:
|
||||||
npcObject: {fileID: 0}
|
|
||||||
--- !u!114 &520849218
|
--- !u!114 &520849218
|
||||||
MonoBehaviour:
|
MonoBehaviour:
|
||||||
m_ObjectHideFlags: 0
|
m_ObjectHideFlags: 0
|
||||||
|
@ -4851,13 +4850,13 @@ MonoBehaviour:
|
||||||
npcBufferTime: 5
|
npcBufferTime: 5
|
||||||
Seats:
|
Seats:
|
||||||
- SeatObject: {fileID: 9804464}
|
- SeatObject: {fileID: 9804464}
|
||||||
Available: 0
|
Available: 1
|
||||||
- SeatObject: {fileID: 385635434}
|
- SeatObject: {fileID: 385635434}
|
||||||
Available: 0
|
Available: 1
|
||||||
- SeatObject: {fileID: 720927106}
|
- SeatObject: {fileID: 720927106}
|
||||||
Available: 0
|
Available: 1
|
||||||
- SeatObject: {fileID: 14863571}
|
- SeatObject: {fileID: 14863571}
|
||||||
Available: 0
|
Available: 1
|
||||||
playerFree: 0
|
playerFree: 0
|
||||||
currentNpcs: []
|
currentNpcs: []
|
||||||
despawnPoints: []
|
despawnPoints: []
|
||||||
|
@ -7404,18 +7403,6 @@ MonoBehaviour:
|
||||||
m_StringArgument:
|
m_StringArgument:
|
||||||
m_BoolArgument: 1
|
m_BoolArgument: 1
|
||||||
m_CallState: 2
|
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_Target: {fileID: 442984533}
|
||||||
m_TargetAssemblyTypeName: UnityEngine.GameObject, UnityEngine
|
m_TargetAssemblyTypeName: UnityEngine.GameObject, UnityEngine
|
||||||
m_MethodName: SetActive
|
m_MethodName: SetActive
|
||||||
|
|
|
@ -91,8 +91,13 @@ public class Backend : MonoBehaviour
|
||||||
MenuButtons profilePage = FindObjectOfType<MenuButtons>();
|
MenuButtons profilePage = FindObjectOfType<MenuButtons>();
|
||||||
if (profilePage != null)
|
if (profilePage != null)
|
||||||
{
|
{
|
||||||
|
Debug.Log("Updating UI...");
|
||||||
profilePage.UpdateProfileUI(User);
|
profilePage.UpdateProfileUI(User);
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Debug.Log("MenuButtons not found");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
|
@ -33,6 +33,11 @@ public class MenuButtons : MonoBehaviour
|
||||||
if (Backend.instance.Session != null)
|
if (Backend.instance.Session != null)
|
||||||
{
|
{
|
||||||
Backend.instance.GetData(Backend.instance.Session.User.Id);
|
Backend.instance.GetData(Backend.instance.Session.User.Id);
|
||||||
|
|
||||||
|
if (Backend.instance.User != null)
|
||||||
|
{
|
||||||
|
UpdateProfileUI(Backend.instance.User);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -45,12 +50,18 @@ public class MenuButtons : MonoBehaviour
|
||||||
if (user != null)
|
if (user != null)
|
||||||
{
|
{
|
||||||
var totalPeopleHelped = user.customersHelped + user.customersHelpedWrongly;
|
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;
|
usernameText.text = user.displayName;
|
||||||
daysPlayedText.text = user.daysPlayed.ToString();
|
daysPlayedText.text = user.daysPlayed.ToString();
|
||||||
peopleHelpedText.text = totalPeopleHelped.ToString();
|
peopleHelpedText.text = totalPeopleHelped.ToString();
|
||||||
accuracyText.text = accuracy.ToString();
|
accuracyText.text = accuracyText.ToString() + "%";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Debug.LogError("User data is null. UI not updated");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -78,10 +78,10 @@ public class NpcMovementRework : MonoBehaviour
|
||||||
{
|
{
|
||||||
i = Random.Range(0, NpcManager.instance.Seats.Length);
|
i = Random.Range(0, NpcManager.instance.Seats.Length);
|
||||||
seat = NpcManager.instance.Seats[i];
|
seat = NpcManager.instance.Seats[i];
|
||||||
|
yield return new WaitForSeconds(2f);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
seat.Available = false;
|
||||||
var sittingPosition = seat.SeatObject.transform.position;
|
var sittingPosition = seat.SeatObject.transform.position;
|
||||||
sittingPosition.y = 0;
|
sittingPosition.y = 0;
|
||||||
agent.SetDestination(sittingPosition);
|
agent.SetDestination(sittingPosition);
|
||||||
|
@ -95,6 +95,7 @@ public class NpcMovementRework : MonoBehaviour
|
||||||
agent.SetDestination(gameObject.transform.position);
|
agent.SetDestination(gameObject.transform.position);
|
||||||
animator.SetBool(IsSitting, true);
|
animator.SetBool(IsSitting, true);
|
||||||
gameObject.transform.rotation = seat.SeatObject.transform.rotation;
|
gameObject.transform.rotation = seat.SeatObject.transform.rotation;
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
yield return 0;
|
yield return 0;
|
||||||
|
|
Loading…
Add table
Reference in a new issue