Ejemplo n.º 1
0
        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;
        }
Ejemplo n.º 2
0
 public IEnumerator Expr_Coroutine(ICQ_Expression expr, CQ_Content content, ICoroutine coroutine)
 {
     if (content == null)
     {
         content = CreateContent();
     }
     yield return(coroutine.StartNewCoroutine(expr.CoroutineCompute(content, coroutine)));
 }
Ejemplo n.º 3
0
        public IEnumerator CoroutineCompute(CQ_Content content, ICoroutine coroutine)
        {
            content.InStack(this);
            ICQ_Expression expr_if = listParam[0];
            bool           bif     = (bool)expr_if.ComputeValue(content).value;
            //if (expr_init != null) expr_init.ComputeValue(content);
            ICQ_Expression expr_go1 = listParam[1];
            ICQ_Expression expr_go2 = null;

            if (listParam.Count > 2)
            {
                expr_go2 = listParam[2];
            }
//			CQ_Content.Value value = null;
            if (bif && expr_go1 != null)
            {
                if (expr_go1 is CQ_Expression_Block)
                {
                    if (expr_go1.hasCoroutine)
                    {
                        yield return(coroutine.StartNewCoroutine(expr_go1.CoroutineCompute(content, coroutine)));
                    }
                    else
                    {
                        expr_go1.ComputeValue(content);
                    }
                }
                else
                {
                    content.DepthAdd();
                    if (expr_go1.hasCoroutine)
                    {
                        yield return(coroutine.StartNewCoroutine(expr_go1.CoroutineCompute(content, coroutine)));
                    }
                    else
                    {
                        expr_go1.ComputeValue(content);
                    }
                    content.DepthRemove();
                }
            }
            else if (!bif && expr_go2 != null)
            {
                if (expr_go2 is CQ_Expression_Block)
                {
                    if (expr_go2.hasCoroutine)
                    {
                        yield return(coroutine.StartNewCoroutine(expr_go2.CoroutineCompute(content, coroutine)));
                    }
                    else
                    {
                        expr_go2.ComputeValue(content);
                    }
                }
                else
                {
                    content.DepthAdd();
                    if (expr_go2.hasCoroutine)
                    {
                        yield return(coroutine.StartNewCoroutine(expr_go2.CoroutineCompute(content, coroutine)));
                    }
                    else
                    {
                        expr_go2.ComputeValue(content);
                    }
                    content.DepthRemove();
                }
            }

            //while((bool)expr_continue.value);

            //for 逻辑
            //做数学计算
            //从上下文取值
            //_value = null;
            content.OutStack(this);
        }
Ejemplo n.º 4
0
        public IEnumerator CoroutineCompute(CQ_Content content, UnityEngine.MonoBehaviour coroutine)
        {
#if CQUARK_DEBUG
            content.InStack(this);
#endif
            content.DepthAdd();
            CQ_Expression_Define define = _expressions[0] as CQ_Expression_Define;
            define.ComputeValue(content);

            System.Collections.IEnumerable emu = _expressions[1].ComputeValue(content).GetObject() as System.Collections.IEnumerable;

            ICQ_Expression expr_block = _expressions[2] as ICQ_Expression;

            var it = emu.GetEnumerator();

            while (it.MoveNext())
            {
                //content.Set(define.value_name, it.Current);
                CQ_Value val = new CQ_Value();
                val.SetObject(define.value_type, it.Current);
                content.Set(define.value_name, val);

                if (expr_block != null)
                {
                    if (expr_block is CQ_Expression_Block)
                    {
                        if (expr_block.hasCoroutine)
                        {
                            yield return(coroutine.StartCoroutine(expr_block.CoroutineCompute(content, coroutine)));
                        }
                        else
                        {
                            CQ_Value v = expr_block.ComputeValue(content);

                            if (v.m_breakBlock == BreakType.Break || v.m_breakBlock == BreakType.Return)
                            {
                                break;
                            }
                        }
                    }
                    else
                    {
                        content.DepthAdd();
                        bool bbreak = false;
                        if (expr_block.hasCoroutine)
                        {
                            yield return(coroutine.StartCoroutine(expr_block.CoroutineCompute(content, coroutine)));
                        }
                        else
                        {
                            CQ_Value v = expr_block.ComputeValue(content);

                            if (v.m_breakBlock == BreakType.Return || v.m_breakBlock == BreakType.Break)
                            {
                                bbreak = true;
                            }
                        }
                        content.DepthRemove();
                        if (bbreak)
                        {
                            break;
                        }
                    }
                }
            }

            content.DepthRemove();
#if CQUARK_DEBUG
            content.OutStack(this);
#endif
        }
