Example #1
0
        [NonSerialized][XmlIgnore] public int mNumElements; // Num elements in the TextAnimation component (used to know when the InitTime should be executed again if the text changes)



        #endregion

        public void Play(TextAnimation se)
        {
            if (se != null)
            {
                if (!se.mPlayingAnimations.Contains(this))
                {
                    se.mPlayingAnimations.Add(this);
                    TextAnimationsManager.RegisterAnimation(se);
                }
                se.MarkWidgetAsChanged();
                _OnFinished += (anim) => { se._OnAnimation_Finished.Invoke(anim); };
            }

            IsPlaying    = true;
            mTime        = mRealTime = 0;
            mNumElements = -1;
            mRandomSeed  = -1;
            InitTimes(se, true);
        }
Example #2
0
        public void Stop(TextAnimation se, bool executeCallback = true)
        {
            if (IsPlaying)
            {
                for (int i = 0; i < _Sequences.Length; ++i)
                {
                    if (_Sequences[i]._Enabled)
                    {
                        _Sequences[i].OnStop(se, this, i);
                    }
                }

                IsPlaying = false;
                if (executeCallback && _OnFinished != null)
                {
                    _OnFinished(this);
                }

                se.mPlayingAnimations.Remove(this);
                se.MarkWidgetAsChanged(true, true);
            }
            _OnFinished = null;
        }