Exemplo n.º 1
0
    // ------------------------------------------------------------------
    // Desc:
    // ------------------------------------------------------------------

    void DoDispatchEvent(exUIControl _sender, List <exUIEventListener> _listeners, exUIEvent _event)
    {
        for (int i = 0; i < _listeners.Count; ++i)
        {
            exUIEventListener listener = _listeners[i];

            //
            if (_event.eventPhase == exUIEventPhase.Capture)
            {
                if (listener.capturePhase == false)
                {
                    continue;
                }
            }
            else if (_event.eventPhase == exUIEventPhase.Bubble)
            {
                if (listener.capturePhase)
                {
                    continue;
                }
            }

            //
            listener.func(_event);

            //
            // if ( _event.isPropagationStopped )
            //     break;
        }
    }
Exemplo n.º 2
0
    // ------------------------------------------------------------------
    // Desc:
    // ------------------------------------------------------------------

    public void AddChild(exUIControl _ctrl)
    {
        if (_ctrl == null)
        {
            return;
        }

        if (_ctrl.parent == this)
        {
            return;
        }

        // you can not add your parent or yourself as your child
        if (_ctrl.IsSelfOrAncestorOf(this))
        {
            return;
        }

        exUIControl lastParent = _ctrl.parent;

        if (lastParent != null)
        {
            lastParent.RemoveChild(_ctrl);
        }

        children.Add(_ctrl);
        _ctrl.parent = this;
    }
Exemplo n.º 3
0
    ///////////////////////////////////////////////////////////////////////////////
    //
    ///////////////////////////////////////////////////////////////////////////////

    // ------------------------------------------------------------------
    // Desc:
    // ------------------------------------------------------------------

    public void AddControl(exUIControl _ctrl)
    {
        if (controls.IndexOf(_ctrl) == -1)
        {
            controls.Add(_ctrl);
            exUIMng.FindAndAddChild(_ctrl);
        }
    }
Exemplo n.º 4
0
    // ------------------------------------------------------------------
    // Desc:
    // ------------------------------------------------------------------

    public new void OnSceneGUI()
    {
        exUIControl ctrl = target as exUIControl;

        Vector3[] vertices = ctrl.GetLocalVertices();
        if (vertices.Length > 0)
        {
            Rect      aabb = exGeometryUtility.GetAABoundingRect(vertices);
            Matrix4x4 l2w  = ctrl.transform.localToWorldMatrix;

            // draw control rect
            vertices = new Vector3[4] {
                l2w.MultiplyPoint3x4(new Vector3(aabb.xMin, aabb.yMin, 0)),
                l2w.MultiplyPoint3x4(new Vector3(aabb.xMin, aabb.yMax, 0)),
                l2w.MultiplyPoint3x4(new Vector3(aabb.xMax, aabb.yMax, 0)),
                l2w.MultiplyPoint3x4(new Vector3(aabb.xMax, aabb.yMin, 0)),
            };
            exEditorUtility.GL_DrawRectLine(vertices, new Color(1.0f, 0.0f, 0.5f, 1.0f), true);

            // draw scroll-view content
            exUIScrollView scrollView = ctrl as exUIScrollView;
            if (scrollView != null)
            {
                aabb.width = scrollView.contentSize.x;
                aabb.yMin  = aabb.yMax - scrollView.contentSize.y;

                float contentX = (scrollView.horizontalContentDir == exUIScrollView.ContentDirection.LeftToRight) ? 0.0f : (scrollView.contentSize.x - scrollView.width);
                float contentY = (scrollView.verticalContentDir == exUIScrollView.ContentDirection.TopToBottom) ? 0.0f : (scrollView.contentSize.y - scrollView.height);

                aabb.center += scrollView.scrollOffset;
                aabb.center += new Vector2(contentX, contentY);
                vertices     = new Vector3[4] {
                    l2w.MultiplyPoint3x4(new Vector3(aabb.xMin, aabb.yMin, 0)),
                    l2w.MultiplyPoint3x4(new Vector3(aabb.xMin, aabb.yMax, 0)),
                    l2w.MultiplyPoint3x4(new Vector3(aabb.xMax, aabb.yMax, 0)),
                    l2w.MultiplyPoint3x4(new Vector3(aabb.xMax, aabb.yMin, 0)),
                };
                exEditorUtility.GL_DrawRectLine(vertices, new Color(0.0f, 0.5f, 1.0f, 1.0f), true);
            }
        }

        exPlane plane = target as exPlane;

        if (plane.hasSprite == false)
        {
            Vector3 size;
            Vector3 center;
            bool    changed = ProcessSceneEditorHandles(out size, out center);
            if (changed)
            {
                ApplyPlaneScale(plane, size, center);
            }
        }
    }
Exemplo n.º 5
0
    // ------------------------------------------------------------------
    // Desc:
    // ------------------------------------------------------------------

    public static exUIControl FindRoot(exUIControl _ctrl)
    {
        exUIControl root       = null;
        exUIControl parentCtrl = _ctrl;

        while (parentCtrl != null)
        {
            root       = parentCtrl;
            parentCtrl = parentCtrl.parent;
        }
        return(root);
    }
Exemplo n.º 6
0
 public void Reset()
 {
     active     = false;
     pressDown  = false;
     pressUp    = false;
     pos        = Vector2.zero;
     delta      = Vector2.zero;
     worldPos   = Vector3.zero;
     worldDelta = Vector3.zero;
     hover      = null;
     pressed    = null;
 }
Exemplo n.º 7
0
    // ------------------------------------------------------------------
    // Desc:
    // ------------------------------------------------------------------

    void Awake()
    {
        exUIControl control = GetComponent <exUIControl>();

        if (control != null)
        {
            Type controlType = control.GetType();

            foreach (Emitter emitter in emitterList)
            {
                EventInfo eventInfo = controlType.GetEvent(emitter.eventName);
                if (eventInfo != null)
                {
                    foreach (SlotInfo slot in emitter.slots)
                    {
                        bool foundMethod = false;

                        MonoBehaviour[] allMonoBehaviours = slot.receiver.GetComponents <MonoBehaviour>();
                        foreach (MonoBehaviour monoBehaviour in allMonoBehaviours)
                        {
                            MethodInfo mi = monoBehaviour.GetType().GetMethod(slot.method,
                                                                              BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic,
                                                                              null,
                                                                              new Type [] {
                                typeof(GameObject),
                            },
                                                                              null);
                            if (mi != null)
                            {
                                Delegate delegateForMethod = Delegate.CreateDelegate(typeof(System.Action <GameObject>), monoBehaviour, mi);
                                eventInfo.AddEventHandler(control, delegateForMethod);
                                foundMethod = true;
                            }
                        }

                        if (foundMethod == false)
                        {
                            Debug.LogWarning("Can not find method " + slot.method + " in " + slot.receiver.name);
                        }
                    }
                }
                else
                {
                    Debug.LogWarning("Can not find event " + emitter.eventName + " in " + gameObject.name);
                }
            }
        }
        else
        {
            Debug.LogWarning("Can not find exUIControl in this GameObject");
        }
    }
