Ejemplo n.º 1
0
        public void Process(Event currentEvent)
        {
            if (!On && currentEvent.control)
            {
                On = true;
            }

            if (!On)
            {
                return;
            }

            if (On && !currentEvent.control)
            {
                On = false;
            }

            if (currentEvent.type == EventType.MouseUp)
            {
                BGEditorUtility.Release(ref EventCanceller);
            }

            if (currentEvent.shift && !currentEvent.control)
            {
                return;
            }

            if (!BGEditorUtility.IsMouseInsideSceneView())
            {
                return;
            }

            foreach (var action in actions)
            {
                var    position = Vector3.zero;
                string message  = null;

                if (!action.Seize(currentEvent, ref position, ref message))
                {
                    continue;
                }

                if (message != null)
                {
                    Message(action, position, message);
                }
                break;
            }

            if (currentEvent.control && currentEvent.type != EventType.Repaint)
            {
                SceneView.RepaintAll();
            }
        }
Ejemplo n.º 2
0
        public void Process(Event currentEvent)
        {
            if (!On && currentEvent.control)
            {
                On = true;
            }

            if (!On)
            {
                return;
            }

            if (On && !currentEvent.control)
            {
                On = false;
            }

            if (currentEvent.type == EventType.mouseUp)
            {
                BGEditorUtility.Release(ref EventCanceller);
            }

            if (currentEvent.shift && !currentEvent.control)
            {
                return;
            }

            if (!BGEditorUtility.IsMouseInsideSceneView())
            {
                return;
            }

            BGEditorUtility.Assign(ref style, () => new GUIStyle("Label")
            {
                padding   = new RectOffset(4, 4, 4, 4),
                border    = new RectOffset(4, 4, 4, 4),
                fontStyle = FontStyle.Bold,
                richText  = true,
                normal    = new GUIStyleState
                {
                    textColor  = Color.white,
                    background = BGEditorUtility.LoadTexture2D(BGEditorUtility.Image.BGBoxWithBorder123)
                }
            });


            foreach (var action in actions)
            {
                var    position = Vector3.zero;
                string message  = null;

                if (!action.Seize(currentEvent, ref position, ref message))
                {
                    continue;
                }

                if (message != null)
                {
                    Message(action, position, message);
                }
                break;
            }

            if (currentEvent.control && currentEvent.type != EventType.Repaint)
            {
                SceneView.RepaintAll();
            }
        }