You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
38 lines
912 B
38 lines
912 B
1 year ago
|
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 = $"<color=red>{result}</color>";
|
||
|
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;
|
||
|
}
|
||
|
}
|