Exemplo n.º 8
0
    exUIControl focus        = null; // the Input focus ( usually, the keyboard focus )

    ///////////////////////////////////////////////////////////////////////////////
    // static functions
    ///////////////////////////////////////////////////////////////////////////////

    // ------------------------------------------------------------------
    // Desc:
    // ------------------------------------------------------------------

    public static List <exUIControl> GetRoutine(exUIControl _ctrl)
    {
        List <exUIControl> routine = new List <exUIControl>();

        exUIControl parentCtrl = _ctrl.parent;

        while (parentCtrl != null)
        {
            routine.Add(parentCtrl);
            parentCtrl = parentCtrl.parent;
        }
        return(routine);
    }
Exemplo n.º 9
0
    // ------------------------------------------------------------------
    // Desc:
    // ------------------------------------------------------------------

    public void RemoveChild(exUIControl _ctrl)
    {
        if (_ctrl == null)
        {
            return;
        }

        int idx = children.IndexOf(_ctrl);

        if (idx != -1)
        {
            children.RemoveAt(idx);
            _ctrl.parent = null;
        }
    }
Exemplo n.º 10
0
    // ------------------------------------------------------------------
    // Desc:
    // ------------------------------------------------------------------

    static void FindAndAddChildRecursively(exUIControl _ctrl, Transform _trans)
    {
        foreach (Transform child in _trans)
        {
            exUIControl childCtrl = child.GetComponent <exUIControl>();
            if (childCtrl)
            {
                _ctrl.AddChild(childCtrl);
                FindAndAddChild(childCtrl);
            }
            else
            {
                FindAndAddChildRecursively(_ctrl, child);
            }
        }
    }
Exemplo n.º 11
0
    ///////////////////////////////////////////////////////////////////////////////
    // functions
    ///////////////////////////////////////////////////////////////////////////////

    // ------------------------------------------------------------------
    // Desc:
    // ------------------------------------------------------------------

    void Awake()
    {
        exUIControl ctrl = GetComponent <exUIControl>();

        if (ctrl)
        {
            if (scaleInfos != null)
            {
                for (int j = 0; j < scaleInfos.Count; ++j)
                {
                    EffectInfo_Scale info = scaleInfos[j];

                    EffectState_Scale state = new EffectState_Scale();
                    state.info = info;
                    state.func = info.GetCurveFunction();
                    AddState_Scale(ctrl, state);
                }
            }

            if (offsetInfos != null)
            {
                for (int j = 0; j < offsetInfos.Count; ++j)
                {
                    EffectInfo_Offset info = offsetInfos[j];

                    EffectState_Offset state = new EffectState_Offset();
                    state.info = info;
                    state.func = info.GetCurveFunction();
                    AddState_Offset(ctrl, state);
                }
            }

            if (colorInfos != null)
            {
                for (int j = 0; j < colorInfos.Count; ++j)
                {
                    EffectInfo_Color info = colorInfos[j];

                    EffectState_Color state = new EffectState_Color();
                    state.info = info;
                    state.func = info.GetCurveFunction();
                    AddState_Color(ctrl, state);
                }
            }
        }
    }
Exemplo n.º 12
0
    // ------------------------------------------------------------------
    // Desc:
    // ------------------------------------------------------------------

    exUIControl RecursivelyGetUIControl(exUIControl _ctrl, Vector2 _worldPos)
    {
        if (_ctrl.gameObject.activeSelf == false || _ctrl.activeSelf == false)
        {
            return(null);
        }

        //
        bool checkChildren = false;

        if (_ctrl.useCollider)
        {
            checkChildren = true;
        }
        else
        {
            Vector2 localPos = new Vector2(_worldPos.x - _ctrl.transform.position.x,
                                           _worldPos.y - _ctrl.transform.position.y);

            Rect boundingRect = _ctrl.GetLocalAABoundingRect();
            checkChildren = boundingRect.Contains(localPos);
        }

        //
        if (checkChildren)
        {
            for (int i = 0; i < _ctrl.children.Count; ++i)
            {
                exUIControl childCtrl  = _ctrl.children[i];
                exUIControl resultCtrl = RecursivelyGetUIControl(childCtrl, _worldPos);
                if (resultCtrl != null)
                {
                    return(resultCtrl);
                }
            }

            if (_ctrl.useCollider == false)
            {
                return(_ctrl);
            }
        }

        return(null);
    }
Exemplo n.º 13
0
    // ------------------------------------------------------------------
    // Desc:
    // ------------------------------------------------------------------

    exUIControl PickControl(Vector2 _screenPos)
    {
        // pick 2D controls
        Vector3 worldPointerPos = camera.ScreenToWorldPoint(_screenPos);

        controls.Sort(controlSorterByPrioirty);
        for (int i = 0; i < controls.Count; ++i)
        {
            exUIControl ctrl       = controls[i];
            exUIControl resultCtrl = RecursivelyGetUIControl(ctrl, worldPointerPos);
            if (resultCtrl != null)
            {
                return(resultCtrl);
            }
        }

        // pick ray-cast controls
        Ray ray = camera.ScreenPointToRay(_screenPos);

        ray.origin = new Vector3(ray.origin.x, ray.origin.y, camera.transform.position.z);
        RaycastHit[] hits = Physics.RaycastAll(ray);

        List <exUIControl> hitControls = new List <exUIControl>();

        for (int i = 0; i < hits.Length; ++i)
        {
            RaycastHit  hit  = hits[i];
            GameObject  go   = hit.collider.gameObject;
            exUIControl ctrl = go.GetComponent <exUIControl>();
            if (ctrl && ctrl.gameObject.activeInHierarchy && ctrl.activeInHierarchy)
            {
                hitControls.Add(ctrl);
            }
        }
        if (hitControls.Count > 0)
        {
            hitControls.Sort(controlSorterByLevel);
            return(hitControls[hitControls.Count - 1]);
        }

        return(null);
    }
