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_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_Value ComputeValue(CQ_Content content) { #if CQUARK_DEBUG content.InStack(this); #endif List <object> list = new List <object>(); int count = _expressions[0] == null ? (_expressions.Count - 1) : (int)_expressions[0].ComputeValue(content).value; if (count == 0) { throw new Exception("不能创建0长度数组"); } CQ_Value vcount = new CQ_Value(); vcount.type = typeof(int); vcount.value = count; for (int i = 1; i < _expressions.Count; i++) { //if (_expressions[i] != null) { list.Add(_expressions[i].ComputeValue(content).value); } } List <CQ_Value> param = new List <CQ_Value>(); param.Add(vcount); CQ_Value outvalue = null; //这几行是为了快速获取Unity的静态变量,而不需要反射 if (!Wrap.New(type.typeBridge.type, param, out outvalue)) { outvalue = type._class.New(content, param); } for (int i = 0; i < list.Count; i++) { type._class.IndexSet(content, outvalue.value, i, list[i]); } #if CQUARK_DEBUG content.OutStack(this); #endif return(outvalue); }
public CQ_Value ComputeValue(CQ_Content content) { #if CQUARK_DEBUG content.InStack(this); #endif object[] list = new object[_expressions.Count - 1]; int count = _expressions[0] == null ? (_expressions.Count - 1) : (int)_expressions[0].ComputeValue(content).GetNumber(); // if(count == 0) // throw new Exception("不能创建0长度数组"); CQ_Value vcount = new CQ_Value(); vcount.SetNumber(typeof(int), count); for (int i = 0; i < _expressions.Count - 1; i++) { list[i] = (_expressions[i + 1].ComputeValue(content).GetObject()); } CQ_Value[] param = new CQ_Value[] { vcount }; CQ_Value outvalue = CQ_Value.Null; //这几行是为了快速获取Unity的静态变量,而不需要反射 if (!Wrap.New(type.typeBridge.type, param, out outvalue)) { outvalue = type._class.New(content, param); } object obj = outvalue.GetObject(); for (int i = 0; i < list.Length; i++) { type._class.IndexSet(content, obj, i, list[i]); } #if CQUARK_DEBUG content.OutStack(this); #endif return(outvalue); }