private void SetCurrentAnnotation(AnnotationController a) { ClearCurrentAnnotation(); _currentAnnotation = a; ToolboxController.gameObject.SetActive(true); ToolboxController.AttachAnnotation(a); AnnotateButton.gameObject.SetActive(false); }
public void AddAnnotation(AnnotationController annotationController) { var marker = Instantiate(MapMarkerPrefab); marker.transform.SetParent(_canvas.transform, false); _annotationControllers.Add(annotationController, marker); marker.GetComponent <Button>().onClick.AddListener(annotationController.StartReadyMode); }
public void AddAnnotation(AnnotationController annotationController) { // Create an instance of the map marker and set it as a child of the canvas so that it is displayed. // Then add the annotationController with the marker and start the listener for a button click. var marker = Instantiate(MapMarkerPrefab); marker.transform.SetParent(_canvas.transform, false); _annotationControllers.Add(annotationController, marker); marker.GetComponent <Button>().onClick.AddListener(annotationController.StartReadyMode); }
private void ClearCurrentAnnotation() { if (_currentAnnotation == null) { return; } ToolboxController.DetachAnnotation(); ToolboxController.gameObject.SetActive(false); _currentAnnotation = null; AnnotateButton.gameObject.SetActive(true); }
public void DetachAnnotation() { // Clear event listeners CloseButton.onClick.RemoveAllListeners(); AnchorButton.onClick.RemoveAllListeners(); DrawButton.onClick.RemoveAllListeners(); SurfaceDrawButton.onClick.RemoveAllListeners(); TextButton.onClick.RemoveAllListeners(); HoldToDrawButton.OnPointerDownHandler -= OnHoldToDrawButtonDown; HoldToDrawButton.OnPointerUpHandler -= OnHoldToDrawButtonUp; _currentAnnotationController.OnReadyMode -= OnReadyMode; _currentAnnotationController.OnAnchorMode -= OnAnchorMode; _currentAnnotationController.OnDrawMode -= OnDrawMode; _currentAnnotationController.OnSurfaceDrawMode -= OnSurfaceDrawMode; _currentAnnotationController = null; }
public void AttachAnnotation(AnnotationController annotationController) { // downwards actions CloseButton.onClick.AddListener(annotationController.ExitCurrentMode); AnchorButton.onClick.AddListener(annotationController.StartAnchorMode); DrawButton.onClick.AddListener(annotationController.StartDrawMode); SurfaceDrawButton.onClick.AddListener(annotationController.StartSurfaceDrawMode); PlaceAnchorButton.onClick.AddListener(annotationController.PlaceAnchor); HoldToDrawButton.OnPointerDownHandler += OnHoldToDrawButtonDown; HoldToDrawButton.OnPointerUpHandler += OnHoldToDrawButtonUp; // upward triggers annotationController.OnReadyMode += OnReadyMode; annotationController.OnAnchorMode += OnAnchorMode; annotationController.OnDrawMode += OnDrawMode; annotationController.OnSurfaceDrawMode += OnSurfaceDrawMode; _currentAnnotationController = annotationController; // init ui ShowModeUi(); ResetActionUi(); }