Unity对NGUI控件的扩展
我想扩展进度条使进度条值改变的时候文字改变成 ”当前值/最大值“的样式,下面是我的代码
public class DivideShowLabel : UILabel
{
public void ShowLabelInDivide()
{
var maxValue = 520;
if(UIProgressBar.current == null) return;
var progress = UIProgressBar.current.value;
text = Mathf.RoundToInt(progress * maxValue) + "/" + maxValue;
}
}
我想请问我该如何在方法外面定义一个最大值的变量,如果我在方法外直接定义的话值永远为0.
还有如何让定义的变量显示在面板上?在线等。。。