This repository has been archived on 2026-01-20. You can view files and clone it. You cannot open issues or pull requests or push a commit.
Files
SH-INT/Assets/Scripts/UI_NameAndValue.cs
정영민 f4cf556cde update
2025-02-20 10:30:18 +09:00

38 lines
890 B
C#

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);
}
}
}