Beispiel #1
0
        public BitmapClip AttachBitmap(string linkageName, int depth)
        {
            int bitmapId;

            if (!m_lwf.data.bitmapMap.TryGetValue(linkageName, out bitmapId))
            {
                return(null);
            }
            var bitmap = new BitmapClip(m_lwf, this, bitmapId);

            if (m_bitmapClips != null)
            {
                DetachBitmap(depth);
            }
            else
            {
                m_bitmapClips = new BitmapClips();
            }
            m_bitmapClips[depth] = bitmap;
            bitmap.depth         = depth;
            bitmap.name          = linkageName;
            return(bitmap);
        }
Beispiel #2
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();
	}