Ejemplo n.º 5
0
        public IEnumerator CoroutineCompute(CQ_Content content, UnityEngine.MonoBehaviour coroutine)
        {
#if CQUARK_DEBUG
            content.InStack(this);
#endif
            ICQ_Expression expr_if = _expressions[0];
            bool           bif     = expr_if.ComputeValue(content).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];
            }
            //			CQ_Content.Value value = null;
            if (bif && expr_go1 != null)
            {
                if (expr_go1 is CQ_Expression_Block)
                {
                    if (expr_go1.hasCoroutine)
                    {
                        yield return(coroutine.StartCoroutine(expr_go1.CoroutineCompute(content, coroutine)));
                    }
                    else
                    {
                        expr_go1.ComputeValue(content);
                    }
                }
                else
                {
                    content.DepthAdd();
                    if (expr_go1.hasCoroutine)
                    {
                        yield return(coroutine.StartCoroutine(expr_go1.CoroutineCompute(content, coroutine)));
                    }
                    else
                    {
                        expr_go1.ComputeValue(content);
                    }
                    content.DepthRemove();
                }
            }
            else if (!bif && expr_go2 != null)
            {
                if (expr_go2 is CQ_Expression_Block)
                {
                    if (expr_go2.hasCoroutine)
                    {
                        yield return(coroutine.StartCoroutine(expr_go2.CoroutineCompute(content, coroutine)));
                    }
                    else
                    {
                        expr_go2.ComputeValue(content);
                    }
                }
                else
                {
                    content.DepthAdd();
                    if (expr_go2.hasCoroutine)
                    {
                        yield return(coroutine.StartCoroutine(expr_go2.CoroutineCompute(content, coroutine)));
                    }
                    else
                    {
                        expr_go2.ComputeValue(content);
                    }
                    content.DepthRemove();
                }
            }

#if CQUARK_DEBUG
            content.OutStack(this);
#endif
        }
Ejemplo n.º 6
0
        public IEnumerator CoroutineCompute(CQ_Content content, ICoroutine coroutine)
        {
#if CQUARK_DEBUG
            content.InStack(this);
#endif
            content.DepthAdd();
            ICQ_Expression expr_while = _expressions[0] as ICQ_Expression;
            ICQ_Expression expr_block = _expressions[1] as ICQ_Expression;
            //			CQ_Content.Value vrt = null;
            while ((bool)expr_while.ComputeValue(content).value)
            {
                if (expr_block != null)
                {
                    if (expr_block is CQ_Expression_Block)
                    {
                        if (expr_block.hasCoroutine)
                        {
                            yield return(coroutine.StartNewCoroutine(expr_block.CoroutineCompute(content, coroutine)));
                        }
                        else
                        {
                            var v = expr_block.ComputeValue(content);
                            if (v != null)
                            {
                                //								if (v.breakBlock > 2) vrt = v;
                                if (v.breakBlock > 1)
                                {
                                    break;
                                }
                            }
                        }
                    }
                    else
                    {
                        content.DepthAdd();
                        if (expr_block.hasCoroutine)
                        {
                            yield return(coroutine.StartNewCoroutine(expr_block.CoroutineCompute(content, coroutine)));
                        }
                        else
                        {
                            bool bbreak = false;
                            var  v      = expr_block.ComputeValue(content);
                            if (v != null)
                            {
                                //								if (v.breakBlock > 2) vrt = v;
                                if (v.breakBlock > 1)
                                {
                                    bbreak = true;
                                }
                            }
                            content.DepthRemove();
                            if (bbreak)
                            {
                                break;
                            }
                        }
                    }
                    //if (v.breakBlock == 1) continue;
                    //if (v.breakBlock == 2) break;
                    //if (v.breakBlock == 10) return v;
                }
            }
            content.DepthRemove();
#if CQUARK_DEBUG
            content.OutStack(this);
#endif
            //for 逻辑
            //做数学计算
            //从上下文取值
            //_value = null;
        }
