Exemple #1
0
        public override void MemberValueSet(CLS_Content content, object object_this, string valuename, object value, bool isBaseCall = false)
        {
            Quaternion newVal = (Quaternion)object_this;

            if (valuename == "eulerAngles")
            {
                newVal.eulerAngles = ((Vector3)value);
            }
            else if (valuename == "w")
            {
                newVal.w = Convert.ToSingle(value);
            }
            else if (valuename == "x")
            {
                newVal.x = Convert.ToSingle(value);
            }
            else if (valuename == "y")
            {
                newVal.y = Convert.ToSingle(value);
            }
            else if (valuename == "z")
            {
                newVal.z = Convert.ToSingle(value);
            }
            else
            {
                base.MemberValueSet(content, object_this, valuename, value, isBaseCall);
            }
            ICLS_Expression         expLeft     = content.CallExpression.listParam[0];
            CLS_Expression_GetValue expGetValue = expLeft as CLS_Expression_GetValue;

            if (expGetValue != null)
            {
                content.Set(expGetValue.value_name, newVal);
                return;
            }
            CLS_Expression_MemberFind expMemberFind = expLeft as CLS_Expression_MemberFind;

            if (expMemberFind != null)
            {
                expGetValue = expMemberFind.listParam[0] as CLS_Expression_GetValue;
                if (content.CallExpression is CLS_Expression_SelfOpWithValue)
                {
                    content.Set(expGetValue.value_name, newVal);
                    return;
                }
                CLS_Content.Value val = content.Get(expGetValue.value_name);
                content.environment.GetType(val.type).function.MemberValueSet(content, val.value, expMemberFind.membername, newVal);
                return;
            }

            base.MemberValueSet(content, object_this, valuename, value, isBaseCall);
        }
        public override CLS_Content.Value MemberCall(CLS_Content content, object object_this, string function, BetterList <CLS_Content.Value> _params, bool isBaseCall = false)
        {
            CLS_Content.Value retVal = null;

            Color newVal = (Color)object_this;

            if (function == "Equals")
            {
                retVal = new CLS_Content.Value();

                retVal.type  = typeof(bool);
                retVal.value = newVal.Equals(_params[0].value);
            }
            else if (function == "ToString")
            {
                if (_params.size == 0)
                {
                    retVal       = new CLS_Content.Value();
                    retVal.type  = typeof(string);
                    retVal.value = newVal.ToString();
                }
                else if (_params.size == 1)
                {
                    retVal       = new CLS_Content.Value();
                    retVal.type  = typeof(string);
                    retVal.value = newVal.ToString(((string)_params[0].value));
                }
            }
            else
            {
                return(base.MemberCall(content, object_this, function, _params, isBaseCall));
            }
            ICLS_Expression         expLeft     = content.CallExpression.listParam[0];
            CLS_Expression_GetValue expGetValue = expLeft as CLS_Expression_GetValue;

            if (expGetValue != null)
            {
                content.Set(expGetValue.value_name, newVal);
                return(retVal);
            }
            CLS_Expression_MemberFind expMemberFind = expLeft as CLS_Expression_MemberFind;

            if (expMemberFind != null)
            {
                expGetValue = expMemberFind.listParam[0] as CLS_Expression_GetValue;
                CLS_Content.Value val = content.Get(expGetValue.value_name);
                content.environment.GetType(val.type).function.MemberValueSet(content, val.value, expMemberFind.membername, newVal);
                return(retVal);
            }

            return(base.MemberCall(content, object_this, function, _params, isBaseCall));
        }
        public override void MemberValueSet(CLS_Content content, object object_this, string valuename, object value, bool isBaseCall = false)
        {
            Color newVal = (Color)object_this;

            if (valuename == "a")
            {
                newVal.a = Convert.ToSingle(value);
            }
            else if (valuename == "b")
            {
                newVal.b = Convert.ToSingle(value);
            }
            else if (valuename == "g")
            {
                newVal.g = Convert.ToSingle(value);
            }
            else if (valuename == "r")
            {
                newVal.r = Convert.ToSingle(value);
            }
            else
            {
                base.MemberValueSet(content, object_this, valuename, value, isBaseCall);
            }
            ICLS_Expression         expLeft     = content.CallExpression.listParam[0];
            CLS_Expression_GetValue expGetValue = expLeft as CLS_Expression_GetValue;

            if (expGetValue != null)
            {
                content.Set(expGetValue.value_name, newVal);
                return;
            }
            CLS_Expression_MemberFind expMemberFind = expLeft as CLS_Expression_MemberFind;

            if (expMemberFind != null)
            {
                expGetValue = expMemberFind.listParam[0] as CLS_Expression_GetValue;
                if (content.CallExpression is CLS_Expression_SelfOpWithValue)
                {
                    content.Set(expGetValue.value_name, newVal);
                    return;
                }
                CLS_Content.Value val = content.Get(expGetValue.value_name);
                content.environment.GetType(val.type).function.MemberValueSet(content, val.value, expMemberFind.membername, newVal);
                return;
            }

            base.MemberValueSet(content, object_this, valuename, value, isBaseCall);
        }