using System; using System.Collections; using System.Collections.Generic; using TMPro; using UnityEngine; using UnityEngine.UI; namespace Imagine.WebAR.Demo{ public class ChangeGPSPinPosition : MonoBehaviour { [SerializeField] GameObject changePinLocationPopup, pinListItemPrefab; [SerializeField] TextMeshProUGUI changePinLocationPopupTitle, yourLocationText, pinLocationText; [SerializeField] TMP_InputField latInput, lonInput; [SerializeField] Button placeButton, place10MButton, closeButton; List pins = new List(); GPSPin currentPin; Dictionary pinListTitles = new Dictionary(); private WorldTracker wt; private const float EarthRadius = 6371000; IEnumerator Start() { wt = FindObjectOfType(); wt.geolocationSettings.OnGPSPositionUpdated.AddListener(UpdatePositions); closeButton.onClick.AddListener(HideEditPopup); placeButton.onClick.AddListener(()=>{ if(currentPin != null) { ChangePinLocation(currentPin); HideEditPopup(); } }); place10MButton.onClick.AddListener(()=>{ if(currentPin != null){ Add10MetersInFrontToGPS(currentPin); HideEditPopup(); } }); yield return new WaitForEndOfFrame(); InitializePinList(); } public void InitializePinList(){ foreach(var pin in wt.geolocationSettings.gpsPins){ pins.Add(pin); var pinListItem = Instantiate(pinListItemPrefab, pinListItemPrefab.transform.parent); var pinListTitle = pinListItem.transform.Find("Title").GetComponent(); pinListTitle.text = pin.id + " - " + "? m away"; pinListTitles.Add(pin, pinListTitle); pinListItem.transform.Find("Edit Button").GetComponent