UIWidgetExtensions.cs 517 B

12345678910111213141516
  1. using UnityEngine;
  2. using System.Collections;
  3. using System;
  4. public static class UIWidgetExtensions
  5. {
  6. public static void FadeTo(this UIWidget widget, float newAlpha, float time = 1, float delay = 0, Action onComplete = null, MyTween.Loop loopType = MyTween.Loop.none, int numOfLoops = 0)
  7. {
  8. widget.ValueTo(widget.alpha, newAlpha, time, widget.OnUpdate, delay, MyTween.Ease.linear, onComplete, loopType, numOfLoops);
  9. }
  10. static void OnUpdate(this UIWidget widget, float newAlpha)
  11. {
  12. widget.alpha = newAlpha;
  13. }
  14. }