// Start is called before the first frame update void Start() { head = GameObject.Find("HeadBtn").GetComponent <CustomizeAvatar>(); headGear = GameObject.Find("HeadGearBtn").GetComponent <CustomizeAvatar>(); body = GameObject.Find("BodyBtn").GetComponent <CustomizeAvatar>(); AddUserInterface.getUserAvatar(headGear, head, body); }
public void getUserAvatar(CustomizeAvatar headGear, CustomizeAvatar head, CustomizeAvatar body) { Debug.Log("Get user avatar date from database"); Debug.Log("Call user manager to get data"); bool result = crudUser.getUserAvatar(headGear, head, body); if (result != false) { Debug.Log("User avatar retrieved"); } }
public void getUserAvatar(CustomizeAvatar headGear, CustomizeAvatar head, CustomizeAvatar body) { FirebaseDatabase.DefaultInstance .GetReference("users").Child("abcdefghi").Child("avatar") .GetValueAsync().ContinueWith(task => { if (task.IsFaulted) { Debug.Log("error"); } else if (task.IsCompleted) { DataSnapshot snapshot = task.Result; headGear.SetIndex(snapshot.Child("headgear").GetRawJsonValue()); head.SetIndex(snapshot.Child("head").GetRawJsonValue()); body.SetIndex(snapshot.Child("body").GetRawJsonValue()); Debug.Log(snapshot.Child("headgear").GetRawJsonValue() + " " + snapshot.Child("head").GetRawJsonValue() + " " + snapshot.Child("body").GetRawJsonValue()); // Do something with snapshot... } }); }
public bool getUserAvatar(CustomizeAvatar headGear, CustomizeAvatar head, CustomizeAvatar body) { return(true); }