예제 #1
0
        public void DragSelectionBox(Camera main, CursorPanGroup group, CursorButton button, TutorialAIManager manager, float delayTime, string methodName)
        {
            BoxSelector selector = main.GetComponent <BoxSelector>();

            if (selector == null)
            {
                Debug.LogError("Cannot find Box Selector component from camera, " + main.ToString() + ".");
                return;
            }

            if (button != CursorButton.Left_Click)
            {
                Debug.LogError("Selection box only works with left mouse button.");
                return;
            }

            selector.StartBoxSelection(group, 0.5f);
            this.icon.SetButton(button);
            this.buttonPressedElapsedTime = 0f;
            this.isButtonPressed          = true;
            this.isButtonHeld             = true;
            this.isAppearing            = true;
            this.panningElapsedTime     = 0f;
            this.startingPosition       = group.start;
            this.endingPosition         = group.end;
            this.rectTransform.position = group.start;

            manager.Invoke(methodName, delayTime);
            this.Invoke("HeldButtonRelease", delayTime);
        }
예제 #2
0
        public void DragSelectionBox(Camera main, CursorPanGroup group, CursorButton button, TutorialAIManager manager, float delayTime, string methodName)
        {
            BoxSelector selector = main.GetComponent<BoxSelector>();
            if (selector == null) {
                Debug.LogError("Cannot find Box Selector component from camera, " + main.ToString() + ".");
                return;
            }

            if (button != CursorButton.Left_Click) {
                Debug.LogError("Selection box only works with left mouse button.");
                return;
            }

            selector.StartBoxSelection(group, 0.5f);
            this.icon.SetButton(button);
            this.buttonPressedElapsedTime = 0f;
            this.isButtonPressed = true;
            this.isButtonHeld = true;
            this.isAppearing = true;
            this.panningElapsedTime = 0f;
            this.startingPosition = group.start;
            this.endingPosition = group.end;
            this.rectTransform.position = group.start;

            manager.Invoke(methodName, delayTime);
            this.Invoke("HeldButtonRelease", delayTime);
        }
예제 #3
0
        public bool PanCursorWithHeldAction(CursorPanGroup group, CursorButton button, TutorialAIManager manager, float delayTime, string methodName, bool heldFlag)
        {
            if (this.isPanning)
            {
                return(false);
            }

            this.startingPosition            = group.start;
            this.endingPosition              = group.end;
            this.rectTransform.localPosition = group.start;
            this.panningElapsedTime          = 0f;
            this.isAppearing = true;


            //NOTE(Thompson): I have no idea what the codes below are doing. CursorPanGroup should already have the coordinates set before this.
            ObtainStartingPosition s = this.GetComponentInChildren <ObtainStartingPosition>();

            s.rectTransform.localPosition = group.start;
            ObtainEndingPosition e = this.GetComponentInChildren <ObtainEndingPosition>();

            e.rectTransform.localPosition = group.end;

            if (!button.Equals(CursorButton.Nothing))
            {
                this.icon.SetButton(button);
                this.buttonPressedElapsedTime = 0f;
                this.isButtonPressed          = true;
                this.isButtonHeld             = heldFlag;
            }

            manager.Invoke(methodName, delayTime);
            return(true);
        }
예제 #4
0
        public bool PanCursorWithAction(CursorPanGroup group, CursorButton button, TutorialAIManager manager, float delayTime, string methodName)
        {
            if (this.isPanning)
            {
                return(false);
            }

            this.startingPosition            = group.start;
            this.endingPosition              = group.end;
            this.rectTransform.localPosition = group.start;
            this.panningElapsedTime          = 0f;
            this.isAppearing = true;


            ObtainStartingPosition s = this.GetComponentInChildren <ObtainStartingPosition>();

            s.rectTransform.localPosition = group.start;
            ObtainEndingPosition e = this.GetComponentInChildren <ObtainEndingPosition>();

            e.rectTransform.localPosition = group.end;

            if (!button.Equals(CursorButton.Nothing))
            {
                this.icon.SetButton(button);
                this.buttonPressedElapsedTime = 0f;
                this.isButtonPressed          = true;
            }

            manager.Invoke(methodName, delayTime);
            return(true);
        }
예제 #5
0
        /// <summary>
        /// True if the cursor is already panning, and I do not want to disturb the panning in progress.
        /// False if the cursor has finished panning, and there's nothing else to do.
        /// </summary>
        /// <param name="start">Vector3 position to indicate where the cursor begins the panning animation.</param>
        /// <param name="end">Vector3 position to indicate where the cursor ends in the panning animation.</param>
        /// <returns></returns>
        public bool PanCursor(CursorPanGroup group, CursorButton button)
        {
            if (this.isPanning)
            {
                return(false);
            }
            this.startingPosition            = group.start;
            this.endingPosition              = group.end;
            this.rectTransform.localPosition = group.start;
            this.panningElapsedTime          = 0f;
            this.isAppearing = true;


            ObtainStartingPosition s = this.GetComponentInChildren <ObtainStartingPosition>();

            s.rectTransform.localPosition = group.start;
            ObtainEndingPosition e = this.GetComponentInChildren <ObtainEndingPosition>();

            e.rectTransform.localPosition = group.end;

            if (!button.Equals(CursorButton.Nothing))
            {
                this.icon.SetButton(button);
                this.buttonPressedElapsedTime = 0f;
                this.isButtonPressed          = true;
                this.isButtonHeld             = false;
            }

            return(true);
        }
