Ejemplo n.º 1
0
        // Use this for initialization
        public void Awake()
        {
            gps = GameObject.Find("GpsMachine").GetComponent <UsingGps>();

            firebaseApp = FirebaseDatabase.DefaultInstance.App;
            FirebaseApp.DefaultInstance.SetEditorDatabaseUrl("https://littletigers-44351.firebaseio.com");
            databaseReference = FirebaseDatabase.DefaultInstance.RootReference;

            FirebaseDatabase.DefaultInstance.GetReference("ARMessages").GetValueAsync().ContinueWith(task =>
            {
                if (task.IsFaulted)
                {
                    Debug.Log("Database Error");
                }
                else if (task.IsCompleted)
                {
                    DataSnapshot snapshot = task.Result;
                    foreach (var item in snapshot.Children)
                    {
                        Location location       = new Location();
                        location.altitude       = Convert.ToDouble(item.Child("altitude").Value);
                        location.ignoreAltitude = Convert.ToBoolean(item.Child("ignoreAltitude").Value);
                        location.label          = Convert.ToString(item.Child("label").Value);
                        location.latitude       = Convert.ToDouble(item.Child("latitude").Value);
                        location.longitude      = Convert.ToDouble(item.Child("longitude").Value);
                        cnt++;
                        locations.Add(location);
                    }
                }
            });
        }
Ejemplo n.º 2
0
        // Use this for initialization
        public void Awake()
        {
            GetUid(); // 현재 유저의 Uid를 가져온 후 저장

            PopupMessage = GameObject.Find("PopupMessage");
            LoadingPopup = GameObject.Find("LoadingPopup");
            manager      = ARLocationManager.Instance;
            PopupMessage.SetActive(false);



            gps = GameObject.Find("GpsMachine").GetComponent <UsingGps>();

            firebaseApp = FirebaseDatabase.DefaultInstance.App;
            FirebaseApp.DefaultInstance.SetEditorDatabaseUrl("https://littletigers-44351.firebaseio.com");
            databaseReference = FirebaseDatabase.DefaultInstance.RootReference;

            FirebaseDatabase.DefaultInstance.GetReference("ARMessages").GetValueAsync().ContinueWith(task =>
            {
                if (task.IsFaulted)
                {
                    Debug.Log("Database Error");
                }
                else if (task.IsCompleted)
                {
                    DataSnapshot snapshot = task.Result;
                    foreach (var item in snapshot.Children)
                    {
                        Location location       = new Location();
                        location.key            = Convert.ToString(item.Child("key").Value);
                        location.altitude       = Convert.ToDouble(item.Child("altitude").Value);
                        location.ignoreAltitude = Convert.ToBoolean(item.Child("ignoreAltitude").Value);
                        location.label          = Convert.ToString(item.Child("label").Value);
                        location.latitude       = Convert.ToDouble(item.Child("latitude").Value);
                        location.longitude      = Convert.ToDouble(item.Child("longitude").Value);
                        location.uid            = Convert.ToString(item.Child("uid").Value);
                        location.likecnt        = Convert.ToInt32(item.Child("likecnt").Value);
                        foreach (var clickuid in item.Child("likelist").Children)
                        {
                            location.likelist.Add(Convert.ToString(clickuid.Value));
                        }
                        locations.Add(location);
                        AddLocation(location);
                    }
                }
            });
        }