public CQ_Value ComputeValue(CQ_Content content) { #if CQUARK_DEBUG content.InStack(this); #endif ICQ_Expression expr_if = _expressions[0]; CQ_Value v = expr_if.ComputeValue(content); bool bif = v.GetBool(); //if (expr_init != null) expr_init.ComputeValue(content); ICQ_Expression expr_go1 = _expressions[1]; ICQ_Expression expr_go2 = null; if (_expressions.Count > 2) { expr_go2 = _expressions[2]; //else } CQ_Value value = CQ_Value.Null; if (bif && expr_go1 != null) { if (expr_go1 is CQ_Expression_Block) { value = expr_go1.ComputeValue(content); } else { content.DepthAdd(); value = expr_go1.ComputeValue(content); content.DepthRemove(); } } else if (!bif && expr_go2 != null) { if (expr_go2 is CQ_Expression_Block) { value = expr_go2.ComputeValue(content); } else { content.DepthAdd(); value = expr_go2.ComputeValue(content); 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 CQ_Value r = _expressions[0].ComputeValue(content); CQ_Value r2 = new CQ_Value(); r2.SetBool(!r.GetBool()); r2.m_breakBlock = r.m_breakBlock; #if CQUARK_DEBUG content.OutStack(this); #endif return(r2); }
/// <summary> /// 调用这个方法必须保证类型与obj匹配,比如m_type = float,存进来的万一是int,就取不出了,所以外面就必须做好转型 /// </summary> // public void SetValue (Object obj) { // if(m_type != null){ // SetValue(m_type, obj); // }else if(m_stype != null){ // SetValue(m_stype, obj); // }else{ // if(obj == null) // _obj = null; // else // throw new Exception("不允许在无类型的情况下赋值"); // } // } //保持原有的type,而使用别的CQ_Value的值(一般用于赋值) public void UsingValue(CQ_Value val) { if (NumberUtil.IsNumberType(val.m_type)) { double d = val.GetNumber(); SetNumber(val.m_type, d); } else if (val.m_type == typeof(bool)) { bool b = val.GetBool(); SetBool(b); } else if (val.IsDelegate || val.IsDeleEvent) { _obj = val._obj; } else { SetObject(val.typeBridge, val._obj); } }