static public void Parse(string comment, AnnotationHandler handler) { int len = comment.Length; int pos = 0; while (true) { pos = comment.IndexOf("@{", pos); if (pos == -1) { break; } pos += 2; int start = pos; while (pos < len) { char c = comment[pos]; if (!Char.IsLetterOrDigit(c) && c != '_') { break; } pos++; } if (pos == len) { break; } StringBuilder data = new StringBuilder(); string type = comment.Substring(start, pos - start); while (true) { start = pos; pos = comment.IndexOfAny(new char[] { '}', '\\' }, pos); if (pos == -1) { break; } data.Append(comment.Substring(start, pos - start)); if (comment[pos] == '\\') { pos++; if (pos >= len) { break; } data.Append(comment[pos]); pos++; } else { break; } } pos++; handler(type, data.ToString()); } }
void Start() { //object that updates camera position based on player position StartCoroutine(setPositionOnVuforiaEnabled()); //get reference to WWWHandler and get server data and parse it if (wwwHandler != null) { wwwScript = (WWWHandler)wwwHandler.gameObject.GetComponent(typeof(WWWHandler)); } //get reference to map handler script if (mapObject != null) { map = (Mapbox.Unity.Map.AbstractMap)mapObject.GetComponent((typeof(Mapbox.Unity.Map.AbstractMap))); } if (directionsObject != null) { directionHandler = (DirectionsHandler)directionsObject.GetComponent(typeof(DirectionsHandler)); } if (annotationObject != null) { annotationHandler = (AnnotationHandler)annotationObject.GetComponent(typeof(AnnotationHandler)); } if (uiObject != null) { uiHandler = (UIManager)uiObject.GetComponent(typeof(UIManager)); } if (playerObject == null) { playerObject = GameObject.FindGameObjectWithTag("Player"); } if (playerLocation == null) { playerLocation = GameObject.FindGameObjectWithTag("playerLocation"); } if (cameraPosition == null) { cameraPosition = GameObject.FindGameObjectWithTag("cameraPosition"); } StartCoroutine(directionHandler.waitForMapLoad()); nextPlayerPosition = playerObject.transform.localPosition; }
void Start() { resultList = new List <GameObject> (); nearbyTrails = new List <string[]> (); trailNames = new List <string> (); searchScrollView.gameObject.SetActive(false); annotationInput.gameObject.SetActive(false); if (cameraObject != null) { cameraHandler = (CameraHandler)cameraObject.gameObject.GetComponent(typeof(CameraHandler)); } if (camera2D != null) { quadTreeCameraMovement = (Mapbox.Examples.QuadTreeCameraMovement)camera2D.GetComponent(typeof(Mapbox.Examples.QuadTreeCameraMovement)); quadTreeCameraMovement.enabled = false; } if (menuObject != null) { menuHandler = (MenuScript)menuObject.gameObject.GetComponent(typeof(MenuScript)); } if (wwwHandler != null) { wwwScript = (WWWHandler)wwwHandler.gameObject.GetComponent(typeof(WWWHandler)); } else { wwwHandler = GameObject.FindGameObjectWithTag("WWWObject"); wwwScript = (WWWHandler)wwwHandler.GetComponent <WWWHandler>(); } if (annotationObject != null) { annotationHandler = (AnnotationHandler)annotationObject.gameObject.GetComponent(typeof(AnnotationHandler)); } if (annotationObject != null) { annotationHandler = (AnnotationHandler)annotationObject.gameObject.GetComponent(typeof(AnnotationHandler)); } if (sceneObject != null) { sceneManager = (SceneManager)sceneObject.gameObject.GetComponent(typeof(SceneManager)); } if (directionsObjects != null) { directionsHandler = (DirectionsHandler)directionsObjects.gameObject.GetComponent(typeof(DirectionsHandler)); } if (searchDirectionsObject != null) { searchDirectionsHandler = (DirectionsHandler)searchDirectionsObject.gameObject.GetComponent(typeof(DirectionsHandler)); } isHiking = false; StartCoroutine(initUser()); createAnnotationButton.onClick.AddListener(onClickAnnotation); submitAnnotationButton.onClick.AddListener(onAnnotationSubmit); exitSelectionButton.onClick.AddListener(disable2D); hikeButton.onClick.AddListener(onHike); mapButton.onClick.AddListener(() => enable2D(true)); exploreButton.onClick.AddListener(enableExplore); placesButton.onClick.AddListener(enablePlaces); settingsButton.onClick.AddListener(enableSettings); toggleARButton.onClick.AddListener(disable2D); exitHikeButton.onClick.AddListener(exitHike); recenterButton.onClick.AddListener(recenter); inAR = true; usernameText.text = GlobalUserManager.Instance.username; }