Example #1
0
 private void CrossFadeColor(Color targetColor, float duration, bool ignoreTimeScale, bool useAlpha, bool useRGB)
 {
     if (!(canvasRenderer == null) && (useRGB || useAlpha) && !canvasRenderer.GetColor().Equals(targetColor))
     {
         ColorTween.ColorTweenMode tweenMode = (!useRGB || !useAlpha) ? (useRGB ? ColorTween.ColorTweenMode.RGB : ColorTween.ColorTweenMode.Alpha) : ColorTween.ColorTweenMode.All;
         ColorTween colorTween = default(ColorTween);
         colorTween.duration    = duration;
         colorTween.startColor  = canvasRenderer.GetColor();
         colorTween.targetColor = targetColor;
         ColorTween info = colorTween;
         info.AddOnChangedCallback(canvasRenderer.SetColor);
         info.ignoreTimeScale = ignoreTimeScale;
         info.tweenMode       = tweenMode;
         m_ColorTweenRunner.StartTween(info);
     }
 }
Example #2
0
 private void CrossFadeColor(Color targetColor, float duration, bool ignoreTimeScale, bool useAlpha, bool useRGB)
 {
     if (((this.canvasRenderer != null) && (useRGB || useAlpha)) && !this.canvasRenderer.GetColor().Equals(targetColor))
     {
         ColorTween.ColorTweenMode mode = (!useRGB || !useAlpha) ? (!useRGB ? ColorTween.ColorTweenMode.Alpha : ColorTween.ColorTweenMode.RGB) : ColorTween.ColorTweenMode.All;
         ColorTween info = new ColorTween {
             duration    = duration,
             startColor  = this.canvasRenderer.GetColor(),
             targetColor = targetColor
         };
         info.AddOnChangedCallback(new UnityAction <Color>(this.canvasRenderer.SetColor));
         info.ignoreTimeScale = ignoreTimeScale;
         info.tweenMode       = mode;
         this.m_ColorTweenRunner.StartTween(info);
     }
 }
Example #3
0
        private void CrossFadeColor(Color targetColor, float duration, bool ignoreTimeScale, bool useAlpha, bool useRGB)
        {
            if ((UnityEngine.Object) this.canvasRenderer == (UnityEngine.Object)null || !useRGB && !useAlpha || this.canvasRenderer.GetColor().Equals((object)targetColor))
            {
                return;
            }
            ColorTween.ColorTweenMode colorTweenMode = !useRGB || !useAlpha ? (!useRGB ? ColorTween.ColorTweenMode.Alpha : ColorTween.ColorTweenMode.RGB) : ColorTween.ColorTweenMode.All;
            ColorTween info = new ColorTween()
            {
                duration = duration, startColor = this.canvasRenderer.GetColor(), targetColor = targetColor
            };

            info.AddOnChangedCallback(new UnityAction <Color>(this.canvasRenderer.SetColor));
            info.ignoreTimeScale = ignoreTimeScale;
            info.tweenMode       = colorTweenMode;
            this.m_ColorTweenRunner.StartTween(info);
        }
        /// <summary>
        /// Starts a color tween.
        /// </summary>
        /// <param name="targetColor">Target color.</param>
        /// <param name="duration">Duration.</param>
        private void StartColorTweenText(Color targetColor, float duration)
        {
            if (this.m_TextTarget == null)
            {
                return;
            }

            if (!Application.isPlaying || duration == 0f)
            {
                this.m_TextTarget.color = targetColor;
            }
            else
            {
                var colorTween = new ColorTween {
                    duration = duration, startColor = this.m_TextTarget.color, targetColor = targetColor
                };
                colorTween.AddOnChangedCallback(SetTextColor);
                colorTween.ignoreTimeScale = true;

                this.m_ColorTweenRunner.StartTween(colorTween);
            }
        }