using System.Collections.Generic;
|
using UnityEngine;
|
using UnityEngine.UI;
|
using DG.Tweening;
|
|
/**
|
* 游戏结束面板
|
* @Author: chenxin
|
* @Date: 2020-12-11 21:27:12
|
*/
|
namespace KTGMGemClient
|
{
|
public class GameOverPanel : MonoBehaviour
|
{
|
[SerializeField]
|
private Image bg;
|
|
[SerializeField]
|
private List<Image> imgList;
|
|
private float duration = 0.1f;
|
|
// Start is called before the first frame update
|
private void Start()
|
{
|
Sequence sequence = DOTween.Sequence();
|
sequence.Append(DOTween.To(
|
() => bg.color,
|
(Color v) => bg.color = v,
|
new Color(0f, 0f, 0f, 170f / 255f),
|
0.3f));
|
|
sequence.Join(DOTween.To(
|
() => imgList[0].transform.localPosition.y,
|
(float v) =>
|
{
|
Vector3 pos = imgList[0].transform.localPosition;
|
pos.y = v;
|
imgList[0].transform.localPosition = pos;
|
},
|
346f,
|
0.8f)
|
.SetEase(Ease.OutBounce)
|
);
|
|
sequence.Join(DOTween.To(
|
() => imgList[1].transform.localPosition.y,
|
(float v) =>
|
{
|
Vector3 pos = imgList[1].transform.localPosition;
|
pos.y = v;
|
imgList[1].transform.localPosition = pos;
|
},
|
346f,
|
0.8f)
|
.SetEase(Ease.OutBounce)
|
.SetDelay(1 * duration)
|
);
|
|
sequence.Join(DOTween.To(
|
() => imgList[2].transform.localPosition.y,
|
(float v) =>
|
{
|
Vector3 pos = imgList[2].transform.localPosition;
|
pos.y = v;
|
imgList[2].transform.localPosition = pos;
|
},
|
346f,
|
0.8f)
|
.SetEase(Ease.OutBounce)
|
.SetDelay(2 * duration)
|
);
|
|
sequence.Join(DOTween.To(
|
() => imgList[3].transform.localPosition.y,
|
(float v) =>
|
{
|
Vector3 pos = imgList[3].transform.localPosition;
|
pos.y = v;
|
imgList[3].transform.localPosition = pos;
|
},
|
346f,
|
0.8f)
|
.SetEase(Ease.OutBounce)
|
.SetDelay(3 * duration)
|
.OnComplete(() =>
|
{
|
EventCenter.Ins.BroadCast((int)KTGMGemClient.EventType.GameOverEnd);
|
Destroy(gameObject);
|
})
|
);
|
}
|
}
|
}
|