예제 #1
0
        private void Awake()
        {
            _icon         = GetComponent <MaskableGraphic>();
            _icon.color   = Colors.clearWhite;
            _icon.enabled = false;
            _transform    = _icon.transform;

            TweenParams commonTweenParams = new TweenParams()
                                            .SetEase(_ease)
                                            .SetRecyclable(true)
                                            .SetAutoKill(false);

            _fadeIn = _icon
                      .DOColor(Color.white, _fadeDuration)
                      .SetAs(commonTweenParams)
                      .OnStart(OnStartLoading)
                      .Pause();
            _fadeOut = _icon
                       .DOColor(Colors.clearWhite, _fadeDuration)
                       .SetAs(commonTweenParams)
                       .OnComplete(OnCompleteLoading)
                       .Pause();

            // _text.color = Colors.clearWhite;
            // _text.enabled = false;
        }
예제 #2
0
파일: ImageItem.cs 프로젝트: kimch2/Unity-1
 public override void Back()
 {
     if (Graphic == null)
     {
         return;
     }
     Graphic.DOColor(_initColor.Value, UIChangeSetting.ColorChangeSpeed);
     if (ToSprite != null)
     {
         (Graphic as Image).sprite = _initSprite;
     }
 }
예제 #3
0
        /// <summary>
        /// Run a color (or alpha) tween animation
        /// </summary>
        /// <param name="endValue">End value when start is 0 and end is 1</param>
        /// <param name="duration"></param>
        /// <param name="ease">DG.Tweening.Ease</param>
        /// <param name="delay"></param>
        public void AnimateColor(float endValue, float duration, Ease ease = Ease.Linear, float delay = 0)
        {
            if (useColor == ColorType.None)
            {
                return;
            }
            ForceActive();

            if (useColor != ColorType.None)
            {
                colorTween?.Kill();
            }

            switch (useColor)
            {
            case ColorType.Alpha:
                colorTween = maskableGraphic.DOFade(GetAlphaLeap(endValue), duration).SetEase(ease).SetDelay(delay);
                break;

            case ColorType.Color:
                colorTween = maskableGraphic.DOColor(GetColorLeap(endValue), duration).SetEase(ease).SetDelay(delay);
                break;
            }

            if (useColor != ColorType.None && endValue == 0)
            {
                colorTween.OnComplete(() => ForceInactive());
            }
        }
예제 #4
0
 /// <summary>
 /// 图片淡出
 /// </summary>
 public static void PictureFadeOut(this MaskableGraphic image, float timer, Action end = null)
 {
     image.DOColor(new Color(image.color.r, image.color.g, image.color.b, 0), timer).OnComplete(delegate
     {
         if (end != null)
         {
             end();
         }
     });
 }