Example #1
0
    /// <summary>
    /// Unbinds all source component events
    /// </summary>
    public void Unbind()
    {
        if (!isBound)
        {
            return;
        }

        isBound = false;

        if (startEventBinding != null)
        {
            startEventBinding.Unbind();
            startEventBinding = null;
        }

        if (stopEventBinding != null)
        {
            stopEventBinding.Unbind();
            stopEventBinding = null;
        }

        if (resetEventBinding != null)
        {
            resetEventBinding.Unbind();
            resetEventBinding = null;
        }
    }
    private void bindTargetEvent()
    {
        targetEventBinding           = gameObject.AddComponent <dfEventBinding>();
        targetEventBinding.hideFlags = HideFlags.HideAndDontSave | HideFlags.HideInInspector;

        targetEventBinding.DataSource = new dfComponentMemberInfo()
        {
            Component  = DataTarget.Component,
            MemberName = TargetEventName
        };

        targetEventBinding.DataTarget = new dfComponentMemberInfo()
        {
            Component  = this,
            MemberName = "MirrorTargetProperty"
        };

        targetEventBinding.Bind();
    }
Example #3
0
    /// <summary>
    /// Binds the source events to the corresponding tween methods
    /// </summary>
    public void Bind()
    {
        if( isBound && !isValid() )
            return;

        isBound = true;

        if( !string.IsNullOrEmpty( StartEvent ) )
        {
            startEventBinding = bindEvent( StartEvent, "Play" );
        }

        if( !string.IsNullOrEmpty( StopEvent ) )
        {
            stopEventBinding = bindEvent( StopEvent, "Stop" );
        }

        if( !string.IsNullOrEmpty( ResetEvent ) )
        {
            resetEventBinding = bindEvent( ResetEvent, "Reset" );
        }
    }
    /// <summary>
    /// Unbind the source and target properties
    /// </summary>
    public override void Unbind()
    {
        if (!isBound)
        {
            return;
        }

        isBound = false;

        if (sourceEventBinding != null)
        {
            sourceEventBinding.Unbind();
            Destroy(sourceEventBinding);
            sourceEventBinding = null;
        }

        if (targetEventBinding != null)
        {
            targetEventBinding.Unbind();
            Destroy(targetEventBinding);
            targetEventBinding = null;
        }
    }
Example #5
0
    /// <summary>
    /// Binds the source events to the corresponding tween methods
    /// </summary>
    public void Bind()
    {
        if (isBound && !isValid())
        {
            return;
        }

        isBound = true;

        if (!string.IsNullOrEmpty(StartEvent))
        {
            startEventBinding = bindEvent(StartEvent, "Play");
        }

        if (!string.IsNullOrEmpty(StopEvent))
        {
            stopEventBinding = bindEvent(StopEvent, "Stop");
        }

        if (!string.IsNullOrEmpty(ResetEvent))
        {
            resetEventBinding = bindEvent(ResetEvent, "Reset");
        }
    }
Example #6
0
    /// <summary>
    /// Unbinds all source component events
    /// </summary>
    public void Unbind()
    {
        if( !isBound )
            return;

        isBound = false;

        if( startEventBinding != null )
        {
            startEventBinding.Unbind();
            startEventBinding = null;
        }

        if( stopEventBinding != null )
        {
            stopEventBinding.Unbind();
            stopEventBinding = null;
        }

        if( resetEventBinding != null )
        {
            resetEventBinding.Unbind();
            resetEventBinding = null;
        }
    }
    private void bindTargetEvent()
    {
        targetEventBinding = gameObject.AddComponent<dfEventBinding>();
        targetEventBinding.hideFlags = HideFlags.HideAndDontSave | HideFlags.HideInInspector;

        targetEventBinding.DataSource = new dfComponentMemberInfo()
        {
            Component = DataTarget.Component,
            MemberName = TargetEventName
        };

        targetEventBinding.DataTarget = new dfComponentMemberInfo()
        {
            Component = this,
            MemberName = "MirrorTargetProperty"
        };

        targetEventBinding.Bind();
    }
    /// <summary>
    /// Unbind the source and target properties 
    /// </summary>
    public override void Unbind()
    {
        if( !isBound )
            return;

        isBound = false;

        if( sourceEventBinding != null )
        {
            sourceEventBinding.Unbind();
            Destroy( sourceEventBinding );
            sourceEventBinding = null;
        }

        if( targetEventBinding != null )
        {
            targetEventBinding.Unbind();
            Destroy( targetEventBinding );
            targetEventBinding = null;
        }
    }