Example #1
0
        public static bool UnityEngineVector3MSet(object objSelf, string memberName, CQ_Value param)
        {
            UnityEngine.Vector3 obj = (UnityEngine.Vector3)objSelf;
            switch (memberName)
            {
            case "x":
                if (param.EqualOrImplicateType(typeof(float)))
                {
                    obj.x = (float)param.ConvertTo(typeof(float));
                    return(true);
                }
                break;

            case "y":
                if (param.EqualOrImplicateType(typeof(float)))
                {
                    obj.y = (float)param.ConvertTo(typeof(float));
                    return(true);
                }
                break;

            case "z":
                if (param.EqualOrImplicateType(typeof(float)))
                {
                    obj.z = (float)param.ConvertTo(typeof(float));
                    return(true);
                }
                break;
            }
            return(false);
        }
Example #2
0
        public CQ_Value ComputeValue(CQ_Content content)
        {
#if CQUARK_DEBUG
            content.InStack(this);
#endif
            if (__expressions != null && __expressions.Count > 0)
            {
                CQ_Value v   = __expressions[0].ComputeValue(content);
                object   val = v.value;
                if ((Type)value_type == typeof(Type_Var.var))
                {
                    if (v.type != null)
                    {
                        value_type = v.type;
                    }
                }
                else if (v.type != value_type)
                {
                    val = v.ConvertTo(value_type);
                }

                content.DefineAndSet(value_name, value_type, val);
            }
            else
            {
                content.Define(value_name, value_type);
            }
#if CQUARK_DEBUG
            content.OutStack(this);
#endif
            return(null);
        }
Example #3
0
        public static bool UnityEngineTimeSSet(string memberName, CQ_Value param)
        {
            switch (memberName)
            {
            case "fixedDeltaTime":
                if (param.EqualOrImplicateType(typeof(float)))
                {
                    UnityEngine.Time.fixedDeltaTime = (float)param.ConvertTo(typeof(float));
                    return(true);
                }
                break;

            case "maximumDeltaTime":
                if (param.EqualOrImplicateType(typeof(float)))
                {
                    UnityEngine.Time.maximumDeltaTime = (float)param.ConvertTo(typeof(float));
                    return(true);
                }
                break;

            case "maximumParticleDeltaTime":
                if (param.EqualOrImplicateType(typeof(float)))
                {
                    UnityEngine.Time.maximumParticleDeltaTime = (float)param.ConvertTo(typeof(float));
                    return(true);
                }
                break;

            case "timeScale":
                if (param.EqualOrImplicateType(typeof(float)))
                {
                    UnityEngine.Time.timeScale = (float)param.ConvertTo(typeof(float));
                    return(true);
                }
                break;

            case "captureFramerate":
                if (param.EqualOrImplicateType(typeof(int)))
                {
                    UnityEngine.Time.captureFramerate = (int)param.ConvertTo(typeof(int));
                    return(true);
                }
                break;
            }
            return(false);
        }
Example #4
0
        public IEnumerator CoroutineCompute(CQ_Content content, ICoroutine coroutine)
        {
#if CQUARK_DEBUG
            content.InStack(this);
#endif

            if (_expressions[0].hasCoroutine)
            {
                yield return(coroutine.StartNewCoroutine(_expressions[0].CoroutineCompute(content, coroutine)));
            }
            else
            {
                CQ_Value v = _expressions[0].ComputeValue(content);

                {
                    object  val        = v.value;
                    CQ_Type value_type = null;
                    if (content.values != null && content.values.ContainsKey(value_name))
                    {
                        value_type = content.values[value_name].type;
                    }
                    else
                    {
                        if (content.CallType != null)
                        {
                            if (content.CallType.members.ContainsKey(value_name))
                            {
                                if (content.CallType.members[value_name].bStatic)
                                {
                                    value_type = content.CallType.staticMemberInstance[value_name].type;
                                }
                                else
                                {
                                    value_type = content.CallThis.member[value_name].type;
                                }
                            }
                        }
                    }
                    //val = v.value;
                    if ((Type)value_type != typeof(Type_Var.var) && value_type != v.type)
                    {
                        val = v.ConvertTo(value_type);
                    }


                    content.Set(value_name, val);
                }
            }
#if CQUARK_DEBUG
            content.OutStack(this);
#endif
        }
