public CQ_Value ComputeValue(CQ_Content content) { #if CQUARK_DEBUG content.InStack(this); #endif CQ_Value v = _expressions[0].ComputeValue(content); CQ_Value oldVal = CQ_Value.Null; if (content.values != null && content.values.ContainsKey(value_name)) { oldVal = content.values[value_name]; } else if (content.CallType != null && content.CallType.members.ContainsKey(value_name)) { if (content.CallType.members[value_name].bStatic) { oldVal = content.CallType.staticMemberInstance[value_name]; } else { oldVal = content.CallThis.member[value_name]; } } oldVal.UsingValue(v); content.Set(value_name, oldVal); #if CQUARK_DEBUG content.OutStack(this); #endif return(CQ_Value.Null); }
public CQ_Content.Value ComputeValue(CQ_Content content) { content.InStack(this); CQ_Content.Value result = new CQ_Content.Value(); //if (mathop == "&&" || mathop == "||") { bool bleft = false; bool bright = false; if (listParam[0] is ICQ_Value) { bleft = (bool)((listParam[0] as ICQ_Value).value); } else { bleft = (bool)listParam[0].ComputeValue(content).value; } result.type = typeof(bool); if (mathop == '&') { if (!bleft) { result.value = false; } else { if (listParam[1] is ICQ_Value) { bright = (bool)((listParam[1] as ICQ_Value).value); } else { bright = (bool)listParam[1].ComputeValue(content).value; } result.value = (bool)(bleft && bright); } } else if (mathop == '|') { if (bleft) { result.value = true; } else { if (listParam[1] is ICQ_Value) { bright = (bool)((listParam[1] as ICQ_Value).value); } else { bright = (bool)listParam[1].ComputeValue(content).value; } result.value = (bool)(bleft || bright); } } } content.OutStack(this); return(result); }
public CQ_Value ComputeValue(CQ_Content content) { #if CQUARK_DEBUG content.InStack(this); #endif content.DepthAdd(); CQ_Value value = null; foreach (ICQ_Expression i in _expressions) { ICQ_Expression e = i as ICQ_Expression; if (e != null) { value = e.ComputeValue(content); } if (value != null && value.breakBlock != 0) { break; } } content.DepthRemove(); #if CQUARK_DEBUG content.OutStack(this); #endif return(value); }
public CQ_Value ComputeValue(CQ_Content content) { #if CQUARK_DEBUG content.InStack(this); #endif var right = _expressions[0].ComputeValue(content); IType type = CQuark.AppDomain.GetITypeByCQValue(right); CQ_Value value = new CQ_Value(); if (targettype.type != null) { value.SetObject(targettype.type, type.ConvertTo(right.GetObject(), targettype)); } else if (targettype.stype != null) { value.SetObject(targettype.stype, type.ConvertTo(right.GetObject(), targettype)); } #if CQUARK_DEBUG content.OutStack(this); #endif return(value); }
public CQ_Value ComputeValue(CQ_Content content) { #if CQUARK_DEBUG content.InStack(this); #endif CQ_Value parent = _expressions[0].ComputeValue(content); object obj = parent.GetObject(); if (parent == CQ_Value.Null) { throw new Exception("调用空对象的方法:" + _expressions[0].ToString() + ":" + ToString()); } var key = _expressions[1].ComputeValue(content); CQ_Value value = CQ_Value.Null; //这几行是为了快速获取Unity的静态变量,而不需要反射 if (!Wrap.IndexGet(parent.m_type, obj, key, out value)) { IType type = CQuark.AppDomain.GetITypeByCQValue(parent); value = type._class.IndexGet(content, obj, key.GetObject()); } #if CQUARK_DEBUG content.OutStack(this); #endif return(value); }
public IEnumerator CoroutineCompute(CQ_Content content, UnityEngine.MonoBehaviour coroutine) { #if CQUARK_DEBUG content.InStack(this); #endif CQ_Value rv = new CQ_Value(); if (_expressions.Count > 0 && _expressions[0] != null) { rv = _expressions[0].ComputeValue(content); } else { rv.m_type = typeof(void); } rv.m_breakBlock = BreakType.YieldReturn; #if CQUARK_DEBUG content.OutStack(this); #endif if (rv == CQ_Value.Null) { yield return(null); } else if (rv.m_type == typeof(IEnumerator)) { yield return(coroutine.StartCoroutine(rv.GetObject() as IEnumerator)); } else { yield return(rv.GetObject());//这里Unity会非常智能的自动去转型 } }
public CQ_Value ComputeValue(CQ_Content content) { #if CQUARK_DEBUG content.InStack(this); #endif List <CQ_Value> _params = new List <CQ_Value>(); for (int i = 0; i < _expressions.Count; i++) { _params.Add(_expressions[i].ComputeValue(content)); } CQ_Value value = null; //这几行是为了快速获取Unity的静态变量,而不需要反射 if (!Wrap.StaticCall(type.typeBridge.type, functionName, _params, out value)) { if (cache == null || cache.cachefail) { cache = new MethodCache(); value = type._class.StaticCall(content, functionName, _params, cache); } else { value = type._class.StaticCallCache(content, _params, cache); } } #if CQUARK_DEBUG content.OutStack(this); #endif return(value); }
public CQ_Content.Value ComputeValue(CQ_Content content) { content.InStack(this); var parent = listParam[0].ComputeValue(content); if (parent == null) { throw new Exception("调用空对象的方法:" + listParam[0].ToString() + ":" + ToString()); } var key = listParam[1].ComputeValue(content); var value = listParam[2].ComputeValue(content); //object setv=value.value; //if(value.type!=parent.type) //{ // var vtype = content.environment.GetType(value.type); // setv = vtype.ConvertTo(content.environment, setv, parent.type); //} var type = content.environment.GetType(parent.type); type.function.IndexSet(content, parent.value, key.value, value.value); //做数学计算 //从上下文取值 //_value = null; content.OutStack(this); return(null); }
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 key = _expressions[1].ComputeValue(content); var value = _expressions[2].ComputeValue(content); //object setv=value.value; //if(value.type!=parent.type) //{ // var vtype = CQuark.AppDomain.GetType(value.type); // setv = vtype.ConvertTo(CQuark.AppDomain, setv, parent.type); //} //这几行是为了快速获取Unity的静态变量,而不需要反射 if (!Wrap.IndexSet(parent.type.type, parent.value, key, value)) { var type = CQuark.AppDomain.GetType(parent.type); type._class.IndexSet(content, parent.value, key.value, 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[] parameters = CQ_ObjPool.PopArray(_expressions.Count); for (int i = 0; i < _expressions.Count; i++) { parameters[i] = _expressions[i].ComputeValue(content); } CQ_Value value = CQ_Value.Null; //这几行是为了快速获取Unity的静态变量,而不需要反射 if (!Wrap.StaticCall(type.typeBridge.type, functionName, parameters, out value)) { if (cache == null || cache.cachefail) { cache = new MethodCache(); value = type._class.StaticCall(content, functionName, parameters, cache); } else { value = type._class.StaticCallCache(content, parameters, cache); } } #if CQUARK_DEBUG content.OutStack(this); #endif CQ_ObjPool.PushArray(parameters); return(value); }
public CQ_Value ComputeValue(CQ_Content content) { #if CQUARK_DEBUG content.InStack(this); #endif var parent = _expressions[0].ComputeValue(content); if (parent == CQ_Value.Null) { throw new Exception("调用空对象的方法:" + _expressions[0].ToString() + ":" + ToString()); } var value = _expressions[1].ComputeValue(content); //这几行是为了快速获取Unity的静态变量,而不需要反射 object obj = parent.GetObject(); if (!Wrap.MemberValueSet(parent.m_type, obj, membername, value)) { IClass iclass = CQuark.AppDomain.GetITypeByCQValue(parent)._class; CQ_ClassInstance s = obj as CQ_ClassInstance; if (s != null) { iclass = s.type; } iclass.MemberValueSet(content, obj, membername, 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 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); }
public CQ_Content.Value ComputeValue(CQ_Content content) { content.InStack(this); var parent = listParam[0].ComputeValue(content); if (parent == null) { throw new Exception("调用空对象的方法:" + listParam[0].ToString() + ":" + ToString()); } var value = listParam[1].ComputeValue(content); object setv = value.value; //if(value.type!=parent.type) //{ // var vtype = content.environment.GetType(value.type); // setv = vtype.ConvertTo(content.environment, setv, parent.type); //} var typefunction = content.environment.GetType(parent.type).function; if (parent.type is object) { SInstance s = parent.value as SInstance; if (s != null) { typefunction = s.type; } } typefunction.MemberValueSet(content, parent.value, membername, setv); //做数学计算 //从上下文取值 //_value = null; content.OutStack(this); return(null); }
public CQ_Content.Value ComputeValue(CQ_Content content) { content.InStack(this); var parent = listParam[0].ComputeValue(content); if (parent == null) { throw new Exception("调用空对象的方法:" + listParam[0].ToString() + ":" + ToString()); } var type = content.environment.GetType(parent.type); //string membername=null; var getvalue = type.function.MemberValueGet(content, parent.value, membername); CQ_Content.Value vright = CQ_Content.Value.One; if (listParam.Count > 1) { vright = listParam[1].ComputeValue(content); } CQ_Content.Value vout = new CQ_Content.Value(); var mtype = content.environment.GetType(getvalue.type); vout.value = mtype.Math2Value(content, mathop, getvalue.value, vright, out vout.type); type.function.MemberValueSet(content, parent.value, membername, vout.value); //CQ_Content.Value v = new CQ_Content.Value(); content.OutStack(this); return(vout); //做数学计算 //从上下文取值 //_value = null; //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 == null) { throw new Exception("调用空对象的方法:" + _expressions[0].ToString() + ":" + ToString()); } CQ_Value value = null; //这几行是为了快速获取Unity的静态变量,而不需要反射 if (!Wrap.MemberValueGet(parent.type.type, parent.value, membername, out value)) { IClass iclass = CQuark.AppDomain.GetType(parent.type)._class; CQClassInstance s = parent.value as CQClassInstance; if (s != null) { iclass = s.type; } value = iclass.MemberValueGet(content, parent.value, membername); } #if CQUARK_DEBUG content.OutStack(this); #endif return(value); //做数学计算 //从上下文取值 //_value = null; //return null; }
public CQ_Value ComputeValue(CQ_Content content) { #if CQUARK_DEBUG content.InStack(this); #endif CQ_Value[] parameters = CQ_ObjPool.PopArray(_expressions.Count); for (int i = 0; i < _expressions.Count; i++) { parameters[i] = _expressions[i].ComputeValue(content); } CQ_Value value = CQ_Value.Null; //这几行是为了快速获取Unity的静态变量,而不需要反射 if (!Wrap.New(type.typeBridge.type, parameters, out value)) { value = type._class.New(content, parameters); } #if CQUARK_DEBUG content.OutStack(this); #endif CQ_ObjPool.PushArray(parameters); return(value); }
public CQ_Content.Value ComputeValue(CQ_Content content) { content.InStack(this); List <object> list = new List <object>(); int count = listParam[0] == null ? (listParam.Count - 1) : (int)listParam[0].ComputeValue(content).value; if (count == 0) { throw new Exception("不能创建0长度数组"); } CQ_Content.Value vcount = new CQ_Content.Value(); vcount.type = typeof(int); vcount.value = count; for (int i = 1; i < listParam.Count; i++) { //if (listParam[i] != null) { list.Add(listParam[i].ComputeValue(content).value); } } List <CQ_Content.Value> p = new List <CQ_Content.Value>(); p.Add(vcount); var outvalue = type.function.New(content, p); for (int i = 0; i < list.Count; i++) { type.function.IndexSet(content, outvalue.value, i, list[i]); } content.OutStack(this); return(outvalue); }
public CQ_Content.Value ComputeValue(CQ_Content content) { content.InStack(this); CQ_Content.Value result = null; { result = new CQ_Content.Value(); var value = listParam[0].ComputeValue(content); if ((Type)value.type != typeof(bool)) { throw new Exception("三元表达式要求条件为bool型"); } bool bv = (bool)value.value; if (bv) { result = listParam[1].ComputeValue(content); } else { result = listParam[2].ComputeValue(content); } } content.OutStack(this); return(result); }
public CQ_Content.Value ComputeValue(CQ_Content content) { content.InStack(this); //var parent = listParam[0].ComputeValue(content); //var type = content.environment.GetType(parent.type); List <CQ_Content.Value> _params = new List <CQ_Content.Value>(); for (int i = 0; i < listParam.Count; i++) { _params.Add(listParam[i].ComputeValue(content)); } CQ_Content.Value value = null; if (cache == null || cache.cachefail) { cache = new MethodCache(); value = type.function.StaticCall(content, functionName, _params, cache); } else { value = type.function.StaticCallCache(content, _params, cache); } content.OutStack(this); return(value); //做数学计算 //从上下文取值 //_value = null; //return null; }
public CQ_Value ComputeValue(CQ_Content content) { #if CQUARK_DEBUG content.InStack(this); #endif List <CQ_Value> param = new List <CQ_Value>(); //TODO 这些_expressions一开始就做非空判断,那么List全部可以换成数组了 foreach (ICQ_Expression p in _expressions) { if (p != null) { param.Add(p.ComputeValue(content)); } } CQ_Value value = null; //这几行是为了快速获取Unity的静态变量,而不需要反射 if (!Wrap.New(type.typeBridge.type, param, out value)) { value = type._class.New(content, param); } #if CQUARK_DEBUG content.OutStack(this); #endif return(value); }
public CQ_Content.Value ComputeValue(CQ_Content content) { content.InStack(this); if (_listParam != null && _listParam.Count > 0) { CQ_Content.Value v = _listParam[0].ComputeValue(content); object val = v.value; if ((Type)value_type == typeof(CQ_Type_Var.var)) { if (v.type != null) { value_type = v.type; } } else if (v.type != value_type) { val = content.environment.GetType(v.type).ConvertTo(content, v.value, value_type); } content.DefineAndSet(value_name, value_type, val); } else { content.Define(value_name, value_type); } //设置环境变量为 content.OutStack(this); return(null); }
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 key = _expressions[1].ComputeValue(content); CQ_Value value = null; //这几行是为了快速获取Unity的静态变量,而不需要反射 if (!Wrap.IndexGet(parent.type.type, parent.value, key, out value)) { var type = CQuark.AppDomain.GetType(parent.type); value = type._class.IndexGet(content, parent.value, key.value); } #if CQUARK_DEBUG content.OutStack(this); #endif //IndexGet返回的值类型是 System.Object. //在这里需要将类型明确化. //value.type = value.value.GetType(); return(value); //return type.function.MemberValueGet(CQuark.AppDomain, parent.value, membername); //做数学计算 //从上下文取值 //_value = null; //return null; }
public CQ_Content.Value ComputeValue(CQ_Content content) { content.InStack(this); CQ_Content.Value rv = new CQ_Content.Value(); rv.breakBlock = 10; if (listParam.Count > 0 && listParam[0] != null) { var v = listParam[0].ComputeValue(content); { rv.type = v.type; rv.value = v.value; } } else { rv.type = typeof(void); } content.OutStack(this); return(rv); //for 逻辑 //做数学计算 //从上下文取值 //_value = null; }
public CQ_Content.Value ComputeValue(CQ_Content content) { content.InStack(this); var parent = listParam[0].ComputeValue(content); if (parent == null) { throw new Exception("调用空对象的方法:" + listParam[0].ToString() + ":" + ToString()); } var key = listParam[1].ComputeValue(content); var type = content.environment.GetType(parent.type); var value = type.function.IndexGet(content, parent.value, key.value); content.OutStack(this); //IndexGet返回的值类型是 System.Object. //在这里需要将类型明确化. //value.type = value.value.GetType(); return(value); //return type.function.MemberValueGet(content.environment, parent.value, membername); //做数学计算 //从上下文取值 //_value = null; //return null; }
public CQ_Value ComputeValue(CQ_Content content) { #if CQUARK_DEBUG content.InStack(this); #endif CQ_Value result = CQ_Value.Null; { result = new CQ_Value(); var value = _expressions[0].ComputeValue(content); if (value.m_type != typeof(bool)) { throw new Exception("三元表达式要求条件为bool型"); } bool bv = value.GetBool(); if (bv) { result = _expressions[1].ComputeValue(content); } else { result = _expressions[2].ComputeValue(content); } } #if CQUARK_DEBUG content.OutStack(this); #endif return(result); }
public IEnumerator CoroutineCompute(CQ_Content content, UnityEngine.MonoBehaviour coroutine) { #if CQUARK_DEBUG content.InStack(this); #endif content.DepthAdd(); CQ_Value value = new CQ_Value(); foreach (ICQ_Expression e in _expressions) { if (e != null) { if (e.hasCoroutine) { yield return(coroutine.StartCoroutine(e.CoroutineCompute(content, coroutine))); } else { value = e.ComputeValue(content); if (value.m_breakBlock != 0) { break; } } } } content.DepthRemove(); #if CQUARK_DEBUG content.OutStack(this); #endif yield break; }
public CQ_Content.Value ComputeValue(CQ_Content content) { content.InStack(this); var parent = listParam[0].ComputeValue(content); if (parent == null) { throw new Exception("调用空对象的方法:" + listParam[0].ToString() + ":" + ToString()); } ICQ_TypeFunction typefunction = content.environment.GetType(parent.type).function; if (parent.type is object) { SInstance s = parent.value as SInstance; if (s != null) { typefunction = s.type; } } //var type = content.environment.GetType(parent.type); var value = typefunction.MemberValueGet(content, parent.value, membername); content.OutStack(this); return(value); //做数学计算 //从上下文取值 //_value = null; //return null; }
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 IEnumerator CoroutineCompute(CQ_Content content, ICoroutine coroutine) { #if CQUARK_DEBUG content.InStack(this); #endif content.DepthAdd(); CQ_Value value = null; foreach (ICQ_Expression i in _expressions) { ICQ_Expression e = i as ICQ_Expression; if (e != null) { if (e.hasCoroutine) { yield return(coroutine.StartNewCoroutine(e.CoroutineCompute(content, coroutine))); } else { value = e.ComputeValue(content); if (value != null && value.breakBlock != 0) { break; } } } } content.DepthRemove(); #if CQUARK_DEBUG content.OutStack(this); #endif yield break; }
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.GetValue(); //if((Type)value_type == typeof(Type_Var.var)) { // if(!v.TypeIsEmpty) // value_type = v.typeBridge; //} //else if(v.typeBridge != value_type) { // val = v.ConvertTo(value_type); //} content.DefineAndSet(value_name, value_type, v); } else { content.Define(value_name, value_type); } #if CQUARK_DEBUG content.OutStack(this); #endif return(CQ_Value.Null); }