Beispiel #1
0
    public void Initialize(LibPlacenote.MapInfo mapInfo, RectTransform listParent, UnityAction onButtonClick)
    {
        mMapIdText.text = mapInfo.placeId;
        if (mapInfo.metadata.name != null && mapInfo.metadata.name.Length > 0)
        {
            mMapIdText.text = mapInfo.metadata.name;
        }

        gameObject.transform.SetParent(listParent);
        mButton.onClick.AddListener(onButtonClick);

        if (Input.location.status != LocationServiceStatus.Running)
        {
            mLocationText.text = "Distance Unknown - No user location";
        }
        else if (mapInfo.metadata.location != null)
        {
            var distance = Calc(Input.location.lastData.latitude, Input.location.lastData.longitude,
                                mapInfo.metadata.location.latitude,
                                mapInfo.metadata.location.longitude);
            mLocationText.text = "Distance: " + distance.ToString("F3") + "km";
        }
        else
        {
            mLocationText.text = "Distance Unknown - Map does not have location";
        }
    }
Beispiel #2
0
    public void ChangeUI(string ID)
    {
        //pop Up
        transform.DOScale(1, 0.25f);
        LibPlacenote.Instance.ListMaps((mapList) => {
            // render the map list!
            foreach (LibPlacenote.MapInfo mapInfoItem in mapList)
            {
                if (mapInfoItem.metadata.name == null)
                {
                    continue;
                }

                if (mapInfoItem.placeId == ID)
                {
                    mapNameUI.text = mapInfoItem.metadata.name;
                    triggerMapInfo = mapInfoItem;
                    break;
                }

                triggerMapInfo = null;
                mapNameUI.text = "Error";
            }
        });
    }
        public void Initialize(LibPlacenote.MapInfo mapInfo, ToggleGroup toggleGroup,
                               RectTransform listParent, UnityAction <bool> onToggleChanged)
        {
            mapIdText.text = mapInfo.placeId;
            if (mapInfo.metadata.name != null && mapInfo.metadata.name.Length > 0)
            {
                mapIdText.text = mapInfo.metadata.name;
            }
            toggle.group = toggleGroup;
            gameObject.transform.SetParent(listParent);
            toggle.onValueChanged.AddListener(onToggleChanged);

            if (Input.location.status != LocationServiceStatus.Running)
            {
                locationText.text = "Distance Unknown - No user location";
            }
            else if (mapInfo.metadata.location != null)
            {
                var distance = Calc(Input.location.lastData.latitude, Input.location.lastData.longitude,
                                    mapInfo.metadata.location.latitude,
                                    mapInfo.metadata.location.longitude);
                locationText.text = "Distance: " + distance.ToString("F3") + "km";
            }
            else
            {
                locationText.text = "Distance Unknown - Map does not have location";
            }
        }
Beispiel #4
0
 void OnMapSelected(LibPlacenote.MapInfo mapInfo)
 {
     mSelectedMapInfo = mapInfo;
     LoadFromMetadata();
     mMapLoader.SetActive(true);
     mRadiusSlider.gameObject.SetActive(false);
 }
        private void OnMapSelected(LibPlacenote.MapInfo mapInfo)
        {
            selectedMapInfo = mapInfo;

            //UIManager.Instance.SetUIMode(UIManager.UIMode.SelectMap); //toggle button state will be ruined if enabled...
            SelectMapFacade.Instance.SetUIMode(SelectMapFacade.UIMode.SelectMap_MapSelected);
            //MessageManager.Instance.DebugMessage("Map selected: " + mapInfo.placeId);
        }
Beispiel #6
0
    public void AddMapToList(LibPlacenote.MapInfo mapInfo)
    {
        GameObject newElement = Instantiate(listElement) as GameObject;

        mapInfoElement = newElement.GetComponent <MapInfoElement>();
        mapInfoElement.Initialize(mapInfo, toggleGroup, listContentParent, (value) => {
        });
    }
 public void Initialize(LibPlacenote.MapInfo mapInfo, ToggleGroup toggleGroup,
                        RectTransform listParent, UnityAction <bool> onToggleChanged)
 {
     mMapIdText.text = mapInfo.placeId;
     mToggle.group   = toggleGroup;
     gameObject.transform.SetParent(listParent);
     mToggle.onValueChanged.AddListener(onToggleChanged);
 }
Beispiel #8
0
    void AddMapToList(LibPlacenote.MapInfo mapInfo)
    {
        GameObject     newElement  = Instantiate(mListElement) as GameObject;
        MapInfoElement listElement = newElement.GetComponent <MapInfoElement> ();

        listElement.Initialize(mapInfo, mToggleGroup, mListContentParent, (value) => {
            OnMapSelected(mapInfo);
        });
    }
Beispiel #9
0
    //Called from within Load Route List to add a route from Placenote to the list in the application
    void AddRouteToList(LibPlacenote.MapInfo routeInfo)
    {
        GameObject newElement = Instantiate(mListElement) as GameObject;
        //Calls MapDetails Class to set details for new row in list for route
        MapDetails listElement = newElement.GetComponent <MapDetails> ();

        listElement.Initialize(routeInfo, mToggleGroup, mListContentParent, (value) => {
            OnRouteSelected(routeInfo);
        });
    }
