Esempio n. 1
0
 private void SetCurrentAnnotation(AnnotationController a)
 {
     ClearCurrentAnnotation();
     _currentAnnotation = a;
     ToolboxController.gameObject.SetActive(true);
     ToolboxController.AttachAnnotation(a);
     AnnotateButton.gameObject.SetActive(false);
 }
Esempio n. 2
0
        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);
        }
Esempio n. 4
0
        private void ClearCurrentAnnotation()
        {
            if (_currentAnnotation == null)
            {
                return;
            }

            ToolboxController.DetachAnnotation();
            ToolboxController.gameObject.SetActive(false);
            _currentAnnotation = null;
            AnnotateButton.gameObject.SetActive(true);
        }
Esempio n. 5
0
        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;
        }
Esempio n. 6
0
        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();
        }