Example #5
0
        public CQ_Value ComputeValue(CQ_Content content)
        {
#if CQUARK_DEBUG
            content.InStack(this);
#endif
            {
                CQ_Value v = _expressions[0].ComputeValue(content);

                {
                    object  val        = v.value;
                    CQ_Type value_type = null;
                    if (content.values != null && content.values.ContainsKey(value_name))
                    {
                        value_type = content.values[value_name].type;
                    }
                    else
                    {
                        if (content.CallType != null)
                        {
                            if (content.CallType.members.ContainsKey(value_name))
                            {
                                if (content.CallType.members[value_name].bStatic)
                                {
                                    value_type = content.CallType.staticMemberInstance[value_name].type;
                                }
                                else
                                {
                                    value_type = content.CallThis.member[value_name].type;
                                }
                            }
                        }
                    }
                    //val = v.value;
                    if ((Type)value_type != typeof(Type_Var.var) && value_type != v.type)
                    {
                        val = v.ConvertTo(value_type);
                    }


                    content.Set(value_name, val);
                }
            }
#if CQUARK_DEBUG
            content.OutStack(this);
#endif
            return(null);
        }
Example #6
0
        public IEnumerator CoroutineCompute(CQ_Content content, ICoroutine coroutine)
        {
#if CQUARK_DEBUG
            content.InStack(this);
#endif
            if (__expressions != null && __expressions.Count > 0)
            {
                if (__expressions[0].hasCoroutine)
                {
                    yield return(coroutine.StartNewCoroutine(CoroutineCompute(content, coroutine)));
                }
                else
                {
                    CQ_Value v   = __expressions[0].ComputeValue(content);
                    object   val = v.value;
                    if ((Type)value_type == typeof(Type_Var.var))
                    {
                        if (v.type != null)
                        {
                            value_type = v.type;
                        }
                    }
                    else if (v.type != value_type)
                    {
                        val = v.ConvertTo(value_type);
                    }

                    content.DefineAndSet(value_name, value_type, val);
                }
            }
            else
            {
                content.Define(value_name, value_type);
            }
#if CQUARK_DEBUG
            content.OutStack(this);
#endif
        }
Example #7
0
        void NewStatic()
        {
            if (this.staticMemberInstance == null)
            {
                staticMemberInstance = new Dictionary <string, CQ_Value>();
                foreach (var i in this.members)
                {
                    if (i.Value.bStatic == true)
                    {
                        if (i.Value.expr_defvalue == null)
                        {
                            CQ_Value val = new CQ_Value();
                            val.SetObject(i.Value.m_itype.typeBridge, i.Value.m_itype.defaultValue);
                            staticMemberInstance[i.Key] = val;
                        }
                        else
                        {
                            CQ_Value value = i.Value.expr_defvalue.ComputeValue(contentMemberCalc);
                            if (i.Value.m_itype.typeBridge != value.typeBridge)
                            {
                                CQ_Value val = new CQ_Value();
                                val.SetObject(i.Value.m_itype.typeBridge, value.ConvertTo(i.Value.m_itype.typeBridge));
                                staticMemberInstance[i.Key] = val;

                                //staticMemberInstance[i.Key] = new CQ_Value();
                                //staticMemberInstance[i.Key].SetCQType( i.Value.type.cqType);
                                //staticMemberInstance[i.Key].value = value.ConvertTo(i.Value.type.cqType);
                            }
                            else
                            {
                                staticMemberInstance[i.Key] = value;
                            }
                        }
                    }
                }
            }
        }
