IEnumerator AddLocationToBase()
    {
        foreach (var street in historicStreetList)
        {
            DatabaseReference locationRef = dataReference.Push();

            string key = locationRef.Key;

            HistoricStreet historicLocation = new HistoricStreet(street.LocationName, street.Latitude, street.Longitude, ConstantString.VIDEO_URL, street.Textcontent, key);

            string json = JsonUtility.ToJson(historicLocation);

            var taskstore = locationRef.SetRawJsonValueAsync(json);

            yield return(new WaitUntil(() => taskstore.IsCompleted));

            if (taskstore.Exception != null)
            {
                _ShowAndroidToastMessage($"Something wrong happened {taskstore.Exception.Message}");
            }
            else
            {
                _ShowAndroidToastMessage("Successfully uploaded Historic Location");
            }
        }
    }
Ejemplo n.º 2
0
    public void SetUp(HistoricStreet historicLocation, MainScript mainSceneScript)
    {
        location   = historicLocation;
        mainScript = mainSceneScript;

        LocationName.text = location.LocationName;
        Coordinate.text   = $"{location.latitude} , {location.longitude}";
    }
    IEnumerator LoadLocations()
    {
        var data = LoadDataSnap(dataReference);

        yield return(new WaitUntil(() => data.IsCompleted));

        DataSnapshot dataSnapshot = data.Result;

        foreach (var datasnap in dataSnapshot.Children)
        {
            HistoricStreet historicLocation = JsonUtility.FromJson <HistoricStreet>(datasnap.GetRawJsonValue());
            AddHistoricLoation(historicLocation);
        }
    }
Ejemplo n.º 4
0
    public void SetUpContent(HistoricStreet historicStreet)
    {
        street = historicStreet;

        if (!String.IsNullOrEmpty(street.VideoUrl))
        {
            videourl = street.VideoUrl;
        }

        if (!String.IsNullOrEmpty(street.Textcontent))
        {
            textMeshPro.text = historicStreet.Textcontent;
        }
    }
Ejemplo n.º 5
0
    IEnumerator AddToFirebase(string name, double lat, double lng, string videourl, string textcontent)
    {
        DatabaseReference pushReference = dataReference.Push();

        string key = pushReference.Key;

        HistoricStreet historicStreet = new HistoricStreet(name, lat, lng, videourl, textcontent, key);

        string json = JsonUtility.ToJson(historicStreet);

        var pushtask = pushReference.SetRawJsonValueAsync(json);

        yield return(new WaitUntil(() => pushtask.IsCompleted));

        if (pushtask.Exception != null)
        {
            CodelabUtils._ShowAndroidToastMessage("Something went wrong while uploading data");
        }
        else
        {
            CodelabUtils._ShowAndroidToastMessage("Data Successfully uploaded");
            SceneManager.LoadScene(ConstantString.MAINSCENE, LoadSceneMode.Additive);
        }
    }
 void AddHistoricLoation(HistoricStreet historicLocation)
 {
     ListHistoricLocations.Add(historicLocation);
 }
    void AddHistoricLoationswithVideo(string name, double lat, double lng, string videourl, string textcotent)
    {
        HistoricStreet historicLocation = new HistoricStreet(name, lat, lng, videourl, textcotent);

        ListHistoricLocations.Add(historicLocation);
    }
    void AddHistoricLocations(string name, double lat, double lng, string textcontent, int videoindex)
    {
        HistoricStreet historicLocation = new HistoricStreet(name, lat, lng, textcontent);

        ListHistoricLocations.Add(historicLocation);
    }
Ejemplo n.º 9
0
 public void MyLocationGoogleMapButton()
 {
     selectedLocation = null;
     SceneManager.LoadScene(ConstantString.MAPSCENE);
 }
Ejemplo n.º 10
0
 public void ItemClickHandle(HistoricStreet clickedLocation)
 {
     selectedLocation = clickedLocation;
     SceneManager.LoadScene(ConstantString.MAPSCENE);
 }
Ejemplo n.º 11
0
    private IEnumerator Follow()
    {
        // If location is allowed by the user, start the location service and compass, otherwise abort
        // the coroutine.


        #if PLATFORM_IOS
        // The location permissions request in IOS does not seem to get invoked until it is called for
        // in the code. It happens at runtime so if the code is not trying to access the location
        // right away, it will not pop up the permissions dialog.
        Input.location.Start();
        #endif

        while (!Input.location.isEnabledByUser)
        {
            //Debug.Log("Waiting for location services to become enabled..");
            yield return(new WaitForSeconds(1f));
        }

        _ShowAndroidToastMessage("Location services is enabled.");

        /*Start the Location service*/
        #if !PLATFORM_IOS
        Input.location.Start();
        #endif

        Input.compass.enabled = true;

        // Wait for the location service to start.
        while (true)
        {
            if (Input.location.status == LocationServiceStatus.Initializing)
            {
                // Starting, just wait.
                yield return(new WaitForSeconds(1f));
            }
            else if (Input.location.status == LocationServiceStatus.Failed)
            {
                // Failed, abort the coroutine.
                //Debug.LogError("Location Services failed to start.");
                _ShowAndroidToastMessage("Location Service failed to start.");

                yield break;
            }
            else if (Input.location.status == LocationServiceStatus.Running)
            {
                // Started, continue the coroutine.
                break;
            }
        }

        // Get the MapsService component and load it at the device location.
        PreviousLocation =
            new LatLng(Input.location.lastData.latitude, Input.location.lastData.longitude);

        mapsService = GetComponent <MapsService>();

        /*Get the static HistoricStreet from MainScript class
         * . Check whether it is null
         * . if it is null set the MapsService InitFloatingOrigin to the Users Location
         * . if it is not null set the MapService InitFloatingOrgin to the set location
         */

        historicStreet = MainScript.selectedLocation;

        if (historicStreet == null)
        {
            mapsService.InitFloatingOrigin(PreviousLocation);
        }
        else
        {
            LatLng selectedLocation = new LatLng(historicStreet.Latitude, historicStreet.Longitude);
            mapsService.InitFloatingOrigin(selectedLocation);
            MainCamera.GetComponent <ObjectFollower>().ShouldFollow(false);
        }


        //_ShowAndroidToastMessage("MapsService initialised and InitFloatingOrigin called");

        // Register a listener to be notified when the map is loaded.
        mapsService.Events.MapEvents.Loaded.AddListener(OnLoaded);

        // Load map with default options.
        LoadMap();
    }