public CQ_Value ComputeValue(CQ_Content content) { #if CQUARK_DEBUG content.InStack(this); #endif CQ_Value getvalue = CQ_Value.Null; //这几行是为了快速获取Unity的静态变量,而不需要反射 if (!Wrap.StaticValueGet(type.typeBridge.type, staticmembername, out getvalue)) { getvalue = type._class.StaticValueGet(content, staticmembername); } CQ_Value vright = CQ_Value.One; if (_expressions.Count > 0) { vright = _expressions[0].ComputeValue(content); } var mtype = CQuark.AppDomain.GetITypeByCQValue(getvalue); CQ_Value vout = mtype.Math2Value(mathop, getvalue, vright); //这几行是为了快速获取Unity的静态变量,而不需要反射 if (!Wrap.StaticValueSet(type.typeBridge.type, staticmembername, vout)) { type._class.StaticValueSet(content, staticmembername, vout); } #if CQUARK_DEBUG content.OutStack(this); #endif return(vout); }
public CQ_Value ComputeValue(CQ_Content content) { #if CQUARK_DEBUG content.InStack(this); #endif CQ_Value left = _expressions[0].ComputeValue(content); CQ_Value right = _expressions[1].ComputeValue(content); IType type = CQuark.AppDomain.GetType(left.type); CQ_Type returntype; object value = type.Math2Value(mathop, left.value, right, out returntype); value = type.ConvertTo(value, left.type); CQ_Value val = new CQ_Value(); val.type = returntype; val.value = value; if (_expressions[0] is CQ_Expression_MemberValueGet) { CQ_Expression_MemberValueGet f = _expressions[0] as CQ_Expression_MemberValueGet; var parent = f._expressions[0].ComputeValue(content); if (parent == null) { throw new Exception("调用空对象的方法:" + f._expressions[0].ToString() + ":" + ToString()); } //这几行是为了快速获取Unity的静态变量,而不需要反射 if (!Wrap.MemberValueSet(parent.type.type, parent.value, f.membername, val)) { var ptype = CQuark.AppDomain.GetType(parent.type); ptype._class.MemberValueSet(content, parent.value, f.membername, value); } } if (_expressions[0] is CQ_Expression_StaticValueGet) { CQ_Expression_StaticValueGet f = _expressions[0] as CQ_Expression_StaticValueGet; //这几行是为了快速获取Unity的静态变量,而不需要反射 if (!Wrap.StaticValueSet(type.typeBridge.type, f.staticmembername, val)) { f.type._class.StaticValueSet(content, f.staticmembername, value); } } #if CQUARK_DEBUG content.OutStack(this); #endif return(null); }
public CQ_Value ComputeValue(CQ_Content content) { #if CQUARK_DEBUG content.InStack(this); #endif CQ_Value value = _expressions[0].ComputeValue(content); //这几行是为了快速获取Unity的静态变量,而不需要反射 if (!Wrap.StaticValueSet(type.typeBridge.type, staticmembername, value)) { type._class.StaticValueSet(content, staticmembername, value); } #if CQUARK_DEBUG content.OutStack(this); #endif return(CQ_Value.Null); }
public CQ_Value ComputeValue(CQ_Content content) { #if CQUARK_DEBUG content.InStack(this); #endif CQ_Value left = _expressions[0].ComputeValue(content); CQ_Value right = _expressions[1].ComputeValue(content); IType type = CQuark.AppDomain.GetITypeByCQValue(left); CQ_Value val = type.Math2Value(mathop, left, right); //val.SetValue(left.typeBridge, type.ConvertTo(val.GetValue(), left.typeBridge)); left.UsingValue(val); if (_expressions[0] is CQ_Expression_MemberValueGet) { CQ_Expression_MemberValueGet f = _expressions[0] as CQ_Expression_MemberValueGet; CQ_Value parent = f._expressions[0].ComputeValue(content); if (parent == CQ_Value.Null) { throw new Exception("调用空对象的方法:" + f._expressions[0].ToString() + ":" + ToString()); } //这几行是为了快速获取Unity的静态变量,而不需要反射 object obj = parent.GetObject(); if (!Wrap.MemberValueSet(parent.m_type, obj, f.membername, val)) { IType ptype = CQuark.AppDomain.GetITypeByCQValue(parent); ptype._class.MemberValueSet(content, obj, f.membername, val); } } else if (_expressions[0] is CQ_Expression_StaticValueGet) { CQ_Expression_StaticValueGet f = _expressions[0] as CQ_Expression_StaticValueGet; //这几行是为了快速获取Unity的静态变量,而不需要反射 if (!Wrap.StaticValueSet(type.typeBridge.type, f.staticmembername, val)) { f.type._class.StaticValueSet(content, f.staticmembername, val); } } else if (_expressions[0] is CQ_Expression_GetValue) { CQ_Expression_GetValue f = _expressions[0] as CQ_Expression_GetValue; content.Set(f.value_name, left); } else if (_expressions[0] is CQ_Expression_IndexGet) { CQ_Expression_IndexGet f = _expressions[0] as CQ_Expression_IndexGet; CQ_Value parent = f._expressions[0].ComputeValue(content); object obj = parent.GetObject(); CQ_Value key = f._expressions[1].ComputeValue(content); IType parenttype = CQuark.AppDomain.GetITypeByCQValue(parent); parenttype._class.IndexSet(content, obj, key.GetObject(), left.GetObject()); CQ_Expression_GetValue g = f._expressions[0] as CQ_Expression_GetValue; content.Set(g.value_name, parent); } #if CQUARK_DEBUG content.OutStack(this); #endif return(CQ_Value.Null); }