// Use this for initialization
    void Start()
    {
        spatialClient = GetComponent <SpatialClient2>();
        gmClient      = GetComponent <GoogleMap>();
        if (spatialClient != null)
        {
            //spatialClient.GetProjectInfo("588fb546604ae700118697c5");
            //StartCoroutine(spatialClient.GetProjectInfo("588fb546604ae700118697c5"));

            //StartCoroutine(spatialClient.CreateMarker(spatialClient.projectID, 40.433, -79.964, "test", "description", null));

            StartCoroutine(spatialClient.GetMarkersByProject(spatialClient.projectID));
        }
    }
    public IEnumerator updateCheckinnables()
    {
        Debug.Log("updatecheckinnables");
        while (_eggsCanvas.enabled)
        {
            Debug.Log("in while loop in updatecheckinnables");
            StartCoroutine(SpatialClient2.single.GetMarkersByDistance(Input.location.lastData.longitude, Input.location.lastData.latitude, FriendEggMenuItem.MAX_CHECK_IN_DISTANCE, true, _markersByDistance, _spatialResponse));
            foreach (GenericLocation.GooglePlacesType type in _placeTypes.Keys)
            {
                StartCoroutine(SpatialClient2.single.GetGoogleLocationsByDistance(Input.location.lastData.latitude, Input.location.lastData.longitude, FriendEggMenuItem.MAX_CHECK_IN_DISTANCE, _googleMarkers[type], type, _googleResponses[type]));
            }
            while (_spatialResponse.Success == null)
            {
                yield return(null);
            }
            yield return(SpatialClient2.waitUntilCoroutinesReturn(_googleResponses.Values));

            foreach (GenericEggMenuItem item in Enumerable.Concat <GenericEggMenuItem>(_eggMenuContentPanel.GetComponentsInChildren <OwnEggMenuItem>(), _friendEggMenuContentPanel.GetComponentsInChildren <FriendEggMenuItem>()))
            {
                if (!item.Egg.Hatchable)
                {
                    item.Egg.CheckInnableLocs.Clear();
                    item.Egg.CheckInnableMarkers.Clear();
                }
            }
            foreach (GenericLocation.GooglePlacesType type in _googleMarkers.Keys)
            {
                if (_googleMarkers[type].Count > 0)
                {
                    foreach (OwnedEgg egg in _placeTypes[type].Keys)
                    {
                        egg.CheckInnableLocs[_googleMarkers[type][0]] = _placeTypes[type][egg];
                    }
                }
            }
            Debug.Log("markers by distance count: " + _markersByDistance.Count.ToString());
            foreach (string id in _idMarkers.Keys)
            {
                Debug.Log(id);
            }
            foreach (SpatialMarker marker in _markersByDistance)
            {
                if (_idMarkers.ContainsKey(marker.Id))
                {
                    foreach (OwnedEgg egg in _idMarkers[marker.Id].Keys)
                    {
                        egg.CheckInnableMarkers.Add(_idMarkers[marker.Id][egg]);
                    }
                }
            }
            foreach (GenericEggMenuItem item in Enumerable.Concat <GenericEggMenuItem>(_eggMenuContentPanel.GetComponentsInChildren <OwnEggMenuItem>(), _friendEggMenuContentPanel.GetComponentsInChildren <FriendEggMenuItem>()))
            {
                if (!item.Egg.Hatchable)
                {
                    if (item.Egg.CheckInnableLocs.Count > 0 || item.Egg.CheckInnableMarkers.Count > 0)
                    {
                        item.enableCheckInButton();
                    }
                    else
                    {
                        item.disableCheckInButton();
                    }
                }
            }
            yield return(new WaitForSeconds(CHECK_INNABLE_UPDATE_INTERVAL));
        }
    }