FiE-Game/src/Fie.Fader/FieFader.cs

65 lines
1.3 KiB
C#
Raw Normal View History

2018-11-20 20:10:49 +01:00
using Fie.Utility;
using Spine.Unity;
using UnityEngine;
using UnityEngine.UI;
namespace Fie.Fader
{
public class FieFader : MonoBehaviour
{
[SerializeField]
private GameObject faderCameraRootObject;
[SerializeField]
private Image faderPlaneObject;
[SerializeField]
private SkeletonGraphic _loadingIcon;
private Tweener<TweenTypesInOutSine> faderTweener = new Tweener<TweenTypesInOutSine>();
private bool isDrawFader;
public void Initialize()
{
faderCameraRootObject.transform.gameObject.SetActive(value: false);
}
public void HideFader()
{
isDrawFader = false;
faderCameraRootObject.transform.gameObject.SetActive(value: false);
}
public void InitFader(Vector4 startColor, Vector4 endColor, float time)
{
isDrawFader = true;
faderTweener.InitTweener(time, startColor, endColor);
faderCameraRootObject.transform.gameObject.SetActive(value: true);
}
public bool IsEndUpdateFader()
{
return faderTweener == null || faderTweener.IsEnd();
}
private void Update()
{
if (isDrawFader)
{
Color color = faderTweener.UpdateParameterVec4(Time.deltaTime);
faderPlaneObject.color = color;
_loadingIcon.color = new Color(1f, 1f, 1f, color.a);
}
}
public void ShowLoadScreen()
{
}
public void HideLoadScreen()
{
}
}
}