Exemplo n.º 1
0
 /// <summary>
 /// 输出文字为 XXX100.00%
 /// </summary>
 /// <param name="now"></param>
 /// <param name="max"></param>
 /// <param name="leftStr"></param>
 /// <param name="baseNumStr">小数点后保留n位数字的格式字符,如0.00则保留2位</param>
 public void SetProgressValue3(float now, float max, string leftStr = "", string baseNumStr = "0.00")
 {
     lbl      = lbl ?? DisplayUtil.getChildObjByName(transform, "Label").GetComponent <UILabel>();
     value    = now / max;
     lbl.text = leftStr + (value * 100).ToString(baseNumStr) + "%";
 }
Exemplo n.º 2
0
 /// <summary>
 /// 输出文字为 XXX10/100  (int) lbl部分的数字可以超出最大范围
 /// </summary>
 /// <param name="now"></param>
 /// <param name="max"></param>
 /// <param name="leftStr"></param>
 public void SetProgressValue4(float now, float max, string leftStr = "")
 {
     lbl      = lbl ?? DisplayUtil.getChildObjByName(transform, "Label").GetComponent <UILabel>();
     value    = now / max;
     lbl.text = leftStr + (int)now + "/" + (int)max;
 }
Exemplo n.º 3
0
 /// <summary>
 /// 输出文字为 XXX100%
 /// </summary>
 /// <param name="now"></param>
 /// <param name="max"></param>
 /// <param name="leftStr"></param>
 public void SetProgressValue2(float now, float max, string leftStr = "")
 {
     lbl      = lbl ?? DisplayUtil.getChildObjByName(transform, "Label").GetComponent <UILabel>();
     value    = now / max;
     lbl.text = leftStr + Mathf.RoundToInt(value * 100f) + "%";
 }