void GetDataList() //Collects the player information from the tree { Firebase.Database.FirebaseDatabase dbInstance = Firebase.Database.FirebaseDatabase.DefaultInstance; dbInstance.GetReference("Game_01").GetValueAsync().ContinueWith(task => { if (task.IsFaulted) { print("No data"); } else if (task.IsCompleted) { DataSnapshot snapshot = task.Result; foreach (DataSnapshot user in snapshot.Children) { IDictionary dictUser = (IDictionary)user.Value; playerIdList.Add(dictUser["userId"].ToString()); print(playerIdList.Count); } } }); }
//Fetches list of the player from lobby by their userID public void PlayerListCollector() { Firebase.Database.FirebaseDatabase dbInstance = Firebase.Database.FirebaseDatabase.DefaultInstance; dbInstance.GetReference(gameID + "/Lobby").GetValueAsync().ContinueWith(task => { if (task.IsFaulted) { // Handle the error... } else if (task.IsCompleted) { DataSnapshot snapshot = task.Result; foreach (DataSnapshot user in snapshot.Children) { IDictionary dictUser = (IDictionary)user.Value; playerIDList.Add(dictUser["userId"].ToString()); } } }); }
public IFirebaseReference GetChild(string path) { return(new FirebaseReferenceNative(database.GetReference(path))); }
public bool present(string path) { fbref.GetReference(path).GetValueAsync().ContinueWith(task => { return task.Result.Exists; }); return false; }