public static int _bind_nextFrame(Lua.lua_State L)
    {
        if (Lua.lua_gettop(L) != 1 ||
            Luna.get_uniqueid(L, 1) != 29625181)
        {
            Luna.printStack(L); Lua.luaL_error(L, "luna typecheck failed:nextFrame(LWF.Movie self)");
        }

        LWF.Movie self = Luna_LWF_Movie.check(L, 1);
        try {
            self.NextFrame();
        } catch (Exception e) { Lua.luaL_error(L, new Lua.CharPtr(e.ToString())); }
        return(0);
    }
Exemple #2
0
        public void PlayAnimation(
            int animationId, Movie movie, Button button = null)
        {
            int i = 0;

            int[] animations = m_data.animations[animationId];
            Movie target     = movie;

            for (;;)
            {
                switch ((Animation)animations[i++])
                {
                case Animation.END:
                    return;

                case Animation.PLAY:
                    target.Play();
                    break;

                case Animation.STOP:
                    target.Stop();
                    break;

                case Animation.NEXTFRAME:
                    target.NextFrame();
                    break;

                case Animation.PREVFRAME:
                    target.PrevFrame();
                    break;

                case Animation.GOTOFRAME:
                    target.GotoFrameInternal(animations[i++]);
                    break;

                case Animation.GOTOLABEL:
                    target.GotoFrame(SearchFrame(target, animations[i++]));
                    break;

                case Animation.SETTARGET:
                {
                    target = movie;

                    int count = animations[i++];
                    if (count == 0)
                    {
                        break;
                    }

                    for (int j = 0; j < count; ++j)
                    {
                        int instId = animations[i++];

                        switch ((Animation)instId)
                        {
                        case Animation.INSTANCE_TARGET_ROOT:
                            target = m_rootMovie;
                            break;

                        case Animation.INSTANCE_TARGET_PARENT:
                            target = target.parent;
                            if (target == null)
                            {
                                target = m_rootMovie;
                            }
                            break;

                        default:
                        {
                            target = target.SearchMovieInstanceByInstanceId(
                                instId, false);
                            if (target == null)
                            {
                                target = movie;
                            }
                            break;
                        }
                        }
                    }
                }
                break;

                case Animation.EVENT:
                {
                    int eventId = animations[i++];
#if LWF_USE_LUA
                    CallEventFunctionLua(eventId, movie, button);
#endif
                    if (m_eventHandlers[eventId] != null)
                    {
                        var handlers = new EventHandlerDictionary(
                            m_eventHandlers[eventId]);
                        foreach (var h in handlers)
                        {
                            h.Value(movie, button);
                        }
                    }
                }
                break;

                case Animation.CALL:
#if LWF_USE_LUA
                {
                    int stringId = animations[i++];
                    if (stringId < 0 || stringId >= data.strings.Length)
                    {
                        break;
                    }
                    CallFunctionLua(data.strings[stringId], target);
                }
#else
                    i++;
#endif
                    break;
                }
            }
        }