Пример #1
0
        // Token: 0x060001BC RID: 444 RVA: 0x00009544 File Offset: 0x00007744
        internal static IEnumerator LuaCoroutine(LuaFunction func)
        {
            LuaThreadWrapper thread = new LuaThreadWrapper(func);
            object           obj;

            while (thread.Resume(out obj))
            {
                yield return(obj);
            }
            yield break;
            yield break;
        }
Пример #2
0
        public static IEnumerator LuaCoroutine(LuaFunction func)
        {
            LuaThreadWrapper thread = new LuaThreadWrapper(func);

            while (true)
            {
                object obj;
                if (!thread.Resume(out obj))
                {
                    yield break;
                }

                yield return(obj);
            }
        }
Пример #3
0
        internal static IEnumerator LuaCoroutine(LuaFunction func)
        {
            var thread = new LuaThreadWrapper(func);

            object[] return_values = null;
            while (true)
            {
                object yield_from_lua;
                if (!thread.Resume(out yield_from_lua, return_values))
                {
                    return_values = null;
                    break;
                }

                var enumerator = yield_from_lua as IEnumerator;
                if (enumerator != null)
                {
                    // 如果是迭代器,则尝试自己迭代,并检测 YieldBreak 传值指令
                    while (enumerator.MoveNext())
                    {
                        var current = enumerator.Current;
                        var obj_t   = current as YieldBreak;
                        if (obj_t != null)
                        {
                            return_values = obj_t.values;
                            break; // 丢弃当前迭代器
                        }
                        else
                        {
                            return_values = null;
                            yield return(current);
                        }
                    }
                }
                else
                {
                    yield return(yield_from_lua);
                }
            }
        }