using System; using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.UI; public class ShuiQiangCalculation : MonoBehaviour { public Text NResult; public InputField AInput; public InputField FInput; 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 && FInput.text != string.Empty) { var res = (float.Parse(AInput.text) / float.Parse(FInput.text)); var result = Math.Ceiling(res).ToString(); result = $"{result}"; NResult.text = $" = {result}(支)"; } else { MessageBox.Show("参数不能为空!", Color.red, 2f); } } public void OnClear() { NResult.text = string.Empty; AInput.text = string.Empty; FInput.text = string.Empty; } }