Files
SVSimServer/SVSim.BattleEngine/Engine/FadeUtility.cs

31 lines
756 B
C#

using System;
using Cute;
using UnityEngine;
public class FadeUtility
{
private static readonly AnimationCurve FADE_ALPHA_ANIM_CURVE = AnimationCurve.Linear(0f, 0f, 1f, 1f);
public static void FadeOutObject(UITweenAlpha tweenAlpha, Action onFinish = null)
{
if (!(tweenAlpha == null))
{
if (tweenAlpha._curve == null)
{
tweenAlpha._curve = FADE_ALPHA_ANIM_CURVE;
tweenAlpha._curve.postWrapMode = WrapMode.Once;
tweenAlpha._curve.preWrapMode = WrapMode.Once;
}
tweenAlpha._from = 1f;
tweenAlpha._to = 0f;
tweenAlpha._endTime = 0.3f;
tweenAlpha._delayTime = 0f;
tweenAlpha._finishCallBack = delegate
{
onFinish.Call();
};
tweenAlpha.PlayForward(isReset: true);
}
}
}