Ejemplo n.º 7
0
        public IEnumerator CoroutineCompute(CQ_Content content, ICoroutine coroutine)
        {
            content.InStack(this);
            content.DepthAdd();
            ICQ_Expression expr_init = listParam[0] as ICQ_Expression;

            if (expr_init != null)
            {
                expr_init.ComputeValue(content);                               //expr1
            }
            ICQ_Expression expr_continue = listParam[1] as ICQ_Expression;
            ICQ_Expression expr_step     = listParam[2] as ICQ_Expression;

            ICQ_Expression expr_block = listParam[3] as ICQ_Expression;

//			CQ_Content.Value vrt = null;
            for (; ;)
            {
                if (expr_continue != null && !(bool)expr_continue.ComputeValue(content).value)
                {
                    break;                                                                                           //expr2
                }
                if (expr_block != null)
                {
                    if (expr_block is CQ_Expression_Block)
                    {
                        if (expr_block.hasCoroutine)
                        {
                            yield return(coroutine.StartNewCoroutine(expr_block.CoroutineCompute(content, coroutine)));
                        }
                        else
                        {
                            var v = expr_block.ComputeValue(content);
                            if (v != null)
                            {
//								if (v.breakBlock > 2) vrt = v;
                                if (v.breakBlock > 1)
                                {
                                    break;
                                }
                            }
                        }
                    }
                    else
                    {
                        content.DepthAdd();
                        bool bbreak = false;
                        if (expr_block.hasCoroutine)
                        {
                            yield return(coroutine.StartNewCoroutine(expr_block.CoroutineCompute(content, coroutine)));
                        }
                        else
                        {
                            var v = expr_block.ComputeValue(content);
                            if (v != null)
                            {
//								if (v.breakBlock > 2) vrt = v;
                                if (v.breakBlock > 1)
                                {
                                    bbreak = true;
                                }
                            }
                        }
                        content.DepthRemove();
                        if (bbreak)
                        {
                            break;
                        }
                    }
                    //if (v.breakBlock == 1) continue;
                    //if (v.breakBlock == 2) break;
                    //if (v.breakBlock == 10) return v;
                }

                if (expr_step != null)
                {
                    expr_step.ComputeValue(content);                    //expr3
                }
            }
            content.DepthRemove();
            content.OutStack(this);
            //for 逻辑
            //做数学计算
            //从上下文取值
            //_value = null;
        }
Ejemplo n.º 8
0
 public virtual IEnumerator CoroutineCall(ICQ_Expression expression, CQ_Content param, UnityEngine.MonoBehaviour coroutine)
 {
     yield return(coroutine.StartCoroutine(expression.CoroutineCompute(param, coroutine)));
 }
