示例#1
0
        public Movie AttachMovieInternal(Movie movie, string attachName,
                                         int attachDepth = -1, bool reorder = false)
        {
            if (m_attachedMovies == null)
            {
                m_attachedMovies              = new AttachedMovies();
                m_detachedMovies              = new DetachDict();
                m_attachedMovieList           = new AttachedMovieList();
                m_attachedMovieDescendingList =
                    new AttachedMovieDescendingList(new DescendingComparer <int>());
            }

            Movie attachedMovie;

            if (m_attachedMovies.TryGetValue(attachName, out attachedMovie))
            {
                DeleteAttachedMovie(this, attachedMovie);
            }

            if (!reorder && attachDepth >= 0)
            {
                if (m_attachedMovieList.TryGetValue(attachDepth, out attachedMovie))
                {
                    DeleteAttachedMovie(this, attachedMovie);
                }
            }

            movie.m_attachName = attachName;
            if (attachDepth >= 0)
            {
                movie.depth = attachDepth;
            }
            else
            {
                AttachedMovieDescendingList.KeyCollection.Enumerator e =
                    m_attachedMovieDescendingList.Keys.GetEnumerator();
                if (e.MoveNext())
                {
                    movie.depth = e.Current + 1;
                }
                else
                {
                    movie.depth = 0;
                }
            }
            movie.m_name = attachName;
            m_attachedMovies[attachName] = movie;
            ReorderAttachedMovieList(reorder, movie.depth, movie);

            return(movie);
        }
示例#2
0
文件: lwf_movie.cs 项目: nask0/lwf
        public override void Destroy()
        {
            for (int dlDepth = 0; dlDepth < m_data.depths; ++dlDepth)
            {
                Object obj = m_displayList[dlDepth];
                if (obj != null)
                {
                    obj.Destroy();
                }
            }

            if (m_attachedMovies != null)
            {
                foreach (KeyValuePair <string, Movie> kvp in m_attachedMovies)
                {
                    kvp.Value.Destroy();
                }
                m_attachedMovies    = null;
                m_detachedMovies    = null;
                m_attachedMovieList = null;
            }

            if (m_attachedLWFs != null)
            {
                foreach (KeyValuePair <string, LWFContainer> kvp in m_attachedLWFs)
                {
                    if (kvp.Value.child.detachHandler != null)
                    {
                        kvp.Value.child.detachHandler(kvp.Value.child);
                    }
                }
                m_attachedLWFs    = null;
                m_detachedLWFs    = null;
                m_attachedLWFList = null;
            }

            PlayAnimation(ClipEvent.UNLOAD);

            if (!m_handler.Empty())
            {
                m_handler.Call(EventType.UNLOAD, this);
            }

            m_displayList = null;
            m_property    = null;

            base.Destroy();
        }
示例#3
0
        public Movie AttachMovieInternal(Movie movie, string attachName,
                                         int attachDepth = -1, bool reorder = false)
        {
            if (m_attachedMovies == null)
            {
                m_attachedMovies    = new AttachedMovies();
                m_detachedMovies    = new DetachDict();
                m_attachedMovieList = new AttachedMovieList();
            }

            Movie attachedMovie;

            if (m_attachedMovies.TryGetValue(attachName, out attachedMovie))
            {
                DeleteAttachedMovie(this, attachedMovie);
            }

            if (!reorder && attachDepth >= 0 &&
                attachDepth <= m_attachedMovieList.Count - 1)
            {
                attachedMovie = m_attachedMovieList[attachDepth];
                if (attachedMovie != null)
                {
                    DeleteAttachedMovie(this, attachedMovie);
                }
            }

            movie.m_attachName = attachName;
            movie.depth        = attachDepth >= 0 ?
                                 attachDepth : m_attachedMovieList.Count;
            movie.m_name = attachName;
            m_attachedMovies[attachName] = movie;
            ReorderAttachedMovieList(reorder, movie.depth, movie);

            return(movie);
        }
示例#4
0
	public override void Destroy()
	{
		for (int dlDepth = 0; dlDepth < m_data.depths; ++dlDepth) {
			Object obj = m_displayList[dlDepth];
			if (obj != null)
				obj.Destroy();
		}

		if (m_bitmapClips != null) {
			foreach (KeyValuePair<int, BitmapClip> kvp in m_bitmapClips)
				if (kvp.Value != null)
					kvp.Value.Destroy();
			m_bitmapClips = null;
		}

		if (m_attachedMovies != null) {
			foreach (KeyValuePair<string, Movie> kvp in m_attachedMovies)
				kvp.Value.Destroy();
			m_attachedMovies = null;
			m_detachedMovies = null;
			m_attachedMovieList = null;
		}

		if (m_attachedLWFs != null) {
			foreach (KeyValuePair<string, LWFContainer> kvp in m_attachedLWFs)
				if (kvp.Value.child.detachHandler != null)
					kvp.Value.child.detachHandler(kvp.Value.child);
			m_attachedLWFs = null;
			m_detachedLWFs = null;
			m_attachedLWFList = null;
		}

#if LWF_USE_LUA
		if (m_isRoot && !String.IsNullOrEmpty(m_rootUnloadFunc))
			lwf.CallFunctionLua(m_rootUnloadFunc, this);
		if (m_unloadFunc != String.Empty)
			lwf.CallFunctionLua(m_unloadFunc, this);
#endif
		PlayAnimation(ClipEvent.UNLOAD);

		if (!m_handler.Empty())
			m_handler.Call(EventType.UNLOAD, this);

#if LWF_USE_LUA
		lwf.DestroyMovieLua(this);
#endif
		m_displayList = null;
		m_property = null;

		base.Destroy();
	}
示例#5
0
文件: lwf_movie.cs 项目: ufosky/lwf
        public override void Destroy()
        {
            for (int dlDepth = 0; dlDepth < m_data.depths; ++dlDepth)
            {
                Object obj = m_displayList[dlDepth];
                if (obj != null)
                {
                    obj.Destroy();
                }
            }

            if (m_attachedMovies != null)
            {
                foreach (KeyValuePair <string, Movie> kvp in m_attachedMovies)
                {
                    kvp.Value.Destroy();
                }
                m_attachedMovies    = null;
                m_detachedMovies    = null;
                m_attachedMovieList = null;
            }

            if (m_attachedLWFs != null)
            {
                foreach (KeyValuePair <string, LWFContainer> kvp in m_attachedLWFs)
                {
                    if (kvp.Value.child.detachHandler != null)
                    {
                        kvp.Value.child.detachHandler(kvp.Value.child);
                    }
                }
                m_attachedLWFs    = null;
                m_detachedLWFs    = null;
                m_attachedLWFList = null;
            }

#if LWF_USE_LUA
            if (m_isRoot && !String.IsNullOrEmpty(m_rootUnloadFunc))
            {
                lwf.CallFunctionLua(m_rootUnloadFunc, this);
            }
            if (m_unloadFunc != String.Empty)
            {
                lwf.CallFunctionLua(m_unloadFunc, this);
            }
#endif
            PlayAnimation(ClipEvent.UNLOAD);

            if (!m_handler.Empty())
            {
                m_handler.Call(EventType.UNLOAD, this);
            }

#if LWF_USE_LUA
            lwf.DestroyMovieLua(this);
#endif
            m_displayList = null;
            m_property    = null;

            base.Destroy();
        }