//----------------------------------------------------------------------------------------------------------------------------------------------// public void StartActivityCheck() { DataRef.Activity().GetValueAsync().ContinueWith(async(task) => { await new WaitForUpdate(); DataSnapshot snapshot = task.Result; if (int.Parse(snapshot.ChildrenCount.ToString()) != content.childCount) { PopulateReCheck(); } else { StartCoroutine(CheckForNewActivity(0.1f)); } }); }
//----------------------------------------------------------------------------------------------------------------------------------------------// public void PopulateReCheck() { if (content.childCount > 0) { foreach (Transform child in content) { Destroy(child.gameObject); } } DataRef.Activity().GetValueAsync().ContinueWith(async(task) => { await new WaitForUpdate(); DataSnapshot snapshot = task.Result; foreach (DataSnapshot alert in snapshot.Children) { string type = alert.Child("Type").Value.ToString(); if (type == "Donation") { InstantiateAlert(donationPrefab, type, donationS, alert); } else if (type == "New Donor") { InstantiateAlert(newDonorPrefab, type, newDonorS, alert); } else if (type == "New Project") { InstantiateAlert(newProjectPrefab, type, newProjectS, alert); } else if (type == "Project Funded") { InstantiateAlert(projectFundedPrefab, type, projectFundedS, alert); } } Descending(); StartCoroutine(CheckForNewActivity(0.1f)); }); }
//----------------------------------------------------------------------------------------------------------------------------------------------// public void PopulateReCheck() { if (content.childCount > 0) { foreach (Transform child in content) { Destroy(child.gameObject); } } DataRef.Activity().GetValueAsync().ContinueWith(async(task) => { await new WaitForUpdate(); DataSnapshot snapshot = task.Result; foreach (DataSnapshot message in snapshot.Children) { InstantiateMessage(message); } Descending(); StartCoroutine(CheckForNewMessage(0.1f)); }); }
//----------------------------------------------------------------------------------------------------------------------------------------------// private void GetInstance() { pushKey = DataRef.Activity().Push().Key; date = DateTime.Now.ToString("MMMM") + " " + DateTime.Now.Day.ToString() + " at " + DateTime.Now.ToString("hh") + ":" + DateTime.Now.Minute.ToString() + " " + DateTime.Now.ToString("tt"); timestamp = (DateTime.Now.Ticks / TimeSpan.TicksPerMillisecond).ToString(); }
//----------------------------------------------------------------------------------------------------------------------------------------------// private void SetValue(string child, string value) { DataRef.Activity().Child(pushKey).Child(child).SetValueAsync(value).ContinueWith(async(taskSet) => { await new WaitForUpdate(); }); }