コード例 #1
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);
     }
 }
コード例 #2
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);
    }
    // Token: 0x060045F2 RID: 17906 RVA: 0x001067A0 File Offset: 0x001049A0
    public void Bind()
    {
        if (this.isBound)
        {
            return;
        }
        if (this.DataSource is global::dfDataObjectProxy && ((global::dfDataObjectProxy)this.DataSource).Data == null)
        {
            return;
        }
        dfScriptEngineSettings dfScriptEngineSettings = new dfScriptEngineSettings
        {
            Constants = new Dictionary <string, object>
            {
                {
                    "Application",
                    typeof(Application)
                },
                {
                    "Color",
                    typeof(Color)
                },
                {
                    "Color32",
                    typeof(Color32)
                },
                {
                    "Random",
                    typeof(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)
                }
            }
        };

        if (this.DataSource is global::dfDataObjectProxy)
        {
            global::dfDataObjectProxy dfDataObjectProxy = this.DataSource as global::dfDataObjectProxy;
            dfScriptEngineSettings.AddVariable(new dfScriptVariable("source", null, dfDataObjectProxy.DataType));
        }
        else
        {
            dfScriptEngineSettings.AddVariable(new dfScriptVariable("source", this.DataSource));
        }
        this.compiledExpression = dfScriptEngine.CompileExpression(this.expression, dfScriptEngineSettings);
        this.targetProperty     = this.DataTarget.GetProperty();
        this.isBound            = (this.compiledExpression != null && this.targetProperty != null);
    }
コード例 #4
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
	}
コード例 #5
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
    }