using System; using System.Collections; using System.Collections.Generic; using UnityEngine; namespace SHINT.UI { public class UI_NameAndValue : MonoBehaviour { public TMPro.TextMeshProUGUI title; public TMPro.TextMeshProUGUI value; public override void AfterAwake() { title.SetText(name); SetValue(null); } public void SetValue(string value) { if (String.IsNullOrEmpty(value)) { value = "-"; } else if (value.Contains(".")) { if (double.TryParse(value, out double fValue)) { fValue = Math.Round(fValue, 3); value = fValue.ToString("0.00"); } } this.value.SetText(value); } } }