コード例 #1
0
    public override void Play()
    {
        if (this.IsPlaying)
        {
            this.Stop();
        }

        if (!enabled || !gameObject.activeSelf || !gameObject.activeInHierarchy)
        {
            return;
        }

        if (this.memberInfo == null)
        {
            throw new NullReferenceException("Animation target is NULL");
        }

        if (!this.memberInfo.IsValid)
        {
            throw new InvalidOperationException("Invalid property binding configuration on " + getPath(gameObject.transform) + " - " + target);
        }

        this.target = this.memberInfo.GetProperty();
        StartCoroutine(Execute());
    }
コード例 #2
0
    /// <summary>
    /// Bind the source and target properties
    /// </summary>
    public void Bind()
    {
        if (isBound)
        {
            return;
        }

        if (!IsDataSourceValid())
        {
            Debug.LogError(string.Format("Invalid data binding configuration - Source:{0}, Target:{1}", DataSource, DataTarget));
            return;
        }

        if (!DataTarget.IsValid)
        {
            Debug.LogError(string.Format("Invalid data binding configuration - Source:{0}, Target:{1}", DataSource, DataTarget));
            return;
        }

        var proxy = DataSource.Component as dfDataObjectProxy;

        sourceProperty = proxy.GetProperty(DataSource.MemberName);
        targetProperty = DataTarget.GetProperty();

        isBound = (sourceProperty != null) && (targetProperty != null);

        if (isBound)
        {
            // Ensure that both properties are synced at start
            targetProperty.Value = sourceProperty.Value;
        }

        attachEvent();
    }
コード例 #3
0
    public override void Reset()
    {
        List <string> sprites;

        if (this.clip == null)
        {
            sprites = null;
        }
        else
        {
            sprites = this.clip.Sprites;
        }
        List <string> strs = sprites;

        if (this.memberInfo.IsValid && strs != null && strs.Count > 0)
        {
            this.memberInfo.Component.SetProperty(this.memberInfo.MemberName, strs[0]);
        }
        if (!this.isRunning)
        {
            return;
        }
        base.StopAllCoroutines();
        this.isRunning = false;
        this.isPaused  = false;
        this.onReset();
        this.target = null;
    }
コード例 #4
0
 public void Bind()
 {
     if (!this.isBound && (!(this.DataSource is dfDataObjectProxy) || (((dfDataObjectProxy)this.DataSource).Data != null)))
     {
         dfScriptEngineSettings      settings2  = new dfScriptEngineSettings();
         Dictionary <string, object> dictionary = new Dictionary <string, object>();
         dictionary.Add("Application", typeof(Application));
         dictionary.Add("Color", typeof(Color));
         dictionary.Add("Color32", typeof(Color32));
         dictionary.Add("Random", typeof(UnityEngine.Random));
         dictionary.Add("Time", typeof(Time));
         dictionary.Add("ScriptableObject", typeof(ScriptableObject));
         dictionary.Add("Vector2", typeof(Vector2));
         dictionary.Add("Vector3", typeof(Vector3));
         dictionary.Add("Vector4", typeof(Vector4));
         dictionary.Add("Quaternion", typeof(Quaternion));
         dictionary.Add("Matrix", typeof(Matrix4x4));
         dictionary.Add("Mathf", typeof(Mathf));
         settings2.Constants = dictionary;
         dfScriptEngineSettings settings = settings2;
         if (this.DataSource is dfDataObjectProxy)
         {
             dfDataObjectProxy dataSource = this.DataSource as dfDataObjectProxy;
             settings.AddVariable(new dfScriptVariable("source", null, dataSource.DataType));
         }
         else
         {
             settings.AddVariable(new dfScriptVariable("source", this.DataSource));
         }
         this.compiledExpression = dfScriptEngine.CompileExpression(this.expression, settings);
         this.targetProperty     = this.DataTarget.GetProperty();
         this.isBound            = (this.compiledExpression != null) && (this.targetProperty != null);
     }
 }
