74 lines
1.6 KiB
C#
74 lines
1.6 KiB
C#
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
using UnityEngine.UI;
|
|
using static UnityEngine.Rendering.DebugUI;
|
|
|
|
public class ProcessTipPanel : MonoBehaviour
|
|
{
|
|
public Image image;
|
|
/// <summary>
|
|
/// 是否启用进度
|
|
/// </summary>
|
|
private bool isCheck=false;
|
|
/// <summary>
|
|
/// 当前进入
|
|
/// </summary>
|
|
private float currentProcess=0;
|
|
/// <summary>
|
|
/// 是否结束
|
|
/// </summary>
|
|
private bool isOver=false;
|
|
|
|
|
|
/// <summary>
|
|
/// 设置进度
|
|
/// </summary>
|
|
/// <param name="value"></param>
|
|
public void SetProcess(bool ischeck)
|
|
{
|
|
this.isCheck = ischeck;
|
|
if(!ischeck )
|
|
{
|
|
currentProcess = 0;
|
|
image.fillAmount = currentProcess;
|
|
}
|
|
else
|
|
{
|
|
Debug.Log("开始核对和抄录");
|
|
}
|
|
}
|
|
|
|
void Update()
|
|
{
|
|
if (!isOver)
|
|
{
|
|
if (isCheck)
|
|
{
|
|
currentProcess = Mathf.Clamp01(currentProcess + Time.deltaTime * 0.1f);
|
|
image.fillAmount = currentProcess;
|
|
if (currentProcess == 1)
|
|
{
|
|
isOver = true;
|
|
Invoke("ThisDestroy", 2);
|
|
}
|
|
}
|
|
|
|
if (Input.GetMouseButtonUp(0))
|
|
{
|
|
SetProcess(false);
|
|
isOver = true;
|
|
Destroy(gameObject);
|
|
}
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// 核对记录成功
|
|
/// </summary>
|
|
private void ThisDestroy()
|
|
{
|
|
Debug.Log("核对和抄录完成!");
|
|
Destroy(gameObject);
|
|
}
|
|
} |