上海虹口龙之梦项目
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.
 
 
 
 

45 lines
1.3 KiB

using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
public class GongShuiNengLiCalculation : MonoBehaviour
{
public Text QResult;
public Text NResult;
public InputField DInput;
public InputField VInput;
public InputField QInput;
public void OnCalculation()
{
if (DInput.text != string.Empty && VInput.text != string.Empty&&QInput.text!=string.Empty)
{
var result1 = Math.Pow(float.Parse(DInput.text) / 25, 2);
result1 = 0.5f * result1 * float.Parse(VInput.text);
//var result2 = result1.ToString("F2");
var result = $"<color=red>{ Math.Round(result1, 4)}</color>";
QResult.text = $" = {result}(L/s)";
var result3 = result1 / float.Parse(QInput.text);
var result4 = Math.Ceiling(result3).ToString();
result4 = $"<color=red>{result4}</color>";
NResult.text = $" = {result4}(辆)";
}
else
{
MessageBox.Show("参数不能为空!", Color.red, 2f);
}
}
public void OnClear()
{
QResult.text = string.Empty;
NResult.text = string.Empty;
DInput.text = string.Empty;
VInput.text = string.Empty;
QInput.text = string.Empty;
}
}