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 bool MemberValueSet(CQ_Content content, object object_this, string valuename, object value) { SInstance sin = object_this as SInstance; if (sin.member.ContainsKey(valuename)) { if (value != null && value.GetType() != (Type)this.members[valuename].type.type) { if (value is SInstance) { if ((value as SInstance).type != (SType)this.members[valuename].type.type) { value = content.environment.GetType((value as SInstance).type).ConvertTo(content, value, this.members[valuename].type.type); } } else if (value is DeleEvent) { } else { value = content.environment.GetType(value.GetType()).ConvertTo(content, value, this.members[valuename].type.type); } } sin.member[valuename].value = value; return(true); } throw new NotImplementedException(); }
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); }
CQuark.CQ_Content content; //操作上下文 public ScriptInstanceHelper(string scriptTypeName) { type = Script.Instance.env.GetTypeByKeywordQuiet(scriptTypeName); if (type == null) { Debug.LogError("Type:" + scriptTypeName + "不存在与脚本项目中"); return; } content = Script.Instance.env.CreateContent(); inst = type.function.New(content, null).value as CQuark.SInstance; content.CallType = inst.type; content.CallThis = inst; }
public CQ_Content.Value MemberValueGet(CQ_Content environment, object object_this, string valuename) { SInstance sin = object_this as SInstance; if (sin.member.ContainsKey(valuename)) { CQ_Content.Value v = new CQ_Content.Value(); v.type = sin.member[valuename].type; v.value = sin.member[valuename].value; return(v); } throw new NotImplementedException(); }
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 typefunction = content.environment.GetType(parent.type).function; if (parent.type is object) { SInstance s = parent.value as SInstance; if (s != null) { typefunction = s.type; } } List <CQ_Content.Value> _params = new List <CQ_Content.Value>(); for (int i = 1; i < listParam.Count; i++) { _params.Add(listParam[i].ComputeValue(content)); } CQ_Content.Value value = null; if (cache == null || cache.cachefail) { cache = new MethodCache(); value = typefunction.MemberCall(content, parent.value, functionName, _params, cache); } else { value = typefunction.MemberCallCache(content, parent.value, _params, cache); } content.OutStack(this); return(value); //做数学计算 //从上下文取值 //_value = null; //return null; }
public DeleFunction(SType stype, SInstance _this, string function) { this.calltype = stype; this.callthis = _this; this.function = function; }