void getLocationData() { ScheduleNameTransfer s = ScheduleNameTransfer.Instance; string scheduleName = s.getScheduleName(); Singleton singleton = Singleton.Instance(); String user = singleton.getUserName(); reference.GetValueAsync().ContinueWith(task => { if (task.IsFaulted) { // Handle the error... Debug.Log("error fetching data"); } else if (task.IsCompleted) { // getting schedules for a particular user. DataSnapshot snapshot = task.Result.Child(dbDetails.getScheduleDBName()).Child(user).Child(scheduleName); string str = snapshot.GetRawJsonValue(); JObject jsonLocation = JObject.Parse(str); IList <string> keys = jsonLocation.Properties().Select(p => p.Name).ToList(); //var values = jsonLocation.ToObject<Dictionary<string, object>>(); foreach (string schedule in keys) { Debug.Log(schedule); this.locations.Add(new ScheduleLocation(schedule, (string)jsonLocation[schedule])); } } }); }
public void OnButtonClick() { Text[] texts = EventSystem.current.currentSelectedGameObject.GetComponentsInChildren <Text>(); print("Clicked on : " + texts[0].text); s = ScheduleNameTransfer.Instance; s.setScheduleName(texts[0].text); q = Singleton.Instance(); q.setScheduleName(texts[0].text); }