using System; using UnityEngine; using UnityEngine.UI; public class YongShuiLiangCalculation : MonoBehaviour { public Text QResult; public InputField AInput; public InputField QInput; private void Start() { //Debug.Log(Math.Ceiling(6.5)); } // Start is called before the first frame update public void OnCalculation() { if (AInput.text != string.Empty && QInput.text != string.Empty) { var result = (float.Parse(AInput.text) * float.Parse(QInput.text)).ToString(); result = $"{result}"; QResult.text = $" = {result}(L/s)"; } else { MessageBox.Show("参数不能为空!", Color.red, 2f); } } public void OnClear() { QResult.text = string.Empty; AInput.text = string.Empty; QInput.text = string.Empty; } }