Exemple #1
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="symbolName"></param>
 /// <returns></returns>
 public bool checkSymmbolName(string symbolName)
 {
     if (assetContext != null)
     {
         MovieClipAssetInfo tem = assetContext.getMovieInfoByName(symbolName);
         return(tem != null);
     }
     return(false);
 }
Exemple #2
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="assetContext"></param>
        /// <param name="cid"></param>
        internal void setSymbolByCid(SwfAssetContext assetContext, int cid)
        {
            m_MovieClipInfo   = assetContext.getMovieInfoByCid(cid);
            this.assetContext = assetContext;
            m_FrameNum        = -1;
            m_SymbolName      = "cid(" + cid + ")";
            if (m_MovieClipInfo != null)
            {
                m_SymbolName = m_MovieClipInfo.className;
            }

            setFrame(1);
        }
Exemple #3
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="symbolName"></param>
        public void setSymbolName(string symbolName)
        {
            if (assetContext != null)
            {
                m_FrameNum       = -1;
                m_NextSymbolName = null;
                clearFrameScript();
                m_SymbolName = symbolName;
                if (m_MovieClipInfo == null || m_MovieClipInfo.className != symbolName)
                {
                    m_MovieClipInfo = assetContext.getMovieInfoByName(symbolName);
                }

                setFrame(1);
            }
        }
Exemple #4
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="frameNum"></param>
        /// <param name="isFrameUpdate"></param>
        protected void _setFrame(int frameNum, bool isFrameUpdate)
        {
            if (m_FrameNum == frameNum)
            {
                return;
            }
            if (frameNum < 0)
            {
                frameNum = 0;
            }
            else if (frameNum >= totalFrames)
            {
                frameNum = totalFrames - 1;
            }
            m_FrameNum = frameNum;
            base.m_Children.Clear();

            if ((m_FrameNum < 0) || (m_FrameNum >= m_MovieClipInfo.frames.Count))
            {
                return;
            }

            DisplayObjectInfo[] displayList = m_MovieClipInfo.frames[m_FrameNum];
            int len = displayList.Length;

            for (int i = 0; i < len; i++)
            {
                DisplayObjectInfo dispInfo = displayList[i];

                if (m_InstanceCache == null)
                {
                    m_InstanceCache = new Dictionary <short, DisplayObjectContainer>();
                }
                if (dispInfo.isBitmap)
                {
                    DisplayObjectContainer displayObject = !m_InstanceCache.ContainsKey(dispInfo.instanceId) ? null : m_InstanceCache[dispInfo.instanceId];
                    if ((displayObject != null) && (displayObject.cachedCid != dispInfo.cid))
                    {
                        displayObject = null;
                    }
                    if (displayObject == null)
                    {
                        BitmapAssetInfo bmpInfo = assetContext.bitmaps[dispInfo.cid];

                        displayObject           = new DisplayObjectContainer();
                        bmpInfo.material        = assetContext.material;
                        displayObject.bmpInfo   = bmpInfo;
                        displayObject.cachedCid = dispInfo.cid;

                        m_InstanceCache[dispInfo.instanceId] = displayObject;
                    }
                    base.addChild(displayObject);
                    dispInfo.tranform.applyToSprite(displayObject);
                }
                else
                {
                    MovieClipAssetInfo info3  = assetContext.exports[dispInfo.cid];
                    MovieClipPlayer    player = !m_InstanceCache.ContainsKey(dispInfo.instanceId) ? null : (m_InstanceCache[dispInfo.instanceId] is MovieClipPlayer ? (MovieClipPlayer)m_InstanceCache[dispInfo.instanceId] : null);
                    if ((player != null) && (player.cachedCid != dispInfo.cid))
                    {
                        player = null;
                    }
                    if (player == null)
                    {
                        player = new MovieClipPlayer(null, null);
                        player.setSymbolByCid(assetContext, dispInfo.cid);
                        player.cachedCid = dispInfo.cid;

                        if (isFrameUpdate)
                        {
                            player.m_FrameNum = -1;
                        }
                        else
                        {
                            player.setFrame(1, isFrameUpdate);
                        }
                        m_InstanceCache[dispInfo.instanceId] = player;
                    }
                    base.addChild(player);
                    dispInfo.tranform.applyToSprite(player);
                }
            }

            if (frameCallbacks != null && frameCallbacks.ContainsKey(m_FrameNum))
            {
                frameCallbacks[m_FrameNum]();
            }
            if (!string.IsNullOrEmpty(m_NextSymbolName) && frameNum >= totalFrames - 1)
            {
                setSymbolName(m_NextSymbolName);
            }
        }