24 lines
555 B
C#
24 lines
555 B
C#
using UnityEngine;
|
|
using UnityEngine.UI;
|
|
|
|
public class ProgressSlider : MonoBehaviour
|
|
{
|
|
public Slider SlUpdateProgress;
|
|
public Text TextUpdateProgress;
|
|
|
|
public void SetUpdateProgress(float value)
|
|
{
|
|
if (value == 0 || value >= 1) { SetActive(false); }
|
|
else
|
|
{
|
|
SetActive(true);
|
|
SlUpdateProgress.value = value;
|
|
TextUpdateProgress.text = $"{Mathf.Round(value * 10000) / 100}%";
|
|
}
|
|
}
|
|
|
|
public void SetActive(bool active)
|
|
{
|
|
gameObject.SetActive(active);
|
|
}
|
|
} |