Documentation for the Unity C# Library
Loading...
Searching...
No Matches
GetUserDisplay.cs
Go to the documentation of this file.
1using UnityEngine;
2using UnityEngine.UI;
3using PixoVR.Apex;
5{
6 public Text FirstName;
7 public Text LastName;
8 public Text Email;
9 public Text UserId;
10 public Button GetUserButton;
11
12 // Start is called before the first frame update
13 void Start()
14 {
15 ApexSystem.Instance.OnGetUserSuccess.AddListener(OnGetUserSuccess);
16 ApexSystem.Instance.OnGetUserFailed.AddListener(OnGetUserFailed);
17 ApexSystem.Instance.OnLoginSuccess.AddListener(OnLoginSuccess);
18 ApexSystem.Instance.OnLoginFailed.AddListener(OnLoginFailed);
19 GetUserButton.interactable = false;
20 }
21
23 {
24 GetUserButton.interactable = true;
25 }
26
27 void OnLoginFailed(FailureResponse failedLoginResponse)
28 {
29 GetUserButton.interactable = false;
30 }
31
33 {
34 FirstName.text = getUserResponse.First;
35 LastName.text = getUserResponse.Last;
36 Email.text = getUserResponse.Email;
37 UserId.text = getUserResponse.ID.ToString();
38 }
39
40 void OnGetUserFailed(FailureResponse failedGetUserResponse)
41 {
42 FirstName.text = "N/A";
43 LastName.text = "N/A";
44 Email.text = "N/A";
45 UserId.text = "N/A";
46 }
47
48 // Update is called once per frame
49 void Update()
50 {
51
52 }
53}
void OnLoginFailed(FailureResponse failedLoginResponse)
void OnLoginSuccess(LoginResponseContent loginResponse)
void OnGetUserSuccess(GetUserResponseContent getUserResponse)
void OnGetUserFailed(FailureResponse failedGetUserResponse)