public SavedTour(int _id, SavedPanoramas _saved_panoramas, SavedPhotos _saved_photos, SavedTransitions _saved_transitions) { id = _id; saved_panoramas = _saved_panoramas; saved_photos = _saved_photos; saved_transitions = _saved_transitions; }
//conver post data to json public string Export() { List <SavedPanorama> saved_panoramas_list = new List <SavedPanorama>(); foreach (Panorama panorama in tour.panoramas) { saved_panoramas_list.Add( new SavedPanorama(panorama.id, panorama.link, panorama.transform.position, panorama.transform.rotation) ); } List <SavedPhoto> saved_photos_list = new List <SavedPhoto>(); List <SavedTransition> saved_transitions_list = new List <SavedTransition>(); foreach (Interaction interaction in tour.interactions) { if (interaction is Photo) { saved_photos_list.Add( new SavedPhoto(interaction.id, interaction.panorama_id, ((Photo)interaction).link, interaction.transform.position, interaction.transform.rotation) ); } else if (interaction is Transition) { saved_transitions_list.Add( new SavedTransition(interaction.id, interaction.panorama_id, ((Transition)interaction).target_id, interaction.transform.position, interaction.transform.rotation) ); } } SavedPanoramas saved_panoramas = new SavedPanoramas(saved_panoramas_list); SavedPhotos saved_photos = new SavedPhotos(saved_photos_list); SavedTransitions saved_transitions = new SavedTransitions(saved_transitions_list); SavedTour savedTour = new SavedTour(tour.id, saved_panoramas, saved_photos, saved_transitions); return(JsonUtility.ToJson(savedTour)); }