示例#1
0
文件: lwf_movie.cs 项目: nask0/lwf
        public Movie SearchMovieInstance(int stringId, bool recursive = true)
        {
            if (stringId == -1)
            {
                return(null);
            }

            for (IObject instance = m_instanceHead; instance != null;
                 instance = instance.linkInstance)
            {
                if (instance.IsMovie() && m_lwf.GetInstanceNameStringId(
                        instance.instanceId) == stringId)
                {
                    return((Movie)instance);
                }
                else if (recursive && instance.IsMovie())
                {
                    Movie i = ((Movie)instance).SearchMovieInstance(
                        stringId, recursive);
                    if (i != null)
                    {
                        return(i);
                    }
                }
            }
            return(null);
        }
示例#2
0
        public LWF SearchAttachedLWF(string attachName, bool recursive = true)
        {
            LWF attachedLWF = GetAttachedLWF(attachName);

            if (attachedLWF != null)
            {
                return(attachedLWF);
            }

            if (!recursive)
            {
                return(null);
            }

            for (IObject instance = m_instanceHead; instance != null;
                 instance = instance.linkInstance)
            {
                if (instance.IsMovie())
                {
                    LWF i = ((Movie)instance).SearchAttachedLWF(
                        attachName, recursive);
                    if (i != null)
                    {
                        return(i);
                    }
                }
            }
            return(null);
        }
示例#3
0
        public Movie SearchAttachedMovie(string attachName, bool recursive = true)
        {
            Movie movie = GetAttachedMovie(attachName);

            if (movie != null)
            {
                return(movie);
            }

            if (!recursive)
            {
                return(null);
            }

            for (IObject instance = m_instanceHead; instance != null;
                 instance = instance.linkInstance)
            {
                if (instance.IsMovie())
                {
                    Movie i = ((Movie)instance).SearchAttachedMovie(
                        attachName, recursive);
                    if (i != null)
                    {
                        return(i);
                    }
                }
            }
            return(null);
        }
示例#4
0
文件: lwf_movie.cs 项目: nask0/lwf
 public Movie SearchMovieInstanceByInstanceId(int instId, bool recursive)
 {
     for (IObject instance = m_instanceHead; instance != null;
          instance = instance.linkInstance)
     {
         if (instance.IsMovie() && instance.instanceId == instId)
         {
             return((Movie)instance);
         }
         else if (recursive && instance.IsMovie())
         {
             Movie i = ((Movie)instance).SearchMovieInstanceByInstanceId(
                 instId, recursive);
             if (i != null)
             {
                 return(i);
             }
         }
     }
     return(null);
 }
示例#5
0
文件: lwf_core.cs 项目: osdakira/lwf
        public Movie SearchMovieInstanceByInstanceId(int instId)
        {
            if (instId < 0 || instId >= m_instances.Length)
            {
                return(null);
            }
            IObject obj = m_instances[instId];

            while (obj != null)
            {
                if (obj.IsMovie())
                {
                    return((Movie)obj);
                }
                obj = obj.nextInstance;
            }
            return(null);
        }