Exemplo n.º 14
0
    // ------------------------------------------------------------------
    // Desc:
    // ------------------------------------------------------------------

    static void AddEventListeners(exUIControl _ctrl, string _eventName, List <SlotInfo> _slots)
    {
        foreach (SlotInfo slot in _slots)
        {
            bool foundMethod = false;
            if (slot.receiver == null)
            {
                continue;
            }

            MonoBehaviour[] allMonoBehaviours = slot.receiver.GetComponents <MonoBehaviour>();
            for (int i = 0; i < allMonoBehaviours.Length; ++i)
            {
                MonoBehaviour monoBehaviour = allMonoBehaviours[i];

                // don't get method from control
                if (monoBehaviour is exUIControl)
                {
                    continue;
                }

                MethodInfo mi = monoBehaviour.GetType().GetMethod(slot.method,
                                                                  BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic,
                                                                  null,
                                                                  new Type[] { typeof(exUIEvent) },
                                                                  null);
                if (mi != null)
                {
                    Action <exUIEvent> func
                        = (Action <exUIEvent>)Delegate.CreateDelegate(typeof(Action <exUIEvent>), monoBehaviour, mi);
                    _ctrl.AddEventListener(_eventName, func, slot.capturePhase);
                    foundMethod = true;
                }
            }

            if (foundMethod == false)
            {
                Debug.LogWarning("Can not find method " + slot.method + " in " + slot.receiver.name);
            }
        }
    }
Exemplo n.º 15
0
    // ------------------------------------------------------------------
    // Desc:
    // ------------------------------------------------------------------

    public void SetFocus(exUIControl _ctrl)
    {
        if (focus != _ctrl)
        {
            exUIControl unfocus = focus;
            if (focus != null)
            {
                exUIFocusEvent focusEvent = new exUIFocusEvent();
                focusEvent.relatedTarget = focus;
                focus.OnUnfocus(focusEvent);
            }

            focus = _ctrl;

            if (focus != null)
            {
                exUIFocusEvent focusEvent = new exUIFocusEvent();
                focusEvent.relatedTarget = unfocus;
                focus.OnFocus(focusEvent);
            }
        }
    }
Exemplo n.º 16
0
    // ------------------------------------------------------------------
    // Desc:
    // ------------------------------------------------------------------

    public void AddEffect_Offset(exSpriteBase _target, EffectEventType _type, exEase.Type _curveType, Vector2 _to, float _duration)
    {
        exUIControl ctrl = GetComponent <exUIControl>();

        if (ctrl)
        {
            EffectInfo_Offset info = new EffectInfo_Offset();
            info.duration  = _duration;
            info.target    = _target;
            info.normal    = _target.offset;
            info.curveType = _curveType;

            EffectInfo_Offset.PropInfo propInfo = new EffectInfo_Offset.PropInfo();
            propInfo.type = _type;
            propInfo.val  = _to;
            info.propInfos.Add(propInfo);

            EffectState_Offset state = new EffectState_Offset();
            state.info = info;
            state.func = info.GetCurveFunction();
            AddState_Offset(ctrl, state);
        }
    }
Exemplo n.º 17
0
    // ------------------------------------------------------------------
    // Desc:
    // ------------------------------------------------------------------

    public void AddEffect_Scale(Transform _target, EffectEventType _type, exEase.Type _curveType, Vector3 _to, float _duration)
    {
        exUIControl ctrl = GetComponent <exUIControl>();

        if (ctrl)
        {
            EffectInfo_Scale info = new EffectInfo_Scale();
            info.duration  = _duration;
            info.target    = _target;
            info.normal    = _target.localScale;
            info.curveType = _curveType;

            EffectInfo_Scale.PropInfo propInfo = new EffectInfo_Scale.PropInfo();
            propInfo.type = _type;
            propInfo.val  = _to;
            info.propInfos.Add(propInfo);

            EffectState_Scale state = new EffectState_Scale();
            state.info = info;
            state.func = info.GetCurveFunction();
            AddState_Scale(ctrl, state);
        }
    }
Exemplo n.º 18
0
    // ------------------------------------------------------------------
    // Desc:
    // ------------------------------------------------------------------

    public bool IsSelfOrAncestorOf(exUIControl _ctrl)
    {
        if (_ctrl == null)
        {
            return(false);
        }

        if (_ctrl == this)
        {
            return(true);
        }

        exUIControl next = _ctrl.parent;

        while (next != null)
        {
            if (next == this)
            {
                return(true);
            }
            next = next.parent;
        }
        return(false);
    }
