54 lines
1.1 KiB
C#
54 lines
1.1 KiB
C#
using UnityEngine.UI;
|
|
using UnityEngine;
|
|
|
|
public class NativeUpdateUI : MonoBehaviour
|
|
{
|
|
Text _message;
|
|
Slider _slider;
|
|
// Start is called before the first frame update
|
|
public void Awake()
|
|
{
|
|
_message = transform.Find("BG/Message").GetComponent<Text>();
|
|
_slider = transform.Find("BG/Slider").GetComponent<Slider>();
|
|
}
|
|
|
|
// 每次显示都执行, 可定义参数
|
|
public void Show(params object[] _params)
|
|
{
|
|
//base.Show(_params);
|
|
|
|
if (_params == null)
|
|
return;
|
|
|
|
if (_params.Length == 2)
|
|
{
|
|
SetProValue((float)_params[0]);
|
|
SetMessage((string)_params[1]);
|
|
}
|
|
else if (_params.Length == 1)
|
|
{
|
|
SetMessage((string)_params[0]);
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// 范围 0-1
|
|
/// </summary>
|
|
/// <param name="pValue"></param>
|
|
private void SetProValue(float pValue)
|
|
{
|
|
_slider.value = pValue;
|
|
}
|
|
|
|
private void SetMessage(string pValue)
|
|
{
|
|
_message.text = pValue;
|
|
}
|
|
|
|
public void RefreshPregress(string message, float v)
|
|
{
|
|
_message.text = message;
|
|
_slider.value = v;
|
|
}
|
|
}
|