示例#6
0
        public void PostExec(bool progressing)
        {
            m_hasButton = false;
            if (!m_active)
            {
                return;
            }

            m_instanceHead = null;
            m_instanceTail = null;
            m_execedFrame  = -1;
            if (progressing && m_playing && !m_jumped)
            {
                ++m_currentFrameInternal;
            }
            for (;;)
            {
                if (m_currentFrameInternal < 0 ||
                    m_currentFrameInternal >= m_totalFrames)
                {
                    m_currentFrameInternal = 0;
                }
                if (m_currentFrameInternal == m_execedFrame)
                {
                    break;
                }

                m_instanceHead = null;
                m_instanceTail = null;

                m_currentFrameCurrent = m_currentFrameInternal;
                m_execedFrame         = m_currentFrameCurrent;
                Data         data  = m_lwf.data;
                Format.Frame frame = data.frames[
                    m_data.frameOffset + m_currentFrameCurrent];

                int controlAnimationOffset = -1;
                for (int i = 0; i < frame.controls; ++i)
                {
                    Format.Control control =
                        data.controls[frame.controlOffset + i];

                    switch ((Format.Control.Type)control.controlType)
                    {
                    case Format.Control.Type.MOVE:
                    {
                        Format.Place p =
                            data.places[control.controlId];
                        ExecObject(p.depth, p.objectId,
                                   p.matrixId, 0, p.instanceId);
                    }
                    break;

                    case Format.Control.Type.MOVEM:
                    {
                        Format.ControlMoveM ctrl =
                            data.controlMoveMs[control.controlId];
                        Format.Place p = data.places[ctrl.placeId];
                        ExecObject(p.depth, p.objectId,
                                   ctrl.matrixId, 0, p.instanceId);
                    }
                    break;

                    case Format.Control.Type.MOVEC:
                    {
                        Format.ControlMoveC ctrl =
                            data.controlMoveCs[control.controlId];
                        Format.Place p = data.places[ctrl.placeId];
                        ExecObject(p.depth, p.objectId,
                                   p.matrixId, ctrl.colorTransformId, p.instanceId);
                    }
                    break;

                    case Format.Control.Type.MOVEMC:
                    {
                        Format.ControlMoveMC ctrl =
                            data.controlMoveMCs[control.controlId];
                        Format.Place p = data.places[ctrl.placeId];
                        ExecObject(p.depth, p.objectId,
                                   ctrl.matrixId, ctrl.colorTransformId, p.instanceId);
                    }
                    break;

                    case Format.Control.Type.ANIMATION:
                        if (controlAnimationOffset == -1)
                        {
                            controlAnimationOffset = i;
                        }
                        break;
                    }
                }

                for (int dlDepth = 0; dlDepth < m_data.depths; ++dlDepth)
                {
                    Object obj = m_displayList[dlDepth];
                    if (obj != null)
                    {
                        if (obj.execCount != execCount)
                        {
                            obj.Destroy();
                            m_displayList[dlDepth] = null;
                        }
                    }
                }

                if (m_attachedMovies != null)
                {
                    foreach (Movie movie in m_attachedMovieList)
                    {
                        if (movie != null)
                        {
                            movie.Exec();
                        }
                    }
                }

                IObject instance = m_instanceHead;
                while (instance != null)
                {
                    if (instance.IsMovie())
                    {
                        Movie movie = (Movie)instance;
                        movie.PostExec(progressing);
                        if (!m_hasButton && movie.m_hasButton)
                        {
                            m_hasButton = true;
                        }
                    }
                    instance = instance.linkInstance;
                }

                if (m_attachedMovies != null)
                {
                    foreach (KeyValuePair <string, bool> kvp in m_detachedMovies)
                    {
                        string attachName = kvp.Key;
                        Movie  movie;
                        if (m_attachedMovies.TryGetValue(attachName, out movie))
                        {
                            DeleteAttachedMovie(this, movie, true, false);
                        }
                    }
                    m_detachedMovies.Clear();
                    foreach (Movie movie in m_attachedMovieList)
                    {
                        if (movie != null)
                        {
                            movie.PostExec(progressing);
                            if (!m_hasButton && movie.m_hasButton)
                            {
                                m_hasButton = true;
                            }
                        }
                    }
                }

                if (!m_postLoaded)
                {
                    m_postLoaded = true;
                    if (m_handler != null)
                    {
                        m_handler.Call(EventType.POSTLOAD, this);
                    }
                }

                if (controlAnimationOffset != -1 &&
                    m_execedFrame == m_currentFrameInternal)
                {
                    bool animationPlayed = m_animationPlayedFrame ==
                                           m_currentFrameCurrent && !m_jumped;
                    if (!animationPlayed)
                    {
                        for (int i = controlAnimationOffset;
                             i < frame.controls; ++i)
                        {
                            Format.Control control =
                                data.controls[frame.controlOffset + i];
                            m_lwf.PlayAnimation(control.controlId, this);
                        }
                    }
                }

                m_animationPlayedFrame = m_currentFrameCurrent;
                if (m_currentFrameCurrent == m_currentFrameInternal)
                {
                    m_jumped = false;
                }
            }

            PlayAnimation(ClipEvent.ENTERFRAME);
            if (m_handler != null)
            {
                m_handler.Call(EventType.ENTERFRAME, this);
            }
        }