45 lines
1.1 KiB
C#
45 lines
1.1 KiB
C#
using System.Collections;
|
||
using System.Collections.Generic;
|
||
using UnityEngine;
|
||
using UnityEngine.UI;
|
||
//============================================================
|
||
//支持中文,文件使用UTF-8编码
|
||
//@author Adam
|
||
//@create 20240711
|
||
//@company Adam
|
||
//
|
||
//@description:
|
||
//============================================================
|
||
namespace Components
|
||
{
|
||
public class EndToQuitAPP : MonoBehaviour
|
||
{
|
||
public float endQuitTime = 10f;
|
||
public bool isEnd = false;
|
||
public Text tips;
|
||
public Image circle;
|
||
private void OnEnable()
|
||
{
|
||
isEnd = true;
|
||
}
|
||
|
||
private void Update()
|
||
{
|
||
if (isEnd)
|
||
{
|
||
endQuitTime -= Time.deltaTime;
|
||
circle.fillAmount = Mathf.Lerp(0, 1, endQuitTime / 10f);
|
||
if (endQuitTime < 0)
|
||
{
|
||
endQuitTime = 0;
|
||
circle.fillAmount = 0;
|
||
Application.Quit();
|
||
isEnd = false;
|
||
}
|
||
tips.text = $"{endQuitTime.ToString("0")}<size=30>s</size>";
|
||
}
|
||
}
|
||
|
||
}
|
||
}
|