Example #8
0
        public static bool UnityEngineTransformMSet(object objSelf, string memberName, CQ_Value param)
        {
            UnityEngine.Transform obj = (UnityEngine.Transform)objSelf;
            switch (memberName)
            {
            case "position":
                if (param.EqualOrImplicateType(typeof(UnityEngine.Vector3)))
                {
                    obj.position = (UnityEngine.Vector3)param.ConvertTo(typeof(UnityEngine.Vector3));
                    return(true);
                }
                break;

            case "localPosition":
                if (param.EqualOrImplicateType(typeof(UnityEngine.Vector3)))
                {
                    obj.localPosition = (UnityEngine.Vector3)param.ConvertTo(typeof(UnityEngine.Vector3));
                    return(true);
                }
                break;

            case "eulerAngles":
                if (param.EqualOrImplicateType(typeof(UnityEngine.Vector3)))
                {
                    obj.eulerAngles = (UnityEngine.Vector3)param.ConvertTo(typeof(UnityEngine.Vector3));
                    return(true);
                }
                break;

            case "localEulerAngles":
                if (param.EqualOrImplicateType(typeof(UnityEngine.Vector3)))
                {
                    obj.localEulerAngles = (UnityEngine.Vector3)param.ConvertTo(typeof(UnityEngine.Vector3));
                    return(true);
                }
                break;

            case "right":
                if (param.EqualOrImplicateType(typeof(UnityEngine.Vector3)))
                {
                    obj.right = (UnityEngine.Vector3)param.ConvertTo(typeof(UnityEngine.Vector3));
                    return(true);
                }
                break;

            case "up":
                if (param.EqualOrImplicateType(typeof(UnityEngine.Vector3)))
                {
                    obj.up = (UnityEngine.Vector3)param.ConvertTo(typeof(UnityEngine.Vector3));
                    return(true);
                }
                break;

            case "forward":
                if (param.EqualOrImplicateType(typeof(UnityEngine.Vector3)))
                {
                    obj.forward = (UnityEngine.Vector3)param.ConvertTo(typeof(UnityEngine.Vector3));
                    return(true);
                }
                break;

            case "rotation":
                if (param.EqualOrImplicateType(typeof(UnityEngine.Quaternion)))
                {
                    obj.rotation = (UnityEngine.Quaternion)param.ConvertTo(typeof(UnityEngine.Quaternion));
                    return(true);
                }
                break;

            case "localRotation":
                if (param.EqualOrImplicateType(typeof(UnityEngine.Quaternion)))
                {
                    obj.localRotation = (UnityEngine.Quaternion)param.ConvertTo(typeof(UnityEngine.Quaternion));
                    return(true);
                }
                break;

            case "localScale":
                if (param.EqualOrImplicateType(typeof(UnityEngine.Vector3)))
                {
                    obj.localScale = (UnityEngine.Vector3)param.ConvertTo(typeof(UnityEngine.Vector3));
                    return(true);
                }
                break;

            case "parent":
                if (param.EqualOrImplicateType(typeof(UnityEngine.Transform)))
                {
                    obj.parent = (UnityEngine.Transform)param.ConvertTo(typeof(UnityEngine.Transform));
                    return(true);
                }
                break;

            case "hasChanged":
                if (param.EqualOrImplicateType(typeof(bool)))
                {
                    obj.hasChanged = (bool)param.ConvertTo(typeof(bool));
                    return(true);
                }
                break;

            case "hierarchyCapacity":
                if (param.EqualOrImplicateType(typeof(int)))
                {
                    obj.hierarchyCapacity = (int)param.ConvertTo(typeof(int));
                    return(true);
                }
                break;

            case "tag":
                if (param.EqualOrImplicateType(typeof(string)))
                {
                    obj.tag = (string)param.ConvertTo(typeof(string));
                    return(true);
                }
                break;

            case "name":
                if (param.EqualOrImplicateType(typeof(string)))
                {
                    obj.name = (string)param.ConvertTo(typeof(string));
                    return(true);
                }
                break;

            case "hideFlags":
                if (param.EqualOrImplicateType(typeof(UnityEngine.HideFlags)))
                {
                    obj.hideFlags = (UnityEngine.HideFlags)param.ConvertTo(typeof(UnityEngine.HideFlags));
                    return(true);
                }
                break;
            }
            return(false);
        }