Beispiel #10
0
    void AddMapToList(LibPlacenote.MapInfo mapInfo)
    {
        // GameObject newElement = Instantiate(mListElement) as GameObject;
        GameObject     newElement  = Instantiate(Resources.Load("LeafInfoElement", typeof(GameObject))) as GameObject;
        MapInfoElement listElement = newElement.GetComponent <MapInfoElement>();

        listElement.Initialize(mapInfo, mToggleGroup, mListContentParent, (value) =>
        {
            OnMapSelected(mapInfo);
        });
    }
Beispiel #11
0
    void AddMapToList(LibPlacenote.MapInfo mapInfo)
    {
        GameObject newElement  = Instantiate(mListElement) as GameObject;
        MapElement listElement = newElement.GetComponent <MapElement>();

        listElement.Initialize(mapInfo, mListContentParent, () =>
        {
            Debug.Log(mapInfo.metadata.name);
            OnMapSelected(mapInfo);
        });
    }
        private void AddMapToList(LibPlacenote.MapInfo mapInfo)
        {
            GameObject newElement = Instantiate(SelectMapFacade.Instance.mapInfoElementPrefab) as GameObject;

            if (newElement != null)
            {
                SBMapInfoElement listElement = newElement.GetComponent <SBMapInfoElement>();
                listElement.Initialize(mapInfo, SelectMapFacade.Instance.mapListContentToggleGroup, SelectMapFacade.Instance.mapListContentParent, (value) =>
                {
                    OnMapSelected(mapInfo);
                });
            }
        }
Beispiel #13
0
 void FindMap()
 {
     //get metadata
     LibPlacenote.Instance.SearchMaps(MAP_NAME, (LibPlacenote.MapInfo[] obj) => {
         foreach (LibPlacenote.MapInfo map in obj)
         {
             if (map.metadata.name == MAP_NAME)   //check if it is the same name
             {
                 mSelectedMapInfo = map;
                 Debug.Log("FOUND MAP: " + mSelectedMapInfo.placeId);
                 LoadMap();
                 return;
             }
         }
     });
 }
Beispiel #14
0
 void FindMap()
 {
     //get metadata
     LibPlacenote.Instance.SearchMaps(mapName, (LibPlacenote.MapInfo[] obj) => {
         foreach (LibPlacenote.MapInfo map in obj)
         {
             if (map.metadata.name == mapName)
             {
                 mSelectedMapInfo = map;
                 Debug.Log("FOUND MAP: " + mSelectedMapInfo.placeId);
                 LoadMap();
                 return;
             }
         }
     });
 }
 //search by name
 void FindMap()
 {
     //get metadata
     MAP_NAME = PlayerPrefs.GetString("mapname");
     LibPlacenote.Instance.SearchMaps(MAP_NAME, (LibPlacenote.MapInfo[] obj) => {
         foreach (LibPlacenote.MapInfo map in obj)
         {
             if (map.metadata.name == MAP_NAME)
             {
                 mSelectedMapInfo = map;
                 Debug.Log("FOUND MAP: " + mSelectedMapInfo.placeId);
                 LoadMap();
                 return;
             }
         }
     });
 }
Beispiel #16
0
    void AddMapToList(LibPlacenote.MapInfo mapInfo)
    {
        Debug.Log("adding map to list 1");
        GameObject newElement = Instantiate(mListElement) as GameObject;

        Debug.Log("adding map to list 2");

        MapInfoElement listElement = newElement.GetComponent <MapInfoElement>();

        Debug.Log("adding map to list 3");

        listElement.Initialize(mapInfo, mToggleGroup, mListContentParent, (value) => {
            Debug.Log("adding map to list 4");

            OnMapSelected(mapInfo);
            Debug.Log("adding map to list 5" + mapInfo);
        });
    }
Beispiel #17
0
 void FindMap()
 {
     Debug.Log("find map start");
     //get metadata
     LibPlacenote.Instance.SearchMaps(MAP_NAME, (LibPlacenote.MapInfo[] obj) => {
         foreach (LibPlacenote.MapInfo map in obj)
         {
             if (map.metadata.name == MAP_NAME)
             {
                 mSelectedMapInfo = map;
                 Debug.Log("FOUND MAP: " + mSelectedMapInfo.placeId);
                 LoadMap();
                 return;
             }
         }
     });
     Debug.Log("find map end");
 }
 void FindMap()
 {
     //get metadata
     LibPlacenote.Instance.SearchMaps(MAP_NAME, (LibPlacenote.MapInfo[] obj) =>
     {
         foreach (LibPlacenote.MapInfo map in obj)
         {
             if (map.metadata.name == MAP_NAME)
             {
                 mSelectedMapInfo = map;
                 Debug.Log("FOUND MAP: " + mSelectedMapInfo.placeId);
                 mLabelText.text = "Downloading map: " + MAP_NAME;
                 LoadMap();
                 return;
             }
         }
     });
 }