Exemplo n.º 19
0
    // ------------------------------------------------------------------
    // Desc:
    // ------------------------------------------------------------------

    void HandleHotPoints(exHotPoint[] _hotPoints, bool _isMouse)
    {
        // ========================================================
        // handle hover event
        // ========================================================

        int hotPointCountForMouse = _isMouse ? 1 : _hotPoints.Length;

        for (int i = 0; i < hotPointCountForMouse; ++i)
        {
            exHotPoint hotPoint = _hotPoints[i];

            if (hotPoint.active == false)
            {
                continue;
            }

            if (hotPoint.pressed != null && hotPoint.pressed.grabMouseOrTouch)
            {
                continue;
            }

            // get hot control
            exUIControl lastCtrl = hotPoint.hover;
            exUIControl curCtrl  = PickControl(hotPoint.pos);
            hotPoint.hover = curCtrl;

            if (lastCtrl != curCtrl)
            {
                exUIPointInfo pointInfo = new exUIPointInfo();
                pointInfo.id         = hotPoint.id;
                pointInfo.pos        = hotPoint.pos;
                pointInfo.delta      = hotPoint.delta;
                pointInfo.worldPos   = hotPoint.worldPos;
                pointInfo.worldDelta = hotPoint.worldDelta;

                exUIPointEvent pointEvent = new exUIPointEvent();
                pointEvent.isMouse    = hotPoint.isMouse;
                pointEvent.pointInfos = new exUIPointInfo [] {
                    pointInfo
                };

                // on hover out
                if (lastCtrl != null)
                {
                    lastCtrl.OnHoverOut(pointEvent);
                }

                // on hover in
                if (curCtrl != null)
                {
                    pointEvent.Reset();
                    curCtrl.OnHoverIn(pointEvent);

                    if (hotPoint.isTouch)
                    {
                        hotPoint.pressDown = true;
                    }
                }
            }
        }

        if (_isMouse)
        {
            for (int i = 1; i < _hotPoints.Length; ++i)
            {
                _hotPoints[i].hover = _hotPoints[0].hover;
            }

            // ========================================================
            // send scroll wheel event
            // ========================================================

            float scroll = Input.GetAxis("Mouse ScrollWheel");
            if (scroll != 0.0f && _hotPoints[0].hover != null)
            {
                exUIWheelEvent wheelEvent = new exUIWheelEvent();
                wheelEvent.delta = scroll;
                _hotPoints[0].hover.OnEXMouseWheel(wheelEvent);
            }
        }

        // ========================================================
        // handle press down event
        // ========================================================

        for (int i = 0; i < _hotPoints.Length; ++i)
        {
            exHotPoint hotPoint = _hotPoints[i];

            if (hotPoint.active == false)
            {
                continue;
            }

            if (hotPoint.pressDown)
            {
                exUIControl curCtrl = hotPoint.hover;
                if (hotPoint.pressed != null && hotPoint.pressed.grabMouseOrTouch)
                {
                    curCtrl = hotPoint.pressed;
                }

                // send press down event
                if (curCtrl != null)
                {
                    exUIPointInfo pointInfo = new exUIPointInfo();
                    pointInfo.id         = hotPoint.id;
                    pointInfo.pos        = hotPoint.pos;
                    pointInfo.delta      = hotPoint.delta;
                    pointInfo.worldPos   = hotPoint.worldPos;
                    pointInfo.worldDelta = hotPoint.worldDelta;

                    exUIPointEvent pointEvent = new exUIPointEvent();
                    pointEvent.isMouse    = hotPoint.isMouse;
                    pointEvent.pointInfos = new exUIPointInfo [] {
                        pointInfo
                    };

                    curCtrl.OnPressDown(pointEvent);
                }
                hotPoint.pressed = curCtrl;
            }
        }

        // ========================================================
        // handle moving before press-up
        // ========================================================

        Dictionary <exUIControl, List <exHotPoint> > moveEvents = new Dictionary <exUIControl, List <exHotPoint> >();

        // collect press move event
        for (int i = 0; i < _hotPoints.Length; ++i)
        {
            exHotPoint hotPoint = _hotPoints[i];

            if (hotPoint.active == false)
            {
                continue;
            }

            if (hotPoint.delta != Vector2.zero)
            {
                exUIControl curCtrl = hotPoint.hover;
                if (hotPoint.pressed != null && hotPoint.pressed.grabMouseOrTouch)
                {
                    curCtrl = hotPoint.pressed;
                }

                if (curCtrl != null)
                {
                    List <exHotPoint> hotPointList = null;
                    if (moveEvents.ContainsKey(curCtrl))
                    {
                        hotPointList = moveEvents[curCtrl];
                    }
                    else
                    {
                        hotPointList = new List <exHotPoint>();
                        moveEvents.Add(curCtrl, hotPointList);
                    }
                    hotPointList.Add(hotPoint);
                }
            }
        }

        // send hot-point move event
        foreach (KeyValuePair <exUIControl, List <exHotPoint> > iter in moveEvents)
        {
            exUIPointEvent pointEvent = new exUIPointEvent();
            pointEvent.pointInfos = new exUIPointInfo [iter.Value.Count];

            for (int i = 0; i < iter.Value.Count; ++i)
            {
                exHotPoint hotPoint = iter.Value[i];

                exUIPointInfo pointInfo = new exUIPointInfo();
                pointInfo.id         = hotPoint.id;
                pointInfo.pos        = hotPoint.pos;
                pointInfo.delta      = hotPoint.delta;
                pointInfo.worldPos   = hotPoint.worldPos;
                pointInfo.worldDelta = hotPoint.worldDelta;

                pointEvent.pointInfos[i] = pointInfo;
                pointEvent.isMouse       = hotPoint.isMouse;
            }

            iter.Key.OnHoverMove(pointEvent);
        }

        // ========================================================
        // handle press up event
        // ========================================================

        for (int i = 0; i < _hotPoints.Length; ++i)
        {
            exHotPoint hotPoint = _hotPoints[i];

            if (hotPoint.active == false)
            {
                continue;
            }

            //
            if (hotPoint.pressUp)
            {
                exUIPointInfo pointInfo = new exUIPointInfo();
                pointInfo.id         = hotPoint.id;
                pointInfo.pos        = hotPoint.pos;
                pointInfo.delta      = hotPoint.delta;
                pointInfo.worldPos   = hotPoint.worldPos;
                pointInfo.worldDelta = hotPoint.worldDelta;

                exUIPointEvent pointEvent = new exUIPointEvent();
                pointEvent.isMouse    = hotPoint.isMouse;
                pointEvent.pointInfos = new exUIPointInfo [] {
                    pointInfo
                };

                exUIControl curCtrl = hotPoint.hover;
                if (hotPoint.pressed != null && hotPoint.pressed.grabMouseOrTouch)
                {
                    curCtrl = hotPoint.pressed;
                }

                // send press down event
                if (curCtrl != null)
                {
                    curCtrl.OnPressUp(pointEvent);

                    if (hotPoint.isTouch)
                    {
                        curCtrl.OnHoverOut(pointEvent);
                    }
                }

                hotPoint.pressed = null;
            }
        }
    }
Exemplo n.º 20
0
    // ------------------------------------------------------------------
    // Desc:
    // ------------------------------------------------------------------

    public static exUIControl FindParent(exUIControl _ctrl)
    {
        return(_ctrl.FindParentComponent());
    }
Exemplo n.º 21
0
 public void Reset()
 {
     isPropagationStopped_ = false;
     target = null;
     currentTarget = null;
 }
