Exemplo n.º 1
0
    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);
                }
            }
        });
    }
Exemplo n.º 2
0
    //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());
                }
            }
        });
    }
Exemplo n.º 3
0
 public IFirebaseReference GetChild(string path)
 {
     return(new FirebaseReferenceNative(database.GetReference(path)));
 }
Exemplo n.º 4
0
	public bool present(string path) {
		fbref.GetReference(path).GetValueAsync().ContinueWith(task => {
			return task.Result.Exists;
		});
		return false;
	}