Beispiel #19
0
    // Update is called once per frame



    void FindMap()
    {
        //get metadata
        LibPlacenote.Instance.SearchMaps(MAP_NAME, (LibPlacenote.MapInfo[] obj) => {
            Debug.Log("findmap current obj: " + obj);
            foreach (LibPlacenote.MapInfo map in obj)
            {
                Debug.Log("findmap current map: " + map);
                //change to contains
                if (map.metadata.name == MAP_NAME)
                {
                    Debug.Log("IN findmap method:" + MAP_NAME);
                    mSelectedMapInfo = map;
                    Debug.Log("FOUND MAP: " + mSelectedMapInfo.placeId);
                    LoadMap();
                    return;
                }
                Debug.Log("cannot find in findmap:" + MAP_NAME);
            }
        });
    }
Beispiel #20
0
    public void OnResetConfirmClick()
    {
        resetButton.SetActive(true);
        resetAlert.SetActive(false);

        if (currentStage == Stage.NAVI)
        {
            navigationButton.SetActive(false);
        }
        statusText.text = "เลือกแผนที่";

        mapList.SetActive(true);
        LibPlacenote.Instance.StopSession();
        FeaturesVisualizer.clearPointcloud();
        GetComponent <CustomShapeManager>().ClearShapes();
        ConfigureSession();
        mARKitInit       = false;
        mapListUpdated   = false;
        destListUpdated  = false;
        isLocalize       = false;
        mSelectedMapInfo = null;
    }
Beispiel #21
0
    public void Initialize(LibPlacenote.MapInfo mapInfo, ToggleGroup toggleGroup,
                           RectTransform listParent, UnityAction <bool> onToggleChanged)
    {
        mMapIdText.text = mapInfo.placeId;
        mToggle.group   = toggleGroup;
        gameObject.transform.SetParent(listParent);
        mToggle.onValueChanged.AddListener(onToggleChanged);

        if (Input.location.status != LocationServiceStatus.Running)
        {
            mLocationText.text = "Distance Unknown - No user location";
        }
        else if (mapInfo.userData is JObject && mapInfo.userData ["location"] is JObject)
        {
            var distance = Calc(Input.location.lastData.latitude, Input.location.lastData.longitude,
                                mapInfo.userData ["location"] ["latitude"].ToObject <float> (),
                                mapInfo.userData ["location"] ["longitude"].ToObject <float> ());
            mLocationText.text = "Distance: " + distance.ToString("F3") + "km";
        }
        else
        {
            mLocationText.text = "Distance Unknown - Map does not have location";
        }
    }
Beispiel #22
0
 void OnMapSelected(LibPlacenote.MapInfo mapInfo)
 {
     mSelectedMapInfo = mapInfo;
     mMapSelectedPanel.SetActive(true);
 }
Beispiel #23
0
 //Called when user has clicked on a route in the route list
 void OnRouteSelected(LibPlacenote.MapInfo routeInfo)
 {
     selectedRouteInfo = routeInfo;
     routeSelectedPanel.SetActive(true);
 }
Beispiel #24
0
 void OnMapSelected(LibPlacenote.MapInfo mapInfo)
 {
     mSelectedMapInfo = mapInfo;
 }
Beispiel #25
0
    public void OnLoadMapClicked()
    {
        if (!LibPlacenote.Instance.Initialized())
        {
            Debug.Log("SDK not yet initialized");
            ToastManager.ShowToast("SDK not yet initialized", 2f);
            return;
        }
        mCurrMapId = LoadMapIDFromFile();
        if (mCurrMapId == null)
        {
            Debug.Log("No map available");
            return;
        }
        mCurrMapInfo = null;


        LibPlacenote.Instance.ListMaps((mapList) => {
            // render the map list!
            foreach (LibPlacenote.MapInfo mapId in mapList)
            {
                if (mapId.userData != null)
                {
                    if (mapId.placeId == mCurrMapId)
                    {
                        Debug.Log("Got map meta data");
                        mCurrMapInfo = mapId;
                        break;
                    }
                }
                else
                {
                }
            }

            if (mCurrMapInfo == null)
            {
                Debug.LogError("MapId not on map List. Click 'New Map'");
                return;
            }


            mLabelText.text = "Loading Map ID: " + mCurrMapId;
            LibPlacenote.Instance.LoadMap(mCurrMapId,
                                          (completed, faulted, percentage) => {
                if (completed)
                {
                    mInitButtonPanel.SetActive(false);
                    mExitButton.SetActive(true);

                    LibPlacenote.Instance.StartSession();
                    mLabelText.text = "Loaded ID: " + mCurrMapId;
                }
                else if (faulted)
                {
                    mLabelText.text = "Failed to load ID: " + mCurrMapId;
                }
            }
                                          );
        });
    }
 void OnMapSelected(LibPlacenote.MapInfo mapInfo)
 {
     mSelectedMapInfo = mapInfo;
     mMapSelectedPanel.SetActive(true);
     mRadiusSlider.gameObject.SetActive(false);
 }
Beispiel #27
0
 public void CloseUI()
 {
     transform.DOScale(0, 0.25f);
     triggerMapInfo = null;
 }