コード例 #5
0
    public override void Stop()
    {
        List <string> sprites;

        if (!this.isRunning)
        {
            return;
        }
        if (this.clip == null)
        {
            sprites = null;
        }
        else
        {
            sprites = this.clip.Sprites;
        }
        List <string> strs = sprites;

        if (this.skipToEndOnStop && strs != null)
        {
            this.setFrame(Mathf.Max(strs.Count - 1, 0));
        }
        base.StopAllCoroutines();
        this.isRunning = false;
        this.isPaused  = false;
        this.onStopped();
        this.target = null;
    }
コード例 #6
0
    /// <summary>
    /// Bind the source and target properties 
    /// </summary>
    public virtual void Bind()
    {
        if( isBound )
            return;

        if( !DataSource.IsValid || !DataTarget.IsValid )
        {
            Debug.LogError( string.Format( "Invalid data binding configuration - Source:{0}, Target:{1}", DataSource, DataTarget ) );
            return;
        }

        sourceProperty = DataSource.GetProperty();
        targetProperty = DataTarget.GetProperty();

        isBound = ( sourceProperty != null ) && ( targetProperty != null );

        if( isBound )
        {

            // Determine whether to use the format string
            if( targetProperty.PropertyType == typeof( string ) )
            {
                if( sourceProperty.PropertyType != typeof( string ) )
                {
                    useFormatString = !string.IsNullOrEmpty( FormatString );
                }
            }

            // Ensure that both properties are synced at start
            targetProperty.Value = formatValue( sourceProperty.Value );

        }
    }
コード例 #7
0
ファイル: dfPropertyBinding.cs プロジェクト: Elringus/HajiJam
    /// <summary>
    /// Bind the source and target properties
    /// </summary>
    public virtual void Bind()
    {
        if (isBound)
        {
            return;
        }

        if (!DataSource.IsValid || !DataTarget.IsValid)
        {
            Debug.LogError(string.Format("Invalid data binding configuration - Source:{0}, Target:{1}", DataSource, DataTarget));
            return;
        }

        sourceProperty = DataSource.GetProperty();
        targetProperty = DataTarget.GetProperty();

        isBound = (sourceProperty != null) && (targetProperty != null);

        if (isBound)
        {
            // Determine whether to use the format string
            if (targetProperty.PropertyType == typeof(string))
            {
                if (sourceProperty.PropertyType != typeof(string))
                {
                    useFormatString = !string.IsNullOrEmpty(FormatString);
                }
            }

            // Ensure that both properties are synced at start
            targetProperty.Value = formatValue(sourceProperty.Value);
        }
    }
コード例 #8
0
    public void Bind()
    {
        if (this.isBound)
        {
            return;
        }
        if (!this.IsDataSourceValid())
        {
            Debug.LogError(string.Format("Invalid data binding configuration - Source:{0}, Target:{1}", this.DataSource, this.DataTarget));
            return;
        }
        if (!this.DataTarget.IsValid)
        {
            Debug.LogError(string.Format("Invalid data binding configuration - Source:{0}, Target:{1}", this.DataSource, this.DataTarget));
            return;
        }
        dfDataObjectProxy component = this.DataSource.Component as dfDataObjectProxy;

        this.sourceProperty = component.GetProperty(this.DataSource.MemberName);
        this.targetProperty = this.DataTarget.GetProperty();
        this.isBound        = (this.sourceProperty == null ? false : this.targetProperty != null);
        if (this.isBound)
        {
            this.targetProperty.Value = this.sourceProperty.Value;
        }
        this.attachEvent();
    }
コード例 #9
0
    /// <summary>
    /// Bind the source and target properties 
    /// </summary>
    public void Bind()
    {
        if( isBound )
            return;

        if( !IsDataSourceValid() )
        {
            Debug.LogError( string.Format( "Invalid data binding configuration - Source:{0}, Target:{1}", DataSource, DataTarget ) );
            return;
        }

        if( !DataTarget.IsValid )
        {
            Debug.LogError( string.Format( "Invalid data binding configuration - Source:{0}, Target:{1}", DataSource, DataTarget ) );
            return;
        }

        var proxy = DataSource.Component as dfDataObjectProxy;

        sourceProperty = proxy.GetProperty( DataSource.MemberName );
        targetProperty = DataTarget.GetProperty();

        isBound = ( sourceProperty != null ) && ( targetProperty != null );

        if( isBound )
        {
            // Ensure that both properties are synced at start
            targetProperty.Value = sourceProperty.Value;
        }

        attachEvent();
    }
