You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
49 lines
1.0 KiB
49 lines
1.0 KiB
9 months ago
|
using System;
|
||
|
using System.Collections;
|
||
|
using System.Collections.Generic;
|
||
|
using UnityEngine;
|
||
|
using UnityEngine.UI;
|
||
|
|
||
|
public class JDLoad : MonoBehaviour
|
||
|
{
|
||
|
public GameObject tip;
|
||
|
public GameObject canvas;
|
||
|
public JDTLoad jdt;
|
||
|
public Text jd1;
|
||
|
public Text jd2;
|
||
|
public Text StateInfo;
|
||
|
public Image img;
|
||
|
public Button btn;
|
||
|
private int id = 0;
|
||
|
|
||
|
private void Awake()
|
||
|
{
|
||
|
StartCoroutine(Load());
|
||
|
btn.onClick.AddListener(() =>
|
||
|
{
|
||
|
tip.SetActive(true);
|
||
|
jdt.Load();
|
||
|
canvas.SetActive(false);
|
||
|
});
|
||
|
}
|
||
|
|
||
|
IEnumerator Load()
|
||
|
{
|
||
|
while (id < 100)
|
||
|
{
|
||
|
float t = (float)8 / 100;
|
||
|
yield return new WaitForSeconds(t);
|
||
|
id++;
|
||
|
jd1.text = id.ToString();
|
||
|
jd2.text = id.ToString();
|
||
|
img.fillAmount = (float)id / 100;
|
||
|
if (id >= 80)
|
||
|
{
|
||
|
StateInfo.text = "检测到问题";
|
||
|
}
|
||
|
}
|
||
|
btn.gameObject.SetActive(true);
|
||
|
|
||
|
}
|
||
|
}
|