Ejemplo n.º 1
0
        public void updateCurrentFrame()
        {
            if (FlashUtils.FrameNameType.none != _codeControlFrameAction.frameActionType)
            {
                //Control by code.
                if (FlashUtils.FrameNameType.gotoAndPlay == _codeControlFrameAction.frameActionType)
                {
                    gotoAndPlayAction(_codeControlFrameAction.targetFrame);
                }
                else if (FlashUtils.FrameNameType.gotoAndStop == _codeControlFrameAction.frameActionType)
                {
                    gotoAndStopAction(_codeControlFrameAction.targetFrame);
                }
                else if (FlashUtils.FrameNameType.prevFrame == _codeControlFrameAction.frameActionType)
                {
                    prevFrameAction();
                }
                else if (FlashUtils.FrameNameType.nextFrame == _codeControlFrameAction.frameActionType)
                {
                    nextFrameAction();
                }
                else if (FlashUtils.FrameNameType.remove == _codeControlFrameAction.frameActionType)
                {
                    removeFromParent();
                }
                _codeControlFrameAction.frameActionType = FlashUtils.FrameNameType.none;
                frameLabelAtNextFrameBegin = null;                 //Higher priority,clear lower one.Avoid do it in next frame.
            }
            else if (frameLabelAtNextFrameBegin != null)
            {
                //Control by other movieclip frame.Then self cann't do auto play things.
                doFrameActionByFrameLabel(frameLabelAtNextFrameBegin); //excute actions
                frameLabelAtNextFrameBegin = null;                     //clear it
            }
            else
            {
                if (autoPlay)
                {
                    if (currentFrame < mcTimeLineInfo.totalFrames)
                    {
                        currentFrame = currentFrame + 1;
                    }
                    else
                    {
                        currentFrame = 1;
                    }
                }
            }

            //When init,must make it to frame 1.
            if (currentFrame == 0)
            {
                currentFrame = 1;
            }
        }
Ejemplo n.º 2
0
        public override void OnDestroy()
        {
            FlashManager _flashManager = FlashManager.getInstance();

            if (_flashManager != null)
            {
                _flashManager.mainMovieClipList.Remove(this);
            }
            if (_flashManager != null)
            {
                _flashManager.movieClipCount--;
            }
            _disOnStage.Clear();
            _disNotOnStage.Clear();
            _movieClipOnPathCache.Clear();
            _codeControlFrameAction     = null;
            frameLabelAtNextFrameBegin  = null;
            _mainMovieClip              = null;
            mcTimeLineInfo              = null;
            _frameIntToFrameActionCache = null;
            base.OnDestroy();
        }
Ejemplo n.º 3
0
 //MovieClip control frame.
 public void doFrameActionByFrameLabel(FlashUtils.FrameLabel frameLabel_)
 {
     if (frameLabel_.name == FlashUtils.FrameNameType.nextFrame)
     {
         nextFrameAction();
     }
     else if (frameLabel_.name == FlashUtils.FrameNameType.prevFrame)
     {
         prevFrameAction();
     }
     else if (frameLabel_.name == FlashUtils.FrameNameType.gotoAndStop)
     {
         gotoAndStopAction(FlashUtils.getFrameIntByString(mcTimeLineInfo, frameLabel_.parameter));
     }
     else if (frameLabel_.name == FlashUtils.FrameNameType.gotoAndPlay)
     {
         gotoAndPlayAction(FlashUtils.getFrameIntByString(mcTimeLineInfo, frameLabel_.parameter));
     }
     else if (frameLabel_.name == FlashUtils.FrameNameType.remove)
     {
         removeFromParent();
     }
 }
Ejemplo n.º 4
0
        //Frame label -> actions
        public void doFrameActionByFrameInt(int frameInt_)
        {
            List <FlashUtils.FrameLabel> _frameActions;

            if (_frameIntToFrameActionCache.TryGetValue(frameInt_, out _frameActions))
            {
                //Show this frame,then do actions on this frame.
                //Frame control actions which target is self,Will do in next frame.
                FlashUtils.FrameLabel _frameLabel;
                int       _selfFrameControl = 0;
                MovieClip targetMovieClip;
                string    _path;
                for (int _idx = 0; _idx < _frameActions.Count; _idx++)
                {
                    _frameLabel = _frameActions[_idx];
                    _path       = _frameLabel.targetPath;
                    if (_frameLabel.name == FlashUtils.FrameNameType.remove)
                    {
                        if (_frameLabel.targetPath == "t")
                        {
                            removeFromParent();                              //Self remove is call right now.
                        }
                        else
                        {
                            targetMovieClip = getMovieClipByPath(_path);
                            targetMovieClip.frameLabelAtNextFrameBegin = _frameLabel;
                        }
                    }
                    else if (
                        _frameLabel.name == FlashUtils.FrameNameType.stop ||
                        _frameLabel.name == FlashUtils.FrameNameType.play
                        )
                    {
                        if (_frameLabel.targetPath == "t")
                        {
                            _selfFrameControl++;
                            targetMovieClip = this;
                        }
                        else
                        {
                            targetMovieClip = getMovieClipByPath(_path);
                        }
                        if (_frameLabel.name == FlashUtils.FrameNameType.stop)
                        {
                            targetMovieClip.stop();
                        }
                        if (_frameLabel.name == FlashUtils.FrameNameType.play)
                        {
                            targetMovieClip.play();
                        }
                    }
                    else if (
                        _frameLabel.name == FlashUtils.FrameNameType.nextFrame ||
                        _frameLabel.name == FlashUtils.FrameNameType.prevFrame ||
                        _frameLabel.name == FlashUtils.FrameNameType.gotoAndStop ||
                        _frameLabel.name == FlashUtils.FrameNameType.gotoAndPlay
                        )
                    {
                        if (_frameLabel.targetPath == "t")
                        {
                            _selfFrameControl++;
                            if (frameLabelAtNextFrameBegin == null)
                            {
                                //Other MovieClip frame control has higher priority
                                frameLabelAtNextFrameBegin = _frameLabel;
                            }
                        }
                        else
                        {
                            targetMovieClip = getMovieClipByPath(_path);
                            targetMovieClip.frameLabelAtNextFrameBegin = _frameLabel;
                        }
                    }
                }

                if (_selfFrameControl > 1)
                {
                    Debug.LogError("ERROR " + System.Reflection.MethodBase.GetCurrentMethod().ReflectedType.FullName + " -> " +
                                   new System.Diagnostics.StackTrace().GetFrame(0).GetMethod().Name + " : " +
                                   "There are more then two frame control actions in one frame." + mcTimeLineInfo.className + " : " +
                                   frameInt_.ToString() + " !"
                                   );
                }
            }
        }