Пример #1
0
    // Token: 0x0600461D RID: 17949 RVA: 0x00107204 File Offset: 0x00105404
    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;
        }
        global::dfDataObjectProxy dfDataObjectProxy = this.DataSource.Component as global::dfDataObjectProxy;

        this.sourceProperty = dfDataObjectProxy.GetProperty(this.DataSource.MemberName);
        this.targetProperty = this.DataTarget.GetProperty();
        this.isBound        = (this.sourceProperty != null && this.targetProperty != null);
        if (this.isBound)
        {
            this.targetProperty.Value = this.sourceProperty.Value;
        }
        this.attachEvent();
    }
Пример #2
0
    // Token: 0x06004621 RID: 17953 RVA: 0x001073D0 File Offset: 0x001055D0
    private void detachEvent()
    {
        if (!this.eventsAttached)
        {
            return;
        }
        this.eventsAttached = false;
        global::dfDataObjectProxy dfDataObjectProxy = this.DataSource.Component as global::dfDataObjectProxy;

        if (dfDataObjectProxy != null)
        {
            dfDataObjectProxy.DataChanged -= this.handle_DataChanged;
        }
    }
    // 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);
    }