Ejemplo n.º 9
0
        public IEnumerator CoroutineCompute(CQ_Content content, ICoroutine coroutine)
        {
            content.InStack(this);
            content.DepthAdd();
            CQ_Expression_Define define = listParam[0] as CQ_Expression_Define;

            if (define == null)
            {
            }
            define.ComputeValue(content);

            System.Collections.IEnumerable emu = listParam[1].ComputeValue(content).value as System.Collections.IEnumerable;

            ICQ_Expression expr_block = listParam[2] as ICQ_Expression;

            var it = emu.GetEnumerator();

//			CQ_Content.Value vrt = null;
            while (it.MoveNext())
            {
                content.Set(define.value_name, it.Current);
                if (expr_block != null)
                {
                    if (expr_block is CQ_Expression_Block)
                    {
                        if (expr_block.hasCoroutine)
                        {
                            yield return(coroutine.StartNewCoroutine(expr_block.CoroutineCompute(content, coroutine)));
                        }
                        else
                        {
                            var v = expr_block.ComputeValue(content);
                            if (v != null)
                            {
//								if (v.breakBlock > 2) vrt = v;
                                if (v.breakBlock > 1)
                                {
                                    break;
                                }
                            }
                        }
                    }
                    else
                    {
                        content.DepthAdd();
                        bool bbreak = false;
                        if (expr_block.hasCoroutine)
                        {
                            yield return(coroutine.StartNewCoroutine(expr_block.CoroutineCompute(content, coroutine)));
                        }
                        else
                        {
                            var v = expr_block.ComputeValue(content);
                            if (v != null)
                            {
//								if (v.breakBlock > 2) vrt = v;
                                if (v.breakBlock > 1)
                                {
                                    bbreak = true;
                                }
                            }
                        }
                        content.DepthRemove();
                        if (bbreak)
                        {
                            break;
                        }
                    }
                }
            }
            //ICQ_Expression expr_continue = listParam[1] as ICQ_Expression;
            //ICQ_Expression expr_step = listParam[2] as ICQ_Expression;

            //ICQ_Expression expr_block = listParam[3] as ICQ_Expression;

            //for (;(bool)expr_continue.ComputeValue(content).value; expr_step.ComputeValue(content))
            //{
            //    if(expr_block!=null)
            //    {
            //        var v = expr_block.ComputeValue(content);
            //        if (v != null && v.breakBlock > 1) break; ;
            //        //if (v.breakBlock == 1) continue;
            //        //if (v.breakBlock == 2) break;
            //        //if (v.breakBlock == 10) return v;
            //    }
            //}
            content.DepthRemove();
            content.OutStack(this);
            //for 逻辑
            //做数学计算
            //从上下文取值
            //_value = null;
        }
Ejemplo n.º 10
0
        public IEnumerator CoroutineCompute(CQ_Content content, UnityEngine.MonoBehaviour coroutine)
        {
#if CQUARK_DEBUG
            content.InStack(this);
#endif
            content.DepthAdd();
            ICQ_Expression expr_init = _expressions[0] as ICQ_Expression;
            if (expr_init != null)
            {
                expr_init.ComputeValue(content);                  //expr1
            }
            ICQ_Expression expr_continue = _expressions[1] as ICQ_Expression;
            ICQ_Expression expr_step     = _expressions[2] as ICQ_Expression;

            ICQ_Expression expr_block = _expressions[3] as ICQ_Expression;

            for (; ;)
            {
                if (expr_continue != null && !expr_continue.ComputeValue(content).GetBool())               //expr2
                {
                    break;
                }

                if (expr_block != null)
                {
                    if (expr_block is CQ_Expression_Block)
                    {
                        if (expr_block.hasCoroutine)
                        {
                            yield return(coroutine.StartCoroutine(expr_block.CoroutineCompute(content, coroutine)));
                        }
                        else
                        {
                            CQ_Value v = expr_block.ComputeValue(content);

                            if (v.m_breakBlock == BreakType.Break || v.m_breakBlock == BreakType.Return)
                            {
                                break;
                            }
                        }
                    }
                    else
                    {
                        content.DepthAdd();
                        bool bbreak = false;
                        if (expr_block.hasCoroutine)
                        {
                            yield return(coroutine.StartCoroutine(expr_block.CoroutineCompute(content, coroutine)));
                        }
                        else
                        {
                            CQ_Value v = expr_block.ComputeValue(content);

                            if (v.m_breakBlock == BreakType.Return || v.m_breakBlock == BreakType.Break)
                            {
                                bbreak = true;
                            }
                        }
                        content.DepthRemove();
                        if (bbreak)
                        {
                            break;
                        }
                    }
                    //if (v.breakBlock == 1) continue;
                    //if (v.breakBlock == 2) break;
                    //if (v.breakBlock == 10) return v;
                }

                if (expr_step != null)
                {
                    expr_step.ComputeValue(content);//expr3
                }
            }
            content.DepthRemove();
#if CQUARK_DEBUG
            content.OutStack(this);
#endif
            //for 逻辑
            //做数学计算
            //从上下文取值
            //_value = null;
        }
