81 lines
2.0 KiB
C#
81 lines
2.0 KiB
C#
using System;
|
|
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using DarkTonic.MasterAudio;
|
|
using DG.Tweening;
|
|
using DragonLi.Core;
|
|
using UnityEngine;
|
|
using UnityEngine.UI;
|
|
using Valheim;
|
|
using XUI;
|
|
|
|
public class TransitionPanel : UIBehaviour
|
|
{
|
|
// public Image black;
|
|
public Image white;
|
|
|
|
public CanvasGroup logo;
|
|
|
|
public static TransitionPanel Ins;
|
|
|
|
public Action cb;
|
|
|
|
public static void Show()
|
|
{
|
|
OverlayUIManager.Ins.Overlay("UI/TransitionPanel", false);
|
|
}
|
|
|
|
public override void OnUIShow(params object[] args)
|
|
{
|
|
base.OnUIShow(args);
|
|
logo.alpha = 0;
|
|
logo.DOFade(1, 1f);
|
|
MonoSingleton<CoroutineTaskManager>.Instance.WaitSecondTodo(() =>
|
|
{
|
|
logo.DOFade(0, 1f);
|
|
},1f);
|
|
}
|
|
|
|
public void Start()
|
|
{
|
|
Ins = this;
|
|
}
|
|
|
|
public void WhiteFadeIn(Action cb = null)
|
|
{
|
|
white.gameObject.SetActive(true);
|
|
Color currentColor = new Color(1, 1, 1, 0);
|
|
white.color = currentColor;
|
|
DOVirtual.Float(currentColor.a, 1, 0.8f, (alpha) =>
|
|
{
|
|
white.color = new Color(currentColor.r, currentColor.g, currentColor.b, alpha);
|
|
})
|
|
.SetEase(Ease.Linear)
|
|
.OnComplete(() =>
|
|
{
|
|
cb?.Invoke();
|
|
});
|
|
}
|
|
|
|
public void WhiteFadeOut(Action cb = null)
|
|
{
|
|
white.gameObject.SetActive(false);
|
|
cb?.Invoke();
|
|
return;
|
|
gameObject.SetActive(true);
|
|
white.gameObject.SetActive(true);
|
|
Color currentColor = new Color(1, 1, 1, 1);
|
|
white.color = currentColor;
|
|
DOVirtual.Float(currentColor.a, 0, 0.8f, (alpha) =>
|
|
{
|
|
white.color = new Color(currentColor.r, currentColor.g, currentColor.b, alpha);
|
|
})
|
|
.SetEase(Ease.Linear)
|
|
.OnComplete(() =>
|
|
{
|
|
Debug.Log("白光结束");
|
|
white.gameObject.SetActive(false);
|
|
cb?.Invoke();
|
|
});
|
|
}
|
|
} |