コード例 #10
0
 public void Unbind()
 {
     if (this.isBound)
     {
         this.sourceProperty = null;
         this.targetProperty = null;
         this.isBound        = false;
     }
 }
コード例 #11
0
 public void Unbind()
 {
     if (this.isBound)
     {
         this.compiledExpression = null;
         this.targetProperty     = null;
         this.isBound            = false;
     }
 }
コード例 #12
0
 public void Unbind()
 {
     if (!this.isBound)
     {
         return;
     }
     this.sourceProperty = null;
     this.targetProperty = null;
     this.isBound        = false;
 }
コード例 #13
0
ファイル: dfPropertyBinding.cs プロジェクト: Elringus/HajiJam
    /// <summary>
    /// Unbind the source and target properties
    /// </summary>
    public virtual void Unbind()
    {
        if (!isBound)
        {
            return;
        }

        sourceProperty = null;
        targetProperty = null;

        isBound = false;
    }
コード例 #14
0
    /// <summary>
    /// Unbind the source and target properties
    /// </summary>
    public void Unbind()
    {
        if (!isBound)
        {
            return;
        }

#if !UNITY_IPHONE
        compiledExpression = null;
        targetProperty     = null;
#endif

        isBound = false;
    }
コード例 #15
0
    /// <summary>
    /// Unbind the source and target properties
    /// </summary>
    public void Unbind()
    {
        if (!isBound)
        {
            return;
        }

        detachEvent();

        sourceProperty = null;
        targetProperty = null;

        isBound = false;
    }
コード例 #16
0
 public void Bind()
 {
     if (this.isBound)
     {
         return;
     }
     if (!this.DataSource.IsValid || !this.DataTarget.IsValid)
     {
         Debug.LogError(string.Format("Invalid data binding configuration - Source:{0}, Target:{1}", this.DataSource, this.DataTarget));
         return;
     }
     this.sourceProperty = this.DataSource.GetProperty();
     this.targetProperty = this.DataTarget.GetProperty();
     this.isBound        = (this.sourceProperty == null ? false : this.targetProperty != null);
     if (this.isBound)
     {
         this.targetProperty.Value = this.sourceProperty.Value;
     }
 }
コード例 #17
0
 public void Bind()
 {
     if (this.isBound)
     {
         return;
     }
     if (!this.DataSource.IsValid || !this.DataTarget.IsValid)
     {
         Debug.LogError(string.Format("Invalid data binding configuration - Source:{0}, Target:{1}", this.DataSource, this.DataTarget));
         return;
     }
     this.sourceProperty = this.DataSource.GetProperty();
     this.targetProperty = this.DataTarget.GetProperty();
     this.isBound = (this.sourceProperty == null ? false : this.targetProperty != null);
     if (this.isBound)
     {
         this.targetProperty.Value = this.sourceProperty.Value;
     }
 }
コード例 #18
0
    public void Bind()
    {
        if (this.isBound)
        {
            return;
        }
        if (this.DataSource is dfDataObjectProxy && ((dfDataObjectProxy)this.DataSource).Data == null)
        {
            return;
        }
        dfScriptEngineSettings      dfScriptEngineSetting = new dfScriptEngineSettings();
        Dictionary <string, object> strs = new Dictionary <string, object>()
        {
            { "Application", typeof(Application) },
            { "Color", typeof(Color) },
            { "Color32", typeof(Color32) },
            { "Random", typeof(UnityEngine.Random) },
            { "Time", typeof(Time) },
            { "ScriptableObject", typeof(ScriptableObject) },
            { "Vector2", typeof(Vector2) },
            { "Vector3", typeof(Vector3) },
            { "Vector4", typeof(Vector4) },
            { "Quaternion", typeof(Quaternion) },
            { "Matrix", typeof(Matrix4x4) },
            { "Mathf", typeof(Mathf) }
        };

        dfScriptEngineSetting.Constants = strs;
        dfScriptEngineSettings dfScriptEngineSetting1 = dfScriptEngineSetting;

        if (!(this.DataSource is dfDataObjectProxy))
        {
            dfScriptEngineSetting1.AddVariable(new dfScriptVariable("source", this.DataSource));
        }
        else
        {
            dfDataObjectProxy dataSource = this.DataSource as dfDataObjectProxy;
            dfScriptEngineSetting1.AddVariable(new dfScriptVariable("source", null, dataSource.DataType));
        }
        this.compiledExpression = dfScriptEngine.CompileExpression(this.expression, dfScriptEngineSetting1);
        this.targetProperty     = this.DataTarget.GetProperty();
        this.isBound            = (this.compiledExpression == null ? false : this.targetProperty != null);
    }
