using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.UI; using static UnityEngine.Rendering.DebugUI; public class ProcessTipPanel : MonoBehaviour { public Image image; /// /// 是否启用进度 /// private bool isCheck=false; /// /// 当前进入 /// private float currentProcess=0; /// /// 是否结束 /// private bool isOver=false; /// /// 设置进度 /// /// 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); } } } /// /// 核对记录成功 /// private void ThisDestroy() { Debug.Log("核对和抄录完成!"); Destroy(gameObject); } }