Exemple #1
0
        public void AttachLWF(LWF attachLWF, string attachName,
                              int attachDepth             = -1, bool reorder = false,
                              DetachHandler detachHandler = null)
        {
            if (m_attachedLWFs == null)
            {
                m_attachedLWFs    = new AttachedLWFs();
                m_detachedLWFs    = new DetachDict();
                m_attachedLWFList = new AttachedLWFList();
            }

            LWFContainer lwfContainer;

            if (attachLWF.parent != null)
            {
                attachLWF.parent.m_attachedLWFs.TryGetValue(
                    attachLWF.attachName, out lwfContainer);
                DeleteAttachedLWF(attachLWF.parent, lwfContainer, false);
            }
            else
            {
                if (m_attachedLWFs.TryGetValue(attachName, out lwfContainer))
                {
                    DeleteAttachedLWF(this, lwfContainer);
                }
            }

            if (!reorder && attachDepth >= 0 &&
                attachDepth <= m_attachedLWFList.Count - 1)
            {
                lwfContainer = m_attachedLWFList[attachDepth];
                if (lwfContainer != null)
                {
                    DeleteAttachedLWF(this, lwfContainer);
                }
            }

            lwfContainer = new LWFContainer(this, attachLWF);

            if (attachLWF.interactive == true)
            {
                m_lwf.interactive = true;
            }
            attachLWF.parent        = this;
            attachLWF.detachHandler = detachHandler;
            attachLWF.attachName    = attachName;
            attachLWF.depth         = attachDepth >= 0 ?
                                      attachDepth : m_attachedLWFList.Count;
            m_attachedLWFs[attachName] = lwfContainer;
            ReorderAttachedLWFList(reorder, attachLWF.depth, lwfContainer);

            m_lwf.isLWFAttached = true;
        }
Exemple #2
0
        public void AttachLWF(LWF attachLWF, string attachName,
                              int attachDepth             = -1, bool reorder = false,
                              DetachHandler detachHandler = null)
        {
            if (m_attachedLWFs == null)
            {
                m_attachedLWFs              = new AttachedLWFs();
                m_detachedLWFs              = new DetachDict();
                m_attachedLWFList           = new AttachedLWFList();
                m_attachedLWFDescendingList =
                    new AttachedLWFDescendingList(new DescendingComparer <int>());
            }

            LWFContainer lwfContainer;

            if (attachLWF.parent != null)
            {
                attachLWF.parent.m_attachedLWFs.TryGetValue(
                    attachLWF.attachName, out lwfContainer);
                DeleteAttachedLWF(attachLWF.parent, lwfContainer, false);
            }
            else
            {
                if (m_attachedLWFs.TryGetValue(attachName, out lwfContainer))
                {
                    DeleteAttachedLWF(this, lwfContainer);
                }
            }

            if (!reorder && attachDepth >= 0)
            {
                if (m_attachedLWFList.TryGetValue(attachDepth, out lwfContainer))
                {
                    DeleteAttachedLWF(this, lwfContainer);
                }
            }

            lwfContainer = new LWFContainer(this, attachLWF);

            if (attachLWF.interactive == true)
            {
                m_lwf.interactive = true;
            }
            attachLWF.parent        = this;
            attachLWF.detachHandler = detachHandler;
            attachLWF.attachName    = attachName;
            attachLWF.depth         = attachDepth >= 0 ? attachDepth :
                                      m_attachedLWFDescendingList.Keys.GetEnumerator().Current + 1;
            m_attachedLWFs[attachName] = lwfContainer;
            ReorderAttachedLWFList(reorder, attachLWF.depth, lwfContainer);

            m_lwf.isLWFAttached = true;
        }
Exemple #3
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_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();
        }
Exemple #4
0
 private void ReorderAttachedLWFList(
     bool reorder, int index, LWFContainer lwfContainer)
 {
     m_attachedLWFList[index] = lwfContainer;
     if (reorder)
     {
         AttachedLWFList list = m_attachedLWFList;
         m_attachedLWFList           = new AttachedLWFList();
         m_attachedLWFDescendingList =
             new AttachedLWFDescendingList(new DescendingComparer <int>());
         int i = 0;
         foreach (LWFContainer l in list.Values)
         {
             l.child.depth                  = i;
             m_attachedLWFList[i]           = l;
             m_attachedLWFDescendingList[i] = i;
             ++i;
         }
     }
 }
Exemple #5
0
        public void AttachLWF(LWF child, string attachName, int attachDepth = -1,
                              bool reorder = false, DetachHandler detachHandler = null)
        {
            if (m_attachedLWFs == null)
            {
                m_attachedLWFs              = new AttachedLWFs();
                m_detachedLWFs              = new DetachDict();
                m_attachedLWFList           = new AttachedLWFList();
                m_attachedLWFDescendingList =
                    new AttachedLWFDescendingList(new DescendingComparer <int>());
            }

            LWFContainer lwfContainer;

            if (child.parent != null)
            {
                child.parent.m_attachedLWFs.TryGetValue(
                    child.attachName, out lwfContainer);
                DeleteAttachedLWF(child.parent, lwfContainer, false);
            }
            if (m_attachedLWFs.TryGetValue(attachName, out lwfContainer))
            {
                DeleteAttachedLWF(this, lwfContainer);
            }

            if (!reorder && attachDepth >= 0)
            {
                if (m_attachedLWFList.TryGetValue(attachDepth, out lwfContainer))
                {
                    DeleteAttachedLWF(this, lwfContainer);
                }
            }

            lwfContainer = new LWFContainer(this, child);

            if (child.interactive == true)
            {
                m_lwf.SetInteractive();
            }
            child.parent        = this;
            child.detachHandler = detachHandler;
            child.attachName    = attachName;
            if (attachDepth >= 0)
            {
                child.depth = attachDepth;
            }
            else
            {
                AttachedLWFDescendingList.KeyCollection.Enumerator e =
                    m_attachedLWFDescendingList.Keys.GetEnumerator();
                if (e.MoveNext())
                {
                    child.depth = e.Current + 1;
                }
                else
                {
                    child.depth = 0;
                }
            }
            m_attachedLWFs[attachName] = lwfContainer;
            ReorderAttachedLWFList(reorder, child.depth, lwfContainer);

            m_lwf.SetLWFAttached();

            return;
        }
Exemple #6
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();
	}
Exemple #7
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_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();
        }