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.
40 lines
1008 B
40 lines
1008 B
1 year ago
|
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 = $"<color=red>{result}</color>";
|
||
|
NResult.text = $" = {result}(支)";
|
||
|
}
|
||
|
else
|
||
|
{
|
||
|
MessageBox.Show("参数不能为空!", Color.red, 2f);
|
||
|
}
|
||
|
}
|
||
|
|
||
|
public void OnClear()
|
||
|
{
|
||
|
NResult.text = string.Empty;
|
||
|
AInput.text = string.Empty;
|
||
|
FInput.text = string.Empty;
|
||
|
}
|
||
|
}
|