コード例 #19
0
 public override void Play()
 {
     if (this.IsPlaying)
     {
         this.Stop();
     }
     if (!base.enabled || !base.gameObject.activeSelf || !base.gameObject.activeInHierarchy)
     {
         return;
     }
     if (this.memberInfo == null)
     {
         throw new NullReferenceException("Animation target is NULL");
     }
     if (!this.memberInfo.IsValid)
     {
         throw new InvalidOperationException(string.Concat(new object[] { "Invalid property binding configuration on ", this.getPath(base.gameObject.transform), " - ", this.target }));
     }
     this.target = this.memberInfo.GetProperty();
     base.StartCoroutine(this.Execute());
 }
コード例 #20
0
    public override void Reset()
    {
        var sprites = (clip != null) ? clip.Sprites : null;

        if (memberInfo.IsValid && sprites != null && sprites.Count > 0)
        {
            SetProperty(memberInfo.Component, memberInfo.MemberName, sprites[0]);
        }

        if (!isRunning)
        {
            return;
        }

        StopAllCoroutines();
        isRunning = false;
        isPaused  = false;

        onReset();

        this.target = null;
    }
コード例 #21
0
    public override void Stop()
    {
        if (!isRunning)
        {
            return;
        }

        var sprites = (clip != null) ? clip.Sprites : null;

        if (skipToEndOnStop && sprites != null)
        {
            setFrame(Mathf.Max(sprites.Count - 1, 0));
        }

        StopAllCoroutines();
        isRunning = false;
        isPaused  = false;

        onStopped();

        this.target = null;
    }
コード例 #22
0
    /// <summary>
    /// Bind the source and target properties 
    /// </summary>
    public void Bind()
    {
        if( isBound )
            return;

        if( !DataSource.IsValid || !DataTarget.IsValid )
        {
            Debug.LogError( string.Format( "Invalid data binding configuration - Source:{0}, Target:{1}", DataSource, DataTarget ) );
            return;
        }

        sourceProperty = DataSource.GetProperty();
        targetProperty = DataTarget.GetProperty();

        isBound = ( sourceProperty != null ) && ( targetProperty != null );

        if( isBound )
        {
            // Ensure that both properties are synced at start
            targetProperty.Value = sourceProperty.Value;
        }
    }
コード例 #23
0
    /// <summary>
    /// Unbind the source and target properties 
    /// </summary>
    public virtual void Unbind()
    {
        if( !isBound )
            return;

        sourceProperty = null;
        targetProperty = null;

        isBound = false;
    }
