public bool MemberValueSet(CQ_Content content, object object_this, string valuename, object value) { CQClassInstance sin = object_this as CQClassInstance; if (sin.member.ContainsKey(valuename)) { if (value != null && value.GetType() != (Type)this.members[valuename].type.typeBridge) { if (value is CQClassInstance) { if ((value as CQClassInstance).type != (Class_CQuark)this.members[valuename].type.typeBridge) { value = CQuark.AppDomain.GetType((value as CQClassInstance).type).ConvertTo(value, this.members[valuename].type.typeBridge); } } else if (value is DeleEvent) { } else { value = CQuark.AppDomain.ConvertTo(value, this.members[valuename].type.typeBridge); } } sin.member[valuename].value = value; return(true); } throw new NotImplementedException(); }
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 MemberValueGet(CQ_Content content, object object_this, string valuename) { CQClassInstance sin = object_this as CQClassInstance; CQ_Value temp = null; if (sin.member.TryGetValue(valuename, out temp)) { CQ_Value v = new CQ_Value(); v.type = temp.type; v.value = temp.value; return(v); } throw new NotImplementedException(); }
protected override void Initialize() { switch (m_codeType) { case ECodeType.FileName: break; case ECodeType.TextAsset: AppDomain.BuildFile(m_className, m_ta.text); break; case ECodeType.Text: AppDomain.BuildFile(m_className, m_codeText); break; } type = CQuark.AppDomain.GetTypeByKeywordQuiet(m_className); if (type == null) { Debug.LogError("Type:" + m_className + "不存在与脚本项目中"); return; } cclass = type._class as Class_CQuark; content = new CQ_Content(); //TODO 最好在编译的时候就做,不要在实例化的时候做 RegisterMember("gameObject", typeof(GameObject)); RegisterMember("transform", typeof(Transform)); inst = type._class.New(content, null).value as CQuark.CQClassInstance; SetMember("gameObject", typeof(GameObject), this.gameObject); SetMember("transform", typeof(Transform), this.transform); if (cclass.functions.ContainsKey("Update")) { m_update = cclass.functions["Update"].expr_runtime; } if (cclass.functions.ContainsKey("FixedUpdate")) { m_fixedpdate = cclass.functions["FixedUpdate"].expr_runtime; } _updateContent = new CQ_Content(); _updateContent.CallType = cclass; _updateContent.CallThis = inst; }
public DeleFunction(Class_CQuark stype, CQClassInstance _this, string function) { this.calltype = stype; this.callthis = _this; this.function = function; }