CallFunctionLua() public method

public CallFunctionLua ( string function, Movie movie ) : void
function string
movie Movie
return void
Ejemplo n.º 1
0
        public Movie(LWF lwf, Movie parent, int objId, int instId, int matrixId = 0,
			int colorTransformId = 0, bool attached = false,
			MovieEventHandlers handler = null, string n = null)
            : base(lwf, parent,
			attached ? Type.ATTACHEDMOVIE : Type.MOVIE, objId, instId)
        {
            m_data = lwf.data.movies[objId];
            m_matrixId = matrixId;
            m_colorTransformId = colorTransformId;
            m_totalFrames = m_data.frames;

            if (!String.IsNullOrEmpty(n))
            m_name = n;
            m_instanceHead = null;
            m_instanceTail = null;
            m_currentFrameInternal = -1;
            m_execedFrame = -1;
            m_animationPlayedFrame = -1;
            m_lastControlOffset = -1;
            m_lastControls = -1;
            m_lastHasButton = false;
            m_lastControlAnimationOffset = -1;
            m_skipped = false;
            m_postLoaded = false;
            m_active = true;
            m_visible = true;
            m_playing = true;
            m_jumped = false;
            m_overriding = false;
            m_attachMovieExeced = false;
            m_attachMoviePostExeced = false;
            m_movieExecCount = -1;
            m_postExecCount = -1;
            m_blendMode = (int)Constant.BLEND_MODE_NORMAL;
            m_requestedCalculateBounds = false;
            m_calculateBoundsCallback = null;

            m_property = new Property(lwf);

            m_matrix0 = new Matrix();
            m_matrix1 = new Matrix();
            m_matrixForAttachedLWFs = new Matrix();
            m_colorTransform0 = new ColorTransform();
            m_colorTransform1 = new ColorTransform();
            m_colorTransformForAttachedLWFs = new ColorTransform();

            m_displayList = new Object[m_data.depths];

            m_eventHandlers = new EventHandlers();
            m_handler = new MovieEventHandlers();
            m_handler.Add(lwf.GetMovieEventHandlers(this));
            m_handler.Add(handler);

            #if LWF_USE_LUA
            m_isRoot = objId == lwf.data.header.rootMovieId;
            if (m_isRoot) {
            if (parent == null)
                lwf.CallFunctionLua("Init", this);
            lwf.GetFunctionsLua(objId, out m_rootLoadFunc,
                out m_rootPostLoadFunc, out m_rootUnloadFunc,
                    out m_rootEnterFrameFunc, true);
            }
            lwf.GetFunctionsLua(objId, out m_loadFunc, out m_postLoadFunc,
            out m_unloadFunc, out m_enterFrameFunc, false);

            if (m_isRoot && !String.IsNullOrEmpty(m_rootLoadFunc))
            lwf.CallFunctionLua(m_rootLoadFunc, this);
            if (m_loadFunc != String.Empty)
            lwf.CallFunctionLua(m_loadFunc, this);
            #endif

            PlayAnimation(ClipEvent.LOAD);
            if (!m_handler.Empty())
            m_handler.Call(EventType.LOAD, this);

            lwf.ExecMovieCommand();
        }
Ejemplo n.º 2
0
        public Movie(LWF lwf, Movie parent, int objId, int instId, int matrixId = 0,
                     int colorTransformId       = 0, bool attached = false,
                     MovieEventHandlers handler = null, string n   = null)
            : base(lwf, parent,
                   attached ? Type.ATTACHEDMOVIE : Type.MOVIE, objId, instId)
        {
            m_data             = lwf.data.movies[objId];
            m_matrixId         = matrixId;
            m_colorTransformId = colorTransformId;
            m_totalFrames      = m_data.frames;

            if (!String.IsNullOrEmpty(n))
            {
                m_name = n;
            }
            m_instanceHead               = null;
            m_instanceTail               = null;
            m_currentFrameInternal       = -1;
            m_execedFrame                = -1;
            m_animationPlayedFrame       = -1;
            m_lastControlOffset          = -1;
            m_lastControls               = -1;
            m_lastHasButton              = false;
            m_lastControlAnimationOffset = -1;
            m_skipped               = false;
            m_postLoaded            = false;
            m_active                = true;
            m_visible               = true;
            m_playing               = true;
            m_jumped                = false;
            m_overriding            = false;
            m_attachMovieExeced     = false;
            m_attachMoviePostExeced = false;
            m_movieExecCount        = -1;
            m_postExecCount         = -1;
            m_blendMode             = (int)Constant.BLEND_MODE_NORMAL;

            m_property = new Property(lwf);

            m_matrix0         = new Matrix();
            m_matrix1         = new Matrix();
            m_colorTransform0 = new ColorTransform();
            m_colorTransform1 = new ColorTransform();

            m_displayList = new Object[m_data.depths];

#if LWF_USE_LUA
            m_isRoot = objId == lwf.data.header.rootMovieId;
            if (m_isRoot)
            {
                lwf.GetFunctionsLua(objId, out m_rootLoadFunc, out m_rootPostLoadFunc,
                                    out m_rootUnloadFunc, out m_rootEnterFrameFunc, true);
            }
            lwf.GetFunctionsLua(objId,
                                out m_loadFunc, out m_postLoadFunc, out m_unloadFunc, out m_enterFrameFunc, false);

            if (m_isRoot && !String.IsNullOrEmpty(m_rootLoadFunc))
            {
                lwf.CallFunctionLua(m_rootLoadFunc, this);
            }
            if (m_loadFunc != String.Empty)
            {
                lwf.CallFunctionLua(m_loadFunc, this);
            }
#endif
            PlayAnimation(ClipEvent.LOAD);

            m_eventHandlers = new EventHandlerDictionary();
            m_handler       = new MovieEventHandlers();
            m_handler.Add(lwf.GetMovieEventHandlers(this));
            m_handler.Add(handler);
            if (!m_handler.Empty())
            {
                m_handler.Call(EventType.LOAD, this);
            }

            lwf.ExecMovieCommand();
        }