public CQ_Value ComputeValue(CQ_Content content) { #if CQUARK_DEBUG content.InStack(this); #endif var parent = _expressions[0].ComputeValue(content); if (parent == null) { throw new Exception("调用空对象的方法:" + _expressions[0].ToString() + ":" + ToString()); } var value = _expressions[1].ComputeValue(content); //这几行是为了快速获取Unity的静态变量,而不需要反射 if (!Wrap.MemberValueSet(parent.type.type, parent.value, membername, value)) { var iclass = CQuark.AppDomain.GetType(parent.type)._class; CQClassInstance s = parent.value as CQClassInstance; if (s != null) { iclass = s.type; } iclass.MemberValueSet(content, parent.value, membername, value.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 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 parent = _expressions[0].ComputeValue(content); if (parent == CQ_Value.Null) { throw new Exception("调用空对象的方法:" + _expressions[0].ToString() + ":" + ToString()); } IType type = CQuark.AppDomain.GetITypeByCQValue(parent); CQ_Value getvalue = CQ_Value.Null; object obj = parent.GetObject(); //这几行是为了快速获取Unity的静态变量,而不需要反射 if (!Wrap.MemberValueGet(parent.m_type, obj, membername, out getvalue)) { getvalue = type._class.MemberValueGet(content, obj, membername); } CQ_Value vright = CQ_Value.One; if (_expressions.Count > 1) { vright = _expressions[1].ComputeValue(content); } IType mtype = CQuark.AppDomain.GetITypeByCQValue(getvalue); CQ_Value vout = mtype.Math2Value(mathop, getvalue, vright); //这几行是为了快速获取Unity的静态变量,而不需要反射 if (!Wrap.MemberValueSet(parent.m_type, obj, membername, vout)) { type._class.MemberValueSet(content, obj, membername, 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.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); }