Beispiel #1
0
    public static AppMain.AMS_AME_RUNTIME _amCreateRuntimeEmitter(
        AppMain.AMS_AME_CREATE_PARAM param)
    {
        AppMain.AMS_AME_RUNTIME runtime = AppMain._amAllocRuntime();
        runtime.ecb              = param.ecb;
        runtime.node             = param.node;
        runtime.child_head.next  = runtime.child_tail;
        runtime.child_tail.prev  = runtime.child_head;
        runtime.work_head.next   = runtime.work_tail;
        runtime.work_tail.prev   = runtime.work_head;
        runtime.active_head.next = runtime.active_tail;
        runtime.active_tail.prev = runtime.active_head;
        AppMain._amAddEntry(param.ecb, runtime);
        runtime.work = AppMain._amAllocRuntimeWork();
        param.work   = runtime.work;
        int num = AppMain._am_emitter_func[(AppMain.AMD_AME_NODE_TYPE(param.node) & (int)byte.MaxValue) << 2]((object)param);

        for (AppMain.AMS_AME_NODE node = param.node.child; node != null; node = node.sibling)
        {
            if (!AppMain.AMD_AME_IS_FIELD(node))
            {
                AppMain.AMS_AME_RUNTIME runtimeGroup = AppMain._amCreateRuntimeGroup(param.ecb, node);
                AppMain._amConnectLinkToTail(runtime.child_tail, (AppMain.AMS_AME_LIST)runtimeGroup);
                ++runtime.child_num;
            }
        }
        return(runtime);
    }
Beispiel #2
0
    public static void amEffectUpdate(AppMain.AMS_AME_ECB ecb)
    {
        if (ecb.entry_num <= 0)
        {
            return;
        }
        if (ecb.skip_update != 0)
        {
            ecb.skip_update = 0;
        }
        for (AppMain.AMS_AME_ENTRY amsAmeEntry = ecb.entry_head; amsAmeEntry != null; amsAmeEntry = (AppMain.AMS_AME_ENTRY)amsAmeEntry.next)
        {
            AppMain.AMS_AME_RUNTIME runtime = amsAmeEntry.runtime;
            AppMain.AMS_AME_NODE    node1   = runtime.node;
            int num1 = AppMain.AMD_AME_NODE_TYPE(node1);
            if ((runtime.state & 16384) != 0 && (int)runtime.work_num + (int)runtime.active_num == 0)
            {
                if (runtime.spawn_runtime != null)
                {
                    runtime.spawn_runtime.state |= 16384;
                }
                runtime.state |= 32768;
            }
            else
            {
                switch (num1 & 65280)
                {
                case 256:
                    if (runtime.work != null)
                    {
                        AppMain.AmeDelegateFunc ameDelegateFunc = AppMain._am_emitter_func[((num1 & (int)byte.MaxValue) << 2) + 1];
                        if (runtime.work != null)
                        {
                            if (ameDelegateFunc((object)runtime) != 0)
                            {
                                runtime.state |= 32768;
                                AppMain.AMS_AME_LIST next = runtime.child_head.next;
                                for (AppMain.AMS_AME_LIST childTail = runtime.child_tail; next != childTail; next = next.next)
                                {
                                    ((AppMain.AMS_AME_RUNTIME)next).state |= 16384;
                                }
                                if (runtime.parent_runtime != null)
                                {
                                    AppMain.amEffectDisconnectLink((AppMain.AMS_AME_LIST)runtime);
                                    --runtime.parent_runtime.work_num;
                                    continue;
                                }
                                continue;
                            }
                            for (AppMain.AMS_AME_NODE node2 = node1.child; node2 != null; node2 = node2.sibling)
                            {
                                if (AppMain.AMD_AME_IS_FIELD(node2))
                                {
                                    AppMain._am_field_func[AppMain.AMD_AME_NODE_TYPE(node2) & (int)byte.MaxValue](runtime.ecb, node2, runtime.work);
                                }
                            }
                            continue;
                        }
                        continue;
                    }
                    continue;

                case 512:
                    if (runtime.work_num != (short)0)
                    {
                        AppMain.AMS_AME_RUNTIME_WORK next     = (AppMain.AMS_AME_RUNTIME_WORK)runtime.work_head.next;
                        AppMain.AMS_AME_RUNTIME_WORK workTail = (AppMain.AMS_AME_RUNTIME_WORK)runtime.work_tail;
                        while (next != workTail)
                        {
                            AppMain.AMS_AME_RUNTIME_WORK amsAmeRuntimeWork = next;
                            next = (AppMain.AMS_AME_RUNTIME_WORK)next.next;
                            amsAmeRuntimeWork.time += AppMain._am_unit_frame;
                            if ((double)amsAmeRuntimeWork.time > 0.0)
                            {
                                amsAmeRuntimeWork.time -= AppMain._am_unit_frame;
                                AppMain.amEffectDisconnectLink((AppMain.AMS_AME_LIST)amsAmeRuntimeWork);
                                AppMain._amConnectLinkToTail(runtime.active_tail, (AppMain.AMS_AME_LIST)amsAmeRuntimeWork);
                                --runtime.work_num;
                                ++runtime.active_num;
                            }
                        }
                    }
                    int num2 = AppMain._am_particle_func[((num1 & (int)byte.MaxValue) << 2) + 1]((object)runtime);
                    AppMain.AMS_AME_RUNTIME_WORK next1      = (AppMain.AMS_AME_RUNTIME_WORK)runtime.active_head.next;
                    AppMain.AMS_AME_LIST         activeTail = runtime.active_tail;
                    AppMain.AMS_AME_RUNTIME_WORK work;
                    for (AppMain.AMS_AME_LIST next2 = runtime.active_head.next; next2 != activeTail; next2 = work.next)
                    {
                        work = (AppMain.AMS_AME_RUNTIME_WORK)next2;
                        for (AppMain.AMS_AME_NODE node2 = node1.child; node2 != null; node2 = node2.sibling)
                        {
                            if (AppMain.AMD_AME_IS_FIELD(node2))
                            {
                                AppMain._am_field_func[AppMain.AMD_AME_NODE_TYPE(node2) & (int)byte.MaxValue](runtime.ecb, node2, work);
                            }
                        }
                    }
                    continue;

                default:
                    continue;
                }
            }
        }
        for (AppMain.AMS_AME_ENTRY entry = ecb.entry_head; entry != null; entry = (AppMain.AMS_AME_ENTRY)entry.next)
        {
            if ((entry.runtime.state & 32768) != 0)
            {
                AppMain._amFreeRuntime(entry.runtime);
                AppMain._amDelEntry(ecb, entry);
            }
        }
        if (ecb.entry_num != 0)
        {
            return;
        }
        AppMain.amEffectDelete(ecb);
    }