Ejemplo n.º 11
0
        public IEnumerator CoroutineCompute(CQ_Content content, UnityEngine.MonoBehaviour coroutine)
        {
#if CQUARK_DEBUG
            content.InStack(this);
#endif
            content.DepthAdd();
            ICQ_Expression expr_while = _expressions[1] as ICQ_Expression;
            ICQ_Expression expr_block = _expressions[0] as ICQ_Expression;

            //			CQ_Content.Value vrt = null;
            do
            {
                if (expr_block != null)
                {
                    if (expr_block is CQ_Expression_Block)
                    {
                        if (expr_block.hasCoroutine)
                        {
                            yield return(coroutine.StartCoroutine(expr_block.CoroutineCompute(content, coroutine)));
                        }
                        else
                        {
                            var v = expr_block.ComputeValue(content);
                            if (v != CQ_Value.Null)
                            {
                                //								if (v.breakBlock > 2) vrt = v;
                                if (v.m_breakBlock == BreakType.Break || v.m_breakBlock == BreakType.Return)
                                {
                                    break;
                                }
                            }
                        }
                    }
                    else
                    {
                        content.DepthAdd();
                        bool bbreak = false;
                        if (expr_block.hasCoroutine)
                        {
                            yield return(coroutine.StartCoroutine(expr_block.CoroutineCompute(content, coroutine)));
                        }
                        else
                        {
                            var v = expr_block.ComputeValue(content);
                            if (v != CQ_Value.Null)
                            {
                                //								if (v.breakBlock > 2) vrt = v;
                                if (v.m_breakBlock == BreakType.Return || v.m_breakBlock == BreakType.Break)
                                {
                                    bbreak = true;
                                }
                            }
                            content.DepthRemove();
                            if (bbreak)
                            {
                                break;
                            }
                        }
                    }
                    //if (v.breakBlock == 1) continue;
                    //if (v.breakBlock == 2) break;
                    //if (v.breakBlock == 10) return v;
                }
            }           while(expr_while.ComputeValue(content).GetBool());
            //while ((bool)expr_while.ComputeValue(content).value);
            content.DepthRemove();
#if CQUARK_DEBUG
            content.OutStack(this);
#endif
            ;
            //for 逻辑
            //做数学计算
            //从上下文取值
            //_value = null;
        }
        public IEnumerator CoroutineCompute(CQ_Content content, ICoroutine coroutine)
        {
#if CQUARK_DEBUG
            content.InStack(this);
#endif
            content.DepthAdd();
            CQ_Expression_Define define = _expressions[0] as CQ_Expression_Define;
            if (define == null)
            {
            }
            define.ComputeValue(content);

            System.Collections.IEnumerable emu = _expressions[1].ComputeValue(content).value as System.Collections.IEnumerable;

            ICQ_Expression expr_block = _expressions[2] as ICQ_Expression;

            var it = emu.GetEnumerator();
            //			CQ_Content.Value vrt = null;
            while (it.MoveNext())
            {
                content.Set(define.value_name, it.Current);
                if (expr_block != null)
                {
                    if (expr_block is CQ_Expression_Block)
                    {
                        if (expr_block.hasCoroutine)
                        {
                            yield return(coroutine.StartNewCoroutine(expr_block.CoroutineCompute(content, coroutine)));
                        }
                        else
                        {
                            var v = expr_block.ComputeValue(content);
                            if (v != null)
                            {
                                //								if (v.breakBlock > 2) vrt = v;
                                if (v.breakBlock > 1)
                                {
                                    break;
                                }
                            }
                        }
                    }
                    else
                    {
                        content.DepthAdd();
                        bool bbreak = false;
                        if (expr_block.hasCoroutine)
                        {
                            yield return(coroutine.StartNewCoroutine(expr_block.CoroutineCompute(content, coroutine)));
                        }
                        else
                        {
                            var v = expr_block.ComputeValue(content);
                            if (v != null)
                            {
                                //								if (v.breakBlock > 2) vrt = v;
                                if (v.breakBlock > 1)
                                {
                                    bbreak = true;
                                }
                            }
                        }
                        content.DepthRemove();
                        if (bbreak)
                        {
                            break;
                        }
                    }
                }
            }

            content.DepthRemove();
#if CQUARK_DEBUG
            content.OutStack(this);
#endif
        }