예제 #6
0
        public void StartBoxSelection(CursorPanGroup group, float extraTime)
        {
            float startX = group.start.x / Screen.width;
            float startY = group.start.y / Screen.height;
            float endX   = group.end.x / Screen.width;
            float endY   = group.end.y / Screen.height;

            this.viewport_startVertex.x = startX;
            this.viewport_startVertex.y = startY;
            this.viewport_startVertex.z = 0f;

            this.viewport_endVertex.x = endX;
            this.viewport_endVertex.y = endY;
            this.viewport_endVertex.z = 0f;

            this.panningElapsedTime = 0f - extraTime;
        }
예제 #7
0
        public void StartBoxSelection(CursorPanGroup group, float extraTime)
        {
            float startX = group.start.x / Screen.width;
            float startY = group.start.y / Screen.height;
            float endX = group.end.x / Screen.width;
            float endY = group.end.y / Screen.height;

            this.viewport_startVertex.x = startX;
            this.viewport_startVertex.y = startY;
            this.viewport_startVertex.z = 0f;

            this.viewport_endVertex.x = endX;
            this.viewport_endVertex.y = endY;
            this.viewport_endVertex.z = 0f;

            this.panningElapsedTime = 0f - extraTime;
        }
예제 #8
0
        public bool PanCursorWithHeldAction(CursorPanGroup group, CursorButton button, TutorialAIManager manager, float delayTime, string methodName, bool heldFlag)
        {
            if (this.isPanning) {
                return false;
            }

            this.startingPosition = group.start;
            this.endingPosition = group.end;
            this.rectTransform.localPosition = group.start;
            this.panningElapsedTime = 0f;
            this.isAppearing = true;

            //NOTE(Thompson): I have no idea what the codes below are doing. CursorPanGroup should already have the coordinates set before this.
            ObtainStartingPosition s = this.GetComponentInChildren<ObtainStartingPosition>();
            s.rectTransform.localPosition = group.start;
            ObtainEndingPosition e = this.GetComponentInChildren<ObtainEndingPosition>();
            e.rectTransform.localPosition = group.end;

            if (!button.Equals(CursorButton.Nothing)) {
                this.icon.SetButton(button);
                this.buttonPressedElapsedTime = 0f;
                this.isButtonPressed = true;
                this.isButtonHeld = heldFlag;
            }

            manager.Invoke(methodName, delayTime);
            return true;
        }
예제 #9
0
        public bool PanCursorWithAction(CursorPanGroup group, CursorButton button, TutorialAIManager manager, float delayTime, string methodName)
        {
            if (this.isPanning) {
                return false;
            }

            this.startingPosition = group.start;
            this.endingPosition = group.end;
            this.rectTransform.localPosition = group.start;
            this.panningElapsedTime = 0f;
            this.isAppearing = true;

            ObtainStartingPosition s = this.GetComponentInChildren<ObtainStartingPosition>();
            s.rectTransform.localPosition = group.start;
            ObtainEndingPosition e = this.GetComponentInChildren<ObtainEndingPosition>();
            e.rectTransform.localPosition = group.end;

            if (!button.Equals(CursorButton.Nothing)) {
                this.icon.SetButton(button);
                this.buttonPressedElapsedTime = 0f;
                this.isButtonPressed = true;
            }

            manager.Invoke(methodName, delayTime);
            return true;
        }
예제 #10
0
        /// <summary>
        /// True if the cursor is already panning, and I do not want to disturb the panning in progress.
        /// False if the cursor has finished panning, and there's nothing else to do.
        /// </summary>
        /// <param name="start">Vector3 position to indicate where the cursor begins the panning animation.</param>
        /// <param name="end">Vector3 position to indicate where the cursor ends in the panning animation.</param>
        /// <returns></returns>
        public bool PanCursor(CursorPanGroup group, CursorButton button)
        {
            if (this.isPanning) {
                return false;
            }
            this.startingPosition = group.start;
            this.endingPosition = group.end;
            this.rectTransform.localPosition = group.start;
            this.panningElapsedTime = 0f;
            this.isAppearing = true;

            ObtainStartingPosition s = this.GetComponentInChildren<ObtainStartingPosition>();
            s.rectTransform.localPosition = group.start;
            ObtainEndingPosition e = this.GetComponentInChildren<ObtainEndingPosition>();
            e.rectTransform.localPosition = group.end;

            if (!button.Equals(CursorButton.Nothing)) {
                this.icon.SetButton(button);
                this.buttonPressedElapsedTime = 0f;
                this.isButtonPressed = true;
                this.isButtonHeld = false;
            }

            return true;
        }