コード例 #24
0
    /// <summary>
    /// Bind the source and target properties
    /// </summary>
    public void Bind()
    {
#if !UNITY_IPHONE
        if (isBound)
        {
            return;
        }

        // A dfProxyDataObject might legitimately have a NULL value at scene
        // startup, so just skip binding for now if that's the case. This assumes
        // that the proxy object will have its value set when it's initialized
        // but that control startup order is not consistent.
        if (DataSource is dfDataObjectProxy && ((dfDataObjectProxy)DataSource).Data == null)
        {
            return;
        }

        // Define the constants and types that will be available to the script expression
        //var settings = new dfScriptEngineSettings()
        //{
        //	Constants = new Dictionary<string, object>()
        //	{
        //		// Add any other types whose static members you wish
        //		// to be available to the script expression
        //		{ "Application", typeof( UnityEngine.Application ) },
        //		{ "Color", typeof( UnityEngine.Color ) },
        //		{ "Color32", typeof( UnityEngine.Color32 ) },
        //		{ "Random", typeof( UnityEngine.Random ) },
        //		{ "Time", typeof( UnityEngine.Time ) },
        //		{ "ScriptableObject", typeof( UnityEngine.ScriptableObject ) },
        //		{ "Vector2", typeof( UnityEngine.Vector2 ) },
        //		{ "Vector3", typeof( UnityEngine.Vector3 ) },
        //		{ "Vector4", typeof( UnityEngine.Vector4 ) },
        //		{ "Quaternion", typeof( UnityEngine.Quaternion ) },
        //		{ "Matrix", typeof( UnityEngine.Matrix4x4 ) },
        //		{ "Mathf", typeof( UnityEngine.Mathf ) }
        //	}
        //};

        // Add any variables you want the script expression to have access to
        if (DataSource is dfDataObjectProxy)
        {
            var proxy = DataSource as dfDataObjectProxy;
            //settings.AddVariable( new dfScriptVariable( "source", null, proxy.DataType ) );
        }
        else
        {
            //settings.AddVariable( new dfScriptVariable( "source", DataSource ) );
        }

        // Compile the script expression and store the resulting Delegate.
        // Note that any syntax errors or compile errors will throw an
        // exception here, which is why we don't init the target property
        // or set the isBound variable until after this step.
        //compiledExpression = dfScriptEngine.CompileExpression( expression, settings );

        // Initialize our target property
        targetProperty = DataTarget.GetProperty();

        // Keep track of whether the binding was successful
        isBound = (compiledExpression != null) && (targetProperty != null);
#endif
    }
