Ejemplo n.º 1
0
        internal override bool Seize(Event currentEvent, ref Vector3 position, ref string message)
        {
            if (menu.Active)
            {
                menu.OnGui(currentEvent);
                DrawActiveAnimatedTexture(menu.Point2DPosition);

                var okMessage = menu.ActiveItem != null && menu.ActiveItem.Description != null
                    ? "Release Ctrl to " + menu.ActiveItem.Description
                    : "Hover over an option and release Ctrl.";

                //out params
                position = menu.Point3DPosition;
                message  = BGSceneViewOverlay.ToOk(okMessage) + "\r\n" + menu.Details;
                //============== Ok
                return(true);
            }

            if (!(currentEvent.type == EventType.Repaint && currentEvent.control || currentEvent.type == EventType.MouseMove && currentEvent.control))
            {
                return(false);
            }

            if (Process(currentEvent, overlay.Editor.Editor.Math, BGEditorUtility.GetSceneViewHeight(), ref position, ref message))
            {
                return(true);
            }

            pointIndicatorTransition = null;

            //============== No luck
            return(false);
        }
Ejemplo n.º 2
0
 protected static string SuccessMessage(string message)
 {
     return(BGSceneViewOverlay.ToOk("Hover over an option and release Ctrl.\r\n") + message);
 }
        //see base class for description
        internal override bool Seize(Event currentEvent, ref Vector3 position, ref string message)
        {
            if (!Comply(currentEvent))
            {
                return(false);
            }


            Vector3 intersectionPosition;
            Plane   plane;


            if (currentEvent.type == EventType.mouseDown && currentEvent.control && currentEvent.button == 0)
            {
                //Mouse down for some action
                var curve    = overlay.Editor.Curve;
                var settings = overlay.Editor.Settings;

                Cast(currentEvent, HandleUtility.GUIPointToWorldRay(currentEvent.mousePosition), out intersectionPosition, out message, out plane);

                if (message != null)
                {
                    BGCurveEditor.OverlayMessage.Display(message);
                }
                else
                {
                    position = intersectionPosition;
                    BGCurveEditor.AddPoint(curve,
                                           BGNewPointPositionManager.CreatePoint(intersectionPosition, curve, settings.ControlType, settings.Sections, true),
                                           curve.PointsCount);
                }
                overlay.EventCanceller = new BGEditorUtility.EventCanceller();
                return(true);
            }


            if (!(currentEvent.type == EventType.Repaint && currentEvent.control || currentEvent.type == EventType.MouseMove && currentEvent.control))
            {
                return(false);
            }

            var ray = HandleUtility.GUIPointToWorldRay(currentEvent.mousePosition);

            Cast(currentEvent, ray, out intersectionPosition, out message, out plane);

            position = intersectionPosition;

            if (message != null)
            {
                return(true);
            }

            Animation(plane, ray, swayTransition);

            //preview
            float toLast = -1, toFirst = -1;

            Preview(intersectionPosition, overlay.Editor.Curve, ref toLast, ref toFirst);

            //distance
            message = BGSceneViewOverlay.ToOk("MouseClick to add a point\r\n") +
                      //to last
                      (toLast < 0 ? "First point is ready to go!" : "Distance to last=" + toLast) +
                      //to first
                      (toFirst < 0 ? "" : ", to first=" + toFirst);
            return(true);
        }