// Update is called once per frame void Update() { PSLocationArraySingleton s = PSLocationArraySingleton.Instance(); Singleton so = Singleton.Instance(); string currentTourName = so.getTourName(); Dictionary <string, int> toursLocationsStatusUpdate = s.getToursLocationsUpdateStatusDictionary(); if (!locationsDisplayed && locations.Count > 0 && toursLocationsStatusUpdate[currentTourName] == 0) { createLocationsList(); } else if (!updateLocationsDisplayed && toursLocationsStatusUpdate[currentTourName] == 1) { foreach (GameObject g in gameObjectsList) { g.Destroy(); } gameObjectsList.Clear(); Dictionary <string, ArrayList> toursLocations = s.getToursLocationDictionary(); ArrayList updatedLocations = toursLocations[currentTourName]; updateLocationsList(updatedLocations); } }
private void loadTourScene() { startButton.SetActive(false); startBox.SetActive(false); destBox.SetActive(false); TourName = singleton.getTourName(); CurrentPosition = locationIndicator.transform.GetGeoPosition(_map.CenterMercator, _map.WorldRelativeScale); locations.Add(new TourLocation("CurrentLocation", 0)); coordinates.Add(CurrentPosition); PSLocationArraySingleton pSLocationArraySingleton = PSLocationArraySingleton.Instance(); Dictionary <string, ArrayList> toursLocationsDictObject = pSLocationArraySingleton.getToursLocationDictionary(); sharedLocations = singleton.getSharedTourLocations(); int i = 1; foreach (string location in toursLocationsDictObject[TourName]) { locations.Add(new TourLocation(location, i)); i++; } getCoordinates(); }
void getLocationData() { PSLocationArraySingleton ps = PSLocationArraySingleton.Instance(); Singleton s = Singleton.Instance(); string scheduleName = s.getTourName(); locationsTemp.Clear(); DepartmentTour.text = scheduleName + " Locations"; 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. snapshot = task.Result.Child(dbDetails.getTourDBName()).Child(scheduleName.ToString()); string str = snapshot.GetRawJsonValue(); JObject jsonLocation = JObject.Parse(str); IList <string> keys = jsonLocation.Properties().Select(p => p.Name).ToList(); foreach (string key in keys) { this.locations.Add(new DeptLocation(key)); } Dictionary <string, ArrayList> toursLocations = ps.getToursLocationDictionary(); ArrayList updatedLocations = toursLocations[scheduleName]; if (updatedLocations == null) { toursLocations[scheduleName] = locationsTemp; } } }); }
public void deleteFromArrayList(string deleteLocation) { singleton = Singleton.Instance(); string tourName = singleton.getTourName(); PSLocationArraySingleton psObject = PSLocationArraySingleton.Instance(); Dictionary <string, ArrayList> toursLocations = psObject.getToursLocationDictionary(); print("Deleting location in tour: " + tourName); ArrayList locations = toursLocations[tourName]; print("Deleting locations: " + deleteLocation); locations.RemoveAt(locations.IndexOf(deleteLocation)); toursLocations[tourName] = locations; Dictionary <string, int> toursLocationsStatusUpdate = psObject.getToursLocationsUpdateStatusDictionary(); toursLocationsStatusUpdate[tourName] = 1; }
public void Start() { foreach (var modifier in MeshModifiers) { modifier.Initialize(); } dbDetails = new DB_Details(); locations = new ArrayList(); coordinates = new ArrayList(); _instances = new List <GameObject>(); Singleton singleton = Singleton.Instance(); TourName = singleton.getTourName(); path = false; // Set up the Editor before calling into the realtime database. FirebaseApp.DefaultInstance.SetEditorDatabaseUrl(dbDetails.getDBUrl()); // Get the root reference location of the database. reference = FirebaseDatabase.DefaultInstance.RootReference; CurrentPosition = Player.transform.GetGeoPosition(_map.CenterMercator, _map.WorldRelativeScale); locations.Add(new TourLocation("CurrentLocation", 0)); coordinates.Add(CurrentPosition); PSLocationArraySingleton pSLocationArraySingleton = PSLocationArraySingleton.Instance(); Dictionary <string, ArrayList> toursLocationsDictObject = pSLocationArraySingleton.getToursLocationDictionary(); sharedLocations = singleton.getSharedTourLocations(); int i = 0; foreach (string location in toursLocationsDictObject[TourName]) { locations.Add(new TourLocation(location, i)); i++; } getCoordinates(); InvokeRepeating("UpdatePath", 2.0f, 0.3f); }
public void onSave() { PSLocationArraySingleton s = PSLocationArraySingleton.Instance(); Dictionary <string, int> toursLocationsStatusUpdate = s.getToursLocationsUpdateStatusDictionary(); singleton = Singleton.Instance(); string currentTourName = singleton.getTourName(); // updating location of the tour in dictionary, and setting update status in dictionary Dictionary <string, ArrayList> toursLocations = s.getToursLocationDictionary(); toursLocations[currentTourName] = locations; toursLocationsStatusUpdate[currentTourName] = 1; if (sharedLocationName != null) { singleton.addSharedLocation(sharedLocationName, sharedLocationCoordinates); } SceneManager.LoadScene("DeptTourLoc"); }
void createTourListFromDictionary() { singleton = Singleton.Instance(); string currentTourName = singleton.getTourName(); PSLocationArraySingleton s = PSLocationArraySingleton.Instance(); Dictionary <string, ArrayList> toursLocations = s.getToursLocationDictionary(); locations = toursLocations[currentTourName]; foreach (string location in locations) { GameObject newSchedule = Instantiate(ListItemPrefab) as GameObject; LocationListItem controller = newSchedule.GetComponent <LocationListItem>(); controller.Name.text = location; newSchedule.transform.parent = ContentPanel.transform; newSchedule.transform.localScale = Vector3.one; } locationsDisplayed = true; }