コード例 #25
0
 protected internal IEnumerator Execute(dfObservableProperty property)
 {
     return(new < Execute > c__Iterator47 <T> {
         property = property, <$> property = property, <> f__this = (dfTweenComponent <T>) this
     });
コード例 #26
0
ファイル: dfTweenComponent.cs プロジェクト: Elringus/HajiJam
    protected internal IEnumerator Execute(dfObservableProperty property)
    {
        isRunning = true;

        this.easingFunction = dfEasingFunctions.GetFunction(this.easingType);
        this.boundProperty  = property;

        onStarted();

        this.actualStartValue = this.startValue;
        this.actualEndValue   = this.endValue;

        if (syncStartWhenRun)
        {
            actualStartValue = (T)property.Value;
        }
        else if (startValueIsOffset)
        {
            actualStartValue = offset(this.startValue, (T)property.Value);
        }

        if (syncEndWhenRun)
        {
            actualEndValue = (T)property.Value;
        }
        else if (endValueIsOffset)
        {
            actualEndValue = offset(this.endValue, (T)property.Value);
        }

        var currentValue = actualStartValue;

        if (delayBeforeStarting > 0f)
        {
            property.Value = currentValue;
            var timeout = Time.realtimeSinceStartup + delayBeforeStarting;
            while (Time.realtimeSinceStartup < timeout)
            {
                yield return(null);
            }
        }

        var startTime = Time.realtimeSinceStartup;
        var elapsed   = 0f;

        var pingPongDirection = 0f;

        while (true)
        {
            if (isPaused)
            {
                yield return(null);

                continue;
            }

            elapsed = Mathf.Min(Time.realtimeSinceStartup - startTime, length);

            var time = easingFunction(0f, 1f, Mathf.Abs(pingPongDirection - elapsed / length));
            if (animCurve != null)
            {
                time = animCurve.Evaluate(time);
            }

            currentValue   = evaluate(actualStartValue, actualEndValue, time);;
            property.Value = currentValue;

            if (elapsed >= length)
            {
                if (loopType == dfTweenLoopType.Once)
                {
                    break;
                }
                else if (loopType == dfTweenLoopType.Loop)
                {
                    startTime = Time.realtimeSinceStartup;
                }
                else if (loopType == dfTweenLoopType.PingPong)
                {
                    startTime = Time.realtimeSinceStartup;
                    if (pingPongDirection == 0f)
                    {
                        pingPongDirection = 1f;
                    }
                    else
                    {
                        pingPongDirection = 0f;
                    }
                }
                else
                {
                    throw new NotImplementedException();
                }
            }

            yield return(null);
        }

        boundProperty.Value = actualEndValue;

        isRunning = false;

        onCompleted();
    }
コード例 #27
0
 protected internal IEnumerator Execute(dfObservableProperty property)
 {
     dfTweenComponent <T> .< Execute > c__Iterator45 variable = null;
     return(variable);
 }
コード例 #28
0
    /// <summary>
    /// Unbind the source and target properties 
    /// </summary>
    public void Unbind()
    {
        if( !isBound )
            return;

        detachEvent();

        sourceProperty = null;
        targetProperty = null;

        isBound = false;
    }
コード例 #29
0
	public override void Reset()
	{

		var sprites = ( clip != null ) ? clip.Sprites : null;
		if( memberInfo.IsValid && sprites != null && sprites.Count > 0 )
		{
			memberInfo.Component.SetProperty( memberInfo.MemberName, sprites[ 0 ] );
		}

		if( !isRunning )
			return;

		StopAllCoroutines();
		isRunning = false;

		onReset();

		this.target = null;

	}
コード例 #30
0
 public void Bind()
 {
     if (this.isBound)
     {
         return;
     }
     if (this.DataSource is dfDataObjectProxy && ((dfDataObjectProxy)this.DataSource).Data == null)
     {
         return;
     }
     dfScriptEngineSettings dfScriptEngineSetting = new dfScriptEngineSettings();
     Dictionary<string, object> strs = new Dictionary<string, object>()
     {
         { "Application", typeof(Application) },
         { "Color", typeof(Color) },
         { "Color32", typeof(Color32) },
         { "Random", typeof(UnityEngine.Random) },
         { "Time", typeof(Time) },
         { "ScriptableObject", typeof(ScriptableObject) },
         { "Vector2", typeof(Vector2) },
         { "Vector3", typeof(Vector3) },
         { "Vector4", typeof(Vector4) },
         { "Quaternion", typeof(Quaternion) },
         { "Matrix", typeof(Matrix4x4) },
         { "Mathf", typeof(Mathf) }
     };
     dfScriptEngineSetting.Constants = strs;
     dfScriptEngineSettings dfScriptEngineSetting1 = dfScriptEngineSetting;
     if (!(this.DataSource is dfDataObjectProxy))
     {
         dfScriptEngineSetting1.AddVariable(new dfScriptVariable("source", this.DataSource));
     }
     else
     {
         dfDataObjectProxy dataSource = this.DataSource as dfDataObjectProxy;
         dfScriptEngineSetting1.AddVariable(new dfScriptVariable("source", null, dataSource.DataType));
     }
     this.compiledExpression = dfScriptEngine.CompileExpression(this.expression, dfScriptEngineSetting1);
     this.targetProperty = this.DataTarget.GetProperty();
     this.isBound = (this.compiledExpression == null ? false : this.targetProperty != null);
 }
コード例 #31
0
 public void Unbind()
 {
     if (!this.isBound)
     {
         return;
     }
     this.sourceProperty = null;
     this.targetProperty = null;
     this.isBound = false;
 }
コード例 #32
0
 public override void Stop()
 {
     List<string> sprites;
     if (!this.isRunning)
     {
         return;
     }
     if (this.clip == null)
     {
         sprites = null;
     }
     else
     {
         sprites = this.clip.Sprites;
     }
     List<string> strs = sprites;
     if (this.skipToEndOnStop && strs != null)
     {
         this.setFrame(Mathf.Max(strs.Count - 1, 0));
     }
     base.StopAllCoroutines();
     this.isRunning = false;
     this.isPaused = false;
     this.onStopped();
     this.target = null;
 }
コード例 #33
0
 public override void Reset()
 {
     List<string> sprites;
     if (this.clip == null)
     {
         sprites = null;
     }
     else
     {
         sprites = this.clip.Sprites;
     }
     List<string> strs = sprites;
     if (this.memberInfo.IsValid && strs != null && strs.Count > 0)
     {
         this.memberInfo.Component.SetProperty(this.memberInfo.MemberName, strs[0]);
     }
     if (!this.isRunning)
     {
         return;
     }
     base.StopAllCoroutines();
     this.isRunning = false;
     this.isPaused = false;
     this.onReset();
     this.target = null;
 }
コード例 #34
0
	public override void Play()
	{

		if( this.IsPlaying )
		{
			this.Stop();
		}

		if( !enabled || !gameObject.activeSelf || !gameObject.activeInHierarchy )
			return;

		if( this.memberInfo == null )
			throw new NullReferenceException( "Animation target is NULL" );

		if( !this.memberInfo.IsValid )
			throw new InvalidOperationException( "Invalid property binding configuration on " + getPath( gameObject.transform ) + " - " + target );

		this.target = this.memberInfo.GetProperty();
		StartCoroutine( Execute() );

	}
コード例 #35
0
	/// <summary>
	/// Unbind the source and target properties 
	/// </summary>
	public void Unbind()
	{

		if( !isBound )
			return;

#if !UNITY_IPHONE
		compiledExpression = null;
		targetProperty = null;
#endif

		isBound = false;

	}
コード例 #36
0
	public override void Stop()
	{

		if( !isRunning )
			return;

		var sprites = ( clip != null ) ? clip.Sprites : null;
		if( skipToEndOnStop && sprites != null )
		{
			setFrame( Mathf.Max( sprites.Count - 1, 0 ) );
		}

		StopAllCoroutines();
		isRunning = false;

		onStopped();

		this.target = null;

	}
コード例 #37
0
 public void Unbind()
 {
     if (!this.isBound)
     {
         return;
     }
     this.compiledExpression = null;
     this.targetProperty = null;
     this.isBound = false;
 }
コード例 #38
0
 public override void Play()
 {
     if (this.IsPlaying)
     {
         this.Stop();
     }
     if (!base.enabled || !base.gameObject.activeSelf || !base.gameObject.activeInHierarchy)
     {
         return;
     }
     if (this.memberInfo == null)
     {
         throw new NullReferenceException("Animation target is NULL");
     }
     if (!this.memberInfo.IsValid)
     {
         throw new InvalidOperationException(string.Concat(new object[] { "Invalid property binding configuration on ", this.getPath(base.gameObject.transform), " - ", this.target }));
     }
     this.target = this.memberInfo.GetProperty();
     base.StartCoroutine(this.Execute());
 }
コード例 #39
0
	/// <summary>
	/// Bind the source and target properties 
	/// </summary>
	public void Bind()
	{
#if !UNITY_IPHONE

		if( isBound )
			return;

		// A dfProxyDataObject might legitimately have a NULL value at scene
		// startup, so just skip binding for now if that's the case. This assumes
		// that the proxy object will have its value set when it's initialized
		// but that control startup order is not consistent.
		if( DataSource is dfDataObjectProxy && ( (dfDataObjectProxy)DataSource ).Data == null )
			return;

		// Define the constants and types that will be available to the script expression
		var settings = new dfScriptEngineSettings()
		{
			Constants = new Dictionary<string, object>()
			{
				// Add any other types whose static members you wish 
				// to be available to the script expression
				{ "Application", typeof( UnityEngine.Application ) },
				{ "Color", typeof( UnityEngine.Color ) },
				{ "Color32", typeof( UnityEngine.Color32 ) },
				{ "Random", typeof( UnityEngine.Random ) },
				{ "Time", typeof( UnityEngine.Time ) },
				{ "ScriptableObject", typeof( UnityEngine.ScriptableObject ) },
				{ "Vector2", typeof( UnityEngine.Vector2 ) },
				{ "Vector3", typeof( UnityEngine.Vector3 ) },
				{ "Vector4", typeof( UnityEngine.Vector4 ) },
				{ "Quaternion", typeof( UnityEngine.Quaternion ) },
				{ "Matrix", typeof( UnityEngine.Matrix4x4 ) },
				{ "Mathf", typeof( UnityEngine.Mathf ) }
			}
		};
		
		// Add any variables you want the script expression to have access to
		if( DataSource is dfDataObjectProxy )
		{
			var proxy = DataSource as dfDataObjectProxy;
			settings.AddVariable( new dfScriptVariable( "source", null, proxy.DataType ) );
		}
		else
		{
			settings.AddVariable( new dfScriptVariable( "source", DataSource ) );
		}

		// Compile the script expression and store the resulting Delegate.
		// Note that any syntax errors or compile errors will throw an 
		// exception here, which is why we don't init the target property
		// or set the isBound variable until after this step.
		compiledExpression = dfScriptEngine.CompileExpression( expression, settings );

		// Initialize our target property
		targetProperty = DataTarget.GetProperty();

		// Keep track of whether the binding was successful
		isBound = ( compiledExpression != null ) && ( targetProperty != null );
#endif
	}