コード例 #1
0
        public void Play(float fadeTime = 0f)
        {
            switch (this.m_state)
            {
            case UiAnimation.State.Stopped:
            case UiAnimation.State.Stopping:
            {
                this.Reset();
                break;
            }

            case UiAnimation.State.Playing:
            {
                return;
            }
            }
            this.m_state    = UiAnimation.State.Playing;
            this.m_fadeTime = fadeTime;
            if (fadeTime > 0f)
            {
                this.m_fadeAlphaScalar = 0f;
                this.m_fadeStart       = Time.timeSinceLevelLoad;
                this.Update();
            }
        }
コード例 #2
0
        private void Update()
        {
            if (this.m_state != UiAnimation.State.Playing && this.m_state != UiAnimation.State.Stopping)
            {
                return;
            }
            bool flag = true;

            foreach (UiAnimation.UiAnimGroup mGroup in this.m_groups)
            {
                if (mGroup.Update(this.m_state == UiAnimation.State.Stopping))
                {
                    continue;
                }
                flag = false;
            }
            bool flag1 = false;

            if (this.m_state == UiAnimation.State.Playing && this.m_fadeTime > 0f)
            {
                float mFadeStart = (Time.timeSinceLevelLoad - this.m_fadeStart) / this.m_fadeTime;
                if (mFadeStart >= 1f)
                {
                    this.m_fadeTime = 0f;
                    mFadeStart      = 1f;
                }
                flag1 = true;
                this.m_fadeAlphaScalar = mFadeStart;
            }
            if (this.m_state == UiAnimation.State.Stopping)
            {
                flag = false;
                float single = (Time.timeSinceLevelLoad - this.m_fadeStart) / this.m_fadeTime;
                if (single >= 1f)
                {
                    single = 1f;
                    flag   = true;
                }
                single = 1f - single;
                this.m_fadeAlphaScalar = single;
                flag1 = true;
            }
            if (flag1)
            {
                foreach (UiAnimation.UiTexture value in this.m_textures.Values)
                {
                    value.m_image.canvasRenderer.SetAlpha(value.m_alpha * this.m_fadeAlphaScalar);
                }
            }
            if (flag)
            {
                this.m_state    = UiAnimation.State.Stopped;
                this.m_fadeTime = 0f;
                UiAnimMgr.instance.AnimComplete(this);
            }
        }
コード例 #3
0
 public void Stop(float fadeTime = 0f)
 {
     if (fadeTime <= Mathf.Epsilon)
     {
         this.m_state    = UiAnimation.State.Stopped;
         this.m_fadeTime = 0f;
         UiAnimMgr.instance.AnimComplete(this);
     }
     else
     {
         this.m_state     = UiAnimation.State.Stopping;
         this.m_fadeTime  = fadeTime;
         this.m_fadeStart = Time.timeSinceLevelLoad;
     }
 }
コード例 #4
0
    private void Update()
    {
        if (this.m_state != UiAnimation.State.Playing && this.m_state != UiAnimation.State.Stopping)
        {
            return;
        }
        bool flag = true;

        using (List <UiAnimation.UiAnimGroup> .Enumerator enumerator = this.m_groups.GetEnumerator())
        {
            while (enumerator.MoveNext())
            {
                UiAnimation.UiAnimGroup current = enumerator.get_Current();
                if (!current.Update(this.m_state == UiAnimation.State.Stopping))
                {
                    flag = false;
                }
            }
        }
        bool flag2 = false;

        if (this.m_state == UiAnimation.State.Playing && this.m_fadeTime > 0f)
        {
            float num = (Time.get_timeSinceLevelLoad() - this.m_fadeStart) / this.m_fadeTime;
            if (num >= 1f)
            {
                this.m_fadeTime = 0f;
                num             = 1f;
            }
            flag2 = true;
            this.m_fadeAlphaScalar = num;
        }
        if (this.m_state == UiAnimation.State.Stopping)
        {
            flag = false;
            float num2 = (Time.get_timeSinceLevelLoad() - this.m_fadeStart) / this.m_fadeTime;
            if (num2 >= 1f)
            {
                num2 = 1f;
                flag = true;
            }
            num2 = 1f - num2;
            this.m_fadeAlphaScalar = num2;
            flag2 = true;
        }
        if (flag2)
        {
            using (Dictionary <string, UiAnimation.UiTexture> .ValueCollection.Enumerator enumerator2 = this.m_textures.get_Values().GetEnumerator())
            {
                while (enumerator2.MoveNext())
                {
                    UiAnimation.UiTexture current2 = enumerator2.get_Current();
                    current2.m_image.get_canvasRenderer().SetAlpha(current2.m_alpha * this.m_fadeAlphaScalar);
                }
            }
        }
        if (flag)
        {
            this.m_state    = UiAnimation.State.Stopped;
            this.m_fadeTime = 0f;
            UiAnimMgr.instance.AnimComplete(this);
        }
    }