Exemplo n.º 22
0
    // ------------------------------------------------------------------
    // Desc:
    // ------------------------------------------------------------------

    protected override void DoInspectorGUI()
    {
        base.DoInspectorGUI();

        // if settingsStyles is null
        if (styles == null)
        {
            styles = new Styles();
        }

        //
        GUILayout.BeginHorizontal();
        GUILayout.FlexibleSpace();
        if (GUILayout.Button("Sync Size", GUILayout.Width(70), GUILayout.Height(20)))
        {
            exPlane targetPlane = target as exPlane;
            if (targetPlane.hasSprite)
            {
                exSpriteBase spriteBase = targetPlane.GetComponent <exSpriteBase>();
                if (targetPlane.width != spriteBase.width)
                {
                    targetPlane.width = spriteBase.width;
                    EditorUtility.SetDirty(targetPlane);
                }

                if (targetPlane.height != spriteBase.height)
                {
                    targetPlane.height = spriteBase.height;
                    EditorUtility.SetDirty(targetPlane);
                }

                if (targetPlane.anchor != spriteBase.anchor)
                {
                    targetPlane.anchor = spriteBase.anchor;
                    EditorUtility.SetDirty(targetPlane);
                }

                if (targetPlane.offset != spriteBase.offset)
                {
                    targetPlane.offset = spriteBase.offset;
                    EditorUtility.SetDirty(targetPlane);
                }
            }
        }
        GUILayout.EndHorizontal();

        //
        EditorGUILayout.Space();
        EditorGUILayout.PropertyField(priorityProp);

        // active
        EditorGUI.BeginChangeCheck();
        EditorGUILayout.PropertyField(activeProp, new GUIContent("Active"));
        if (EditorGUI.EndChangeCheck())
        {
            foreach (Object obj in serializedObject.targetObjects)
            {
                exUIControl ctrl = obj as exUIControl;
                if (ctrl)
                {
                    ctrl.activeSelf = activeProp.boolValue;
                    EditorUtility.SetDirty(ctrl);
                }
            }
        }

        // grabMouseOrTouch
        EditorGUILayout.PropertyField(grabMouseOrTouchProp, new GUIContent("Grab Mouse Or Touch"));

        // use collider
        EditorGUI.BeginChangeCheck();
        EditorGUILayout.PropertyField(useColliderProp, new GUIContent("Use Collider"));
        if (EditorGUI.EndChangeCheck())
        {
            if (useColliderProp.boolValue)
            {
                foreach (Object obj in serializedObject.targetObjects)
                {
                    exUIControl ctrl = obj as exUIControl;
                    if (ctrl)
                    {
                        Collider collider = ctrl.GetComponent <Collider>();
                        if (collider == null)
                        {
                            collider = ctrl.gameObject.AddComponent <BoxCollider>();
                        }

                        BoxCollider boxCollider = collider as BoxCollider;
                        if (boxCollider != null)
                        {
                            Rect localRect = ctrl.GetLocalAABoundingRect();
                            boxCollider.center = new Vector3(localRect.center.x, localRect.center.y, boxCollider.center.z);
                            boxCollider.size   = new Vector3(localRect.width, localRect.height, boxCollider.size.z);
                        }
                    }
                }
            }
            else
            {
                foreach (Object obj in serializedObject.targetObjects)
                {
                    exUIControl ctrl = obj as exUIControl;
                    if (ctrl)
                    {
                        Collider[] colliders = ctrl.GetComponents <Collider>();
                        for (int i = 0; i < colliders.Length; ++i)
                        {
                            Object.DestroyImmediate(colliders[i]);
                        }
                    }
                }
            }
        }

        if (useColliderProp.boolValue)
        {
            EditorGUILayout.BeginHorizontal();
            GUILayout.FlexibleSpace();
            if (GUILayout.Button("Sync Collider", GUILayout.MinWidth(50), GUILayout.Height(20)))
            {
                foreach (Object obj in serializedObject.targetObjects)
                {
                    exUIControl ctrl = obj as exUIControl;
                    if (ctrl)
                    {
                        BoxCollider boxCollider = ctrl.GetComponent <BoxCollider>();
                        Rect        localRect   = ctrl.GetLocalAABoundingRect();
                        boxCollider.center = new Vector3(localRect.center.x, localRect.center.y, boxCollider.center.z);
                        boxCollider.size   = new Vector3(localRect.width, localRect.height, boxCollider.size.z);
                    }
                }
            }
            EditorGUILayout.EndHorizontal();
        }

        if (serializedObject.isEditingMultipleObjects == false)
        {
            exUIControl uiControl = target as exUIControl;

            // event adding selector
            List <string> eventDefNameList = new List <string>();
            eventDefNameList.Add("Event List");
            eventDefNameList.AddRange(uiControl.GetEventNames());

            foreach (exUIControl.EventTrigger eventTrigger in uiControl.events)
            {
                int idx = eventDefNameList.IndexOf(eventTrigger.name);
                if (idx != -1)
                {
                    eventDefNameList.RemoveAt(idx);
                }
            }

            int choice = EditorGUILayout.Popup("Add Event", 0, eventDefNameList.ToArray());
            if (choice != 0)
            {
                exUIControl.EventTrigger newTrigger = new exUIControl.EventTrigger(eventDefNameList[choice]);
                uiControl.events.Add(newTrigger);
                EditorUtility.SetDirty(target);
            }

            // event triggers
            for (int i = 0; i < uiControl.events.Count; ++i)
            {
                EditorGUILayout.Space();

                exUIControl.EventTrigger eventTrigger = uiControl.events[i];
                if (EventField(eventTrigger))
                {
                    uiControl.events.RemoveAt(i);
                    --i;
                    EditorUtility.SetDirty(target);
                }

                EditorGUILayout.Space();
            }
        }

        EditorGUILayout.Space();
    }
Exemplo n.º 23
0
    // ------------------------------------------------------------------
    // Desc:
    // ------------------------------------------------------------------
    void DrawControlNode( exUIControl _ctrl )
    {
        Vector3[] vertices = _ctrl.GetLocalVertices();
        if (vertices.Length > 0) {
            Rect aabb = exGeometryUtility.GetAABoundingRect(vertices);
            Matrix4x4 l2w = _ctrl.transform.localToWorldMatrix;

            // draw control rect
            vertices = new Vector3[4] {
                l2w.MultiplyPoint3x4(new Vector3(aabb.xMin, aabb.yMin, 0)),
                l2w.MultiplyPoint3x4(new Vector3(aabb.xMin, aabb.yMax, 0)),
                l2w.MultiplyPoint3x4(new Vector3(aabb.xMax, aabb.yMax, 0)),
                l2w.MultiplyPoint3x4(new Vector3(aabb.xMax, aabb.yMin, 0)),
            };
            exEditorUtility.GL_DrawRectLine(vertices, new Color( 1.0f, 0.0f, 0.5f, 1.0f ), true);

            // draw scroll-view content
            exUIScrollView scrollView = _ctrl as exUIScrollView;
            if ( scrollView != null ) {
                aabb.width = scrollView.contentSize.x;
                aabb.yMin = aabb.yMax - scrollView.contentSize.y;

                float contentX = (scrollView.horizontalContentDir == exUIScrollView.ContentDirection.LeftToRight) ? 0.0f : (scrollView.contentSize.x-scrollView.width);
                float contentY = (scrollView.verticalContentDir == exUIScrollView.ContentDirection.TopToBottom) ? 0.0f : (scrollView.contentSize.y-scrollView.height);
                aabb.center += scrollView.scrollOffset;
                aabb.center += new Vector2( contentX, contentY );
                vertices = new Vector3[4] {
                    l2w.MultiplyPoint3x4(new Vector3(aabb.xMin, aabb.yMin, 0)),
                    l2w.MultiplyPoint3x4(new Vector3(aabb.xMin, aabb.yMax, 0)),
                    l2w.MultiplyPoint3x4(new Vector3(aabb.xMax, aabb.yMax, 0)),
                    l2w.MultiplyPoint3x4(new Vector3(aabb.xMax, aabb.yMin, 0)),
                };
                exEditorUtility.GL_DrawRectLine(vertices, new Color( 0.0f, 0.5f, 1.0f, 1.0f ), true);
            }
        }
    }
Exemplo n.º 24
0
    // ------------------------------------------------------------------
    // Desc:
    // ------------------------------------------------------------------

    public void DispatchEvent(exUIControl _sender, string _name, List <exUIEventListener> _listeners, exUIEvent _event)
    {
        _event.target = _sender;

        if (_event.bubbles)
        {
            List <exUIControl> routine = GetRoutine(_sender);

            // capture phase
            if (_listeners != null)
            {
                for (int i = 0; i < _listeners.Count; ++i)
                {
                    exUIEventListener listener = _listeners[i];
                    if (listener.capturePhase)
                    {
                        _event.eventPhase = exUIEventPhase.Capture;

                        for (int j = routine.Count - 1; j >= 0; --j)
                        {
                            exUIControl sender2 = routine[j];
                            List <exUIEventListener> listeners2 = sender2.GetEventListeners(_name);
                            _event.currentTarget = sender2;
                            DoDispatchEvent(sender2, listeners2, _event);
                            if (_event.isPropagationStopped)
                            {
                                return;
                            }
                        }
                    }
                }
            }

            // target phase
            if (_listeners != null)
            {
                _event.eventPhase    = exUIEventPhase.Target;
                _event.currentTarget = _sender;
                DoDispatchEvent(_sender, _listeners, _event);
                if (_event.isPropagationStopped)
                {
                    return;
                }
            }

            // bubble phase
            _event.eventPhase = exUIEventPhase.Bubble;
            for (int j = 0; j < routine.Count; ++j)
            {
                exUIControl sender2 = routine[j];
                List <exUIEventListener> listeners2 = sender2.GetEventListeners(_name);
                _event.currentTarget = sender2;
                DoDispatchEvent(sender2, listeners2, _event);
                if (_event.isPropagationStopped)
                {
                    return;
                }
            }
        }
        else
        {
            _event.eventPhase    = exUIEventPhase.Target;
            _event.currentTarget = _sender;
            DoDispatchEvent(_sender, _listeners, _event);
        }
    }
Exemplo n.º 25
0
    public void DispatchEvent(exUIControl _sender, string _name, exUIEvent _event)
    {
        List <exUIEventListener> listeners = _sender.GetEventListeners(_name);

        DispatchEvent(_sender, _name, listeners, _event);
    }
Exemplo n.º 26
0
    // ------------------------------------------------------------------
    // Desc:
    // ------------------------------------------------------------------

    void AddState_Color(exUIControl _ctrl, EffectState_Color _state)
    {
        for (int i = 0; i < _state.info.propInfos.Count; ++i)
        {
            EffectInfo_Color.PropInfo propInfo = _state.info.propInfos[i];
            switch (propInfo.type)
            {
            case EffectEventType.Deactive:
                _ctrl.AddEventListener("onDeactive",
                                       delegate(exUIEvent _event) {
                    enabled = true;
                    _state.Begin(propInfo.val);
                });
                _ctrl.AddEventListener("onActive",
                                       delegate(exUIEvent _event) {
                    enabled = true;
                    _state.Begin(_state.info.normal);
                });
                break;

            case EffectEventType.Press:
                _ctrl.AddEventListener("onPressDown",
                                       delegate(exUIEvent _event) {
                    enabled = true;
                    _state.Begin(propInfo.val);
                });
                _ctrl.AddEventListener("onPressUp",
                                       delegate(exUIEvent _event) {
                    enabled = true;
                    _state.Begin(_state.info.GetValue(EffectEventType.Hover));
                });
                break;

            case EffectEventType.Hover:
                _ctrl.AddEventListener("onHoverIn",
                                       delegate(exUIEvent _event) {
                    enabled = true;
                    _state.Begin(propInfo.val);
                });
                _ctrl.AddEventListener("onHoverOut",
                                       delegate(exUIEvent _event) {
                    enabled = true;
                    _state.Begin(_state.info.normal);
                });
                break;

            case EffectEventType.Unchecked:
                exUIToggle toggle = _ctrl as exUIToggle;
                if (toggle != null)
                {
                    _ctrl.AddEventListener("onUnchecked",
                                           delegate(exUIEvent _event) {
                        enabled = true;
                        _state.Begin(propInfo.val);
                    });
                    _ctrl.AddEventListener("onChecked",
                                           delegate(exUIEvent _event) {
                        enabled = true;
                        _state.Begin(_state.info.GetValue(EffectEventType.Hover));
                    });
                }
                break;
            }
        }

        states.Add(_state);
    }
Exemplo n.º 27
0
    // ------------------------------------------------------------------
    // Desc:
    // ------------------------------------------------------------------

    public void HoverOut(exUIControl _ctrl, int _id)
    {
        exHotPoint[] hotPoints = null;

        if (hasTouch || simulateMouseAsTouch)
        {
            hotPoints = touchPoints;
        }
        else
        {
            hotPoints = mousePoints;
        }

        //
        for (int i = 0; i < hotPoints.Length; ++i)
        {
            exHotPoint hotPoint = hotPoints[i];

            if (hotPoint.active == false)
            {
                continue;
            }

            if (hotPoint.id != _id)
            {
                continue;
            }

            exUIPointInfo pointInfo = new exUIPointInfo();
            pointInfo.id         = hotPoint.id;
            pointInfo.pos        = hotPoint.pos;
            pointInfo.delta      = hotPoint.delta;
            pointInfo.worldPos   = hotPoint.worldPos;
            pointInfo.worldDelta = hotPoint.worldDelta;

            exUIPointEvent pointEvent = new exUIPointEvent();
            pointEvent.isMouse    = hotPoint.isMouse;
            pointEvent.pointInfos = new exUIPointInfo [] {
                pointInfo
            };

            // on hover out
            if (_ctrl != null)
            {
                _ctrl.OnHoverOut(pointEvent);
            }

            hotPoint.hover = null;

            // on hover in
            if (_ctrl.parent != null)
            {
                pointEvent.Reset();
                hotPoint.hover = _ctrl.parent;
                _ctrl.parent.OnHoverIn(pointEvent);


                if (hotPoint.isTouch)
                {
                    pointEvent.Reset();
                    hotPoint.pressed = _ctrl.parent;
                    _ctrl.parent.OnPressDown(pointEvent);
                }
            }
        }
    }
Exemplo n.º 28
0
    // ------------------------------------------------------------------
    // Desc:
    // ------------------------------------------------------------------
    void AddState_Scale( exUIControl _ctrl, EffectState_Scale _state )
    {
        for ( int i = 0; i < _state.info.propInfos.Count; ++i ) {
            EffectInfo_Scale.PropInfo propInfo = _state.info.propInfos[i];
            switch ( propInfo.type ) {
            case EffectEventType.Deactive:
                _ctrl.AddEventListener( "onDeactive",
                                        delegate ( exUIEvent _event ) {
                                            enabled = true;
                                            _state.Begin( propInfo.val );
                                        } );
                _ctrl.AddEventListener( "onActive",
                                        delegate ( exUIEvent _event ) {
                                            enabled = true;
                                            _state.Begin( _state.info.normal );
                                        } );
                break;

            case EffectEventType.Press:
                _ctrl.AddEventListener ( "onPressDown",
                                         delegate ( exUIEvent _event ) {
                                             enabled = true;
                                             _state.Begin( propInfo.val );
                                         } );
                _ctrl.AddEventListener ( "onPressUp",
                                         delegate ( exUIEvent _event ) {
                                             enabled = true;
                                             _state.Begin( _state.info.GetValue( EffectEventType.Hover ) );
                                         } );
                _ctrl.AddEventListener ( "onHoverOut",
                                         delegate ( exUIEvent _event ) {
                                             if ( _ctrl.grabMouseOrTouch == false ) {
                                                 enabled = true;
                                                 _state.Begin( _state.info.normal );
                                             }
                                         } );
                break;

            case EffectEventType.Hover:
                _ctrl.AddEventListener ( "onHoverIn",
                                         delegate ( exUIEvent _event ) {
                                             enabled = true;
                                             _state.Begin( propInfo.val );
                                         } );
                _ctrl.AddEventListener ( "onHoverOut",
                                         delegate ( exUIEvent _event ) {
                                             enabled = true;
                                             _state.Begin( _state.info.normal );
                                         } );
                break;

            case EffectEventType.Unchecked:
                exUIToggle toggle = _ctrl as exUIToggle;
                if ( toggle != null ) {
                    _ctrl.AddEventListener ( "onUnchecked",
                                             delegate ( exUIEvent _event ) {
                                                 enabled = true;
                                                 _state.Begin( propInfo.val );
                                             } );
                    _ctrl.AddEventListener ( "onChecked",
                                             delegate ( exUIEvent _event ) {
                                                 enabled = true;
                                                 _state.Begin( _state.info.GetValue( EffectEventType.Hover ) );
                                             } );
                }
                break;
            }
        }

        states.Add(_state);
    }
Exemplo n.º 29
0
    // ------------------------------------------------------------------
    // Desc:
    // ------------------------------------------------------------------

    public static void FindAndAddChild(exUIControl _ctrl)
    {
        _ctrl.children.Clear();
        FindAndAddChildRecursively(_ctrl, _ctrl.transform);
    }
Exemplo n.º 30
0
    // ------------------------------------------------------------------
    // Desc:
    // ------------------------------------------------------------------
    protected exUIControl.SlotInfo SlotField( exUIControl.SlotInfo _slot )
    {
        exUIControl.SlotInfo slot = _slot;
        System.Type[] parameterTypes = new System.Type[] { typeof(exUIEvent) };

        EditorGUILayout.BeginHorizontal();
            // receiver
            EditorGUI.BeginChangeCheck();
            slot.receiver = EditorGUILayout.ObjectField( slot.receiver, typeof(GameObject), true ) as GameObject;
            if ( EditorGUI.EndChangeCheck() ) {
                EditorUtility.SetDirty(target);
            }

            if ( slot.receiver != null ) {
                // get valid methods
                List<string> methodNames = new List<string>();
                methodNames.Add( "None" );

                MonoBehaviour[] allMonoBehaviours = slot.receiver.GetComponents<MonoBehaviour>();
                for ( int i = 0; i < allMonoBehaviours.Length; ++i ) {
                    MonoBehaviour monoBehaviour =  allMonoBehaviours[i];

                    // don't get method from control
                    if ( monoBehaviour is exUIControl )
                        continue;

                    MethodInfo[] methods = monoBehaviour.GetType().GetMethods(BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);
                    for ( int m = 0; m < methods.Length; ++m ) {
                        MethodInfo mi = methods[m];
                        ParameterInfo[] miParameterTypes = mi.GetParameters();
                        if ( mi.ReturnType == typeof(void) &&
                             miParameterTypes.Length == parameterTypes.Length )
                        {
                            bool notMatch = false;
                            for ( int p = 0; p < miParameterTypes.Length; ++p ) {
                                if ( miParameterTypes[p].ParameterType != parameterTypes[p] ) {
                                    notMatch = true;
                                    break;
                                }
                            }

                            if ( notMatch == false && methodNames.IndexOf(mi.Name) == -1 ) {
                                methodNames.Add(mi.Name);
                            }
                        }
                    }
                }

                EditorGUI.BeginChangeCheck();
                int choice = methodNames.IndexOf(_slot.method);
                choice = EditorGUILayout.Popup ( choice == -1 ? 0 : choice, methodNames.ToArray(), GUILayout.Width(100) );
                if ( EditorGUI.EndChangeCheck() ) {
                    _slot.method = methodNames[choice];
                    EditorUtility.SetDirty(target);
                }
            }
            else {
                slot = null;
            }

            // Delete
            if ( GUILayout.Button( styles.iconToolbarMinus, "InvisibleButton", GUILayout.Width(20f) ) ) {
                slot = null;
            }
            GUILayout.Space(3f);
        EditorGUILayout.EndHorizontal();

        return slot;
    }
Exemplo n.º 31
0
 public void Reset()
 {
     isPropagationStopped_ = false;
     target        = null;
     currentTarget = null;
 }
Exemplo n.º 32
0
    // ------------------------------------------------------------------
    // Desc:
    // ------------------------------------------------------------------

    // public void DispatchEvent ( exUIControl _sender, List<exUIEventListener> _eventListeners, exUIEvent _event ) {
    //     if ( _eventListeners.Count <= 0 )
    //         return;

    //     if ( _event.bubbles ) {
    //         List<exUIControl> routine = GetRoutine( _sender );
    //         _event.target = _sender;

    //         for ( int i = 0; i < _eventListeners.Count; ++i ) {
    //             exUIEventListener listener = _eventListeners[i];

    //             // capture phase
    //             if ( listener.capturePhase ) {
    //                 _event.eventPhase = exUIEventPhase.Capture;

    //                 for ( int j = routine.Count-1; j >= 0; --j ) {
    //                     _event.currentTarget = routine[j];
    //                     listener.func ( _event );
    //                     if ( _event.isPropagationStopped )
    //                         break;
    //                 }

    //                 if ( _event.isPropagationStopped )
    //                     continue;
    //             }

    //             // target phase
    //             _event.eventPhase = exUIEventPhase.Target;
    //             _event.currentTarget = _sender;
    //             listener.func ( _event );
    //             if ( _event.isPropagationStopped )
    //                 continue;

    //             // bubble phase
    //             _event.eventPhase = exUIEventPhase.Bubble;
    //             for ( int j = 0; j < routine.Count; ++j ) {
    //                 _event.currentTarget = routine[j];
    //                 listener.func ( _event );
    //                 if ( _event.isPropagationStopped )
    //                     break;
    //             }
    //         }
    //     }
    //     else {
    //         _event.target = _sender;

    //         for ( int i = 0; i < _eventListeners.Count; ++i ) {
    //             exUIEventListener listener = _eventListeners[i];

    //             // target phase
    //             _event.eventPhase = exUIEventPhase.Target;
    //             _event.currentTarget = _sender;
    //             listener.func ( _event );

    //             if ( _event.isPropagationStopped )
    //                 break;
    //         }
    //     }
    // }

    // ------------------------------------------------------------------
    // Desc:
    // NOTE: FindObjectsOfType() will not find deactived GameObjects,
    //       so you need to manually add them to exUIMng
    // ------------------------------------------------------------------

    void Init()
    {
        if (initialized)
        {
            return;
        }

        //
        if (camera == null)
        {
            Debug.LogError("The exUIMng should attach to a camera");
            return;
        }

        //
        if (Application.platform == RuntimePlatform.Android ||
            Application.platform == RuntimePlatform.IPhonePlayer
#if UNITY_4_2
            || Application.platform == RuntimePlatform.WP8Player ||
            Application.platform == RuntimePlatform.BB10Player
#endif
            )
        {
            hasMouse = false;
            hasTouch = true;
            // hasKeyboard = false;
            // hasController = true;
        }
        else if (Application.platform == RuntimePlatform.PS3 ||
                 Application.platform == RuntimePlatform.XBOX360
                 )
        {
            hasMouse = false;
            hasTouch = false;
            // hasKeyboard = false;
            // hasController = true;
        }
        else if (Application.platform == RuntimePlatform.WindowsEditor ||
                 Application.platform == RuntimePlatform.OSXEditor
                 )
        {
            hasMouse = true;
            hasTouch = false;
            // hasKeyboard = true;
            // hasController = true;
        }

        //
        for (int i = 0; i < 10; ++i)
        {
            touchPoints[i] = new exHotPoint();
            touchPoints[i].Reset();
            touchPoints[i].id = i;
        }
        for (int i = 0; i < 3; ++i)
        {
            mousePoints[i] = new exHotPoint();
            mousePoints[i].Reset();
            mousePoints[i].id      = i;
            mousePoints[i].isMouse = true;
        }

        // find all controls in the scene, and add root controls to UIMng
        exUIControl[] allControls = FindObjectsOfType(typeof(exUIControl)) as exUIControl[];
        for (int i = 0; i < allControls.Length; ++i)
        {
            exUIControl ctrl        = allControls[i];
            exUIControl parent_ctrl = exUIMng.FindParent(ctrl);
            if (parent_ctrl == null)
            {
                AddControl(ctrl);
            }
        }

        //
        initialized = true;
    }
Exemplo n.º 33
0
    // ------------------------------------------------------------------
    // Desc:
    // ------------------------------------------------------------------
    protected bool EventField( exUIControl.EventTrigger _eventTrigger )
    {
        bool deleted = false;

        GUILayout.BeginHorizontal();
        GUILayout.Space(4f);

            GUILayout.BeginVertical();
                EditorGUILayout.BeginHorizontal();
                    // name
                    GUILayout.Toggle( true, _eventTrigger.name, "dragtab");

                    // delete
                    if ( GUILayout.Button( styles.iconToolbarMinus,
                                           "InvisibleButton",
                                           GUILayout.Width(styles.iconToolbarMinus.width),
                                           GUILayout.Height(styles.iconToolbarMinus.height) ) )
                    {
                        deleted = true;
                    }
                EditorGUILayout.EndHorizontal();

                EditorGUILayout.BeginHorizontal("AS TextArea", GUILayout.MinHeight(10f));
                GUILayout.BeginVertical();

                    // slots
                    for ( int i = 0; i < _eventTrigger.slots.Count; ++i ) {
                        exUIControl.SlotInfo slotInfo = SlotField ( _eventTrigger.slots[i] );
                        if ( slotInfo == null ) {
                            _eventTrigger.slots.RemoveAt(i);
                            --i;
                            EditorUtility.SetDirty(target);
                        }
                    }

                    // new slot
                    EditorGUILayout.BeginHorizontal();
                        GUILayout.FlexibleSpace();
                        GameObject receiver = EditorGUILayout.ObjectField( null, typeof(GameObject), true, GUILayout.Width(150) ) as GameObject;
                        if ( receiver != null ) {
                            exUIControl.SlotInfo slotInfo = new exUIControl.SlotInfo();
                            slotInfo.receiver = receiver;
                            _eventTrigger.slots.Add(slotInfo);
                            EditorUtility.SetDirty(target);
                        }
                        GUILayout.Label( styles.iconToolbarPlus, GUILayout.Width(20) );
                    EditorGUILayout.EndHorizontal();

                GUILayout.EndVertical();
                EditorGUILayout.EndHorizontal();

            GUILayout.EndVertical();

        GUILayout.Space(4f);
        GUILayout.EndHorizontal();

        return deleted;
    }