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.
34 lines
999 B
34 lines
999 B
4 years ago
|
using System;
|
||
|
using System.Collections;
|
||
|
using System.Collections.Generic;
|
||
|
using UnityEngine;
|
||
|
using UnityEngine.UI;
|
||
|
/// <summary>
|
||
|
/// 获取到场水量
|
||
|
/// </summary>
|
||
|
public class GetAllWater : MonoBehaviour {
|
||
|
private IntData data = new IntData(0);
|
||
|
public static event Func<IntData, IntData> getAllWaterAmount;
|
||
|
private void OnEnable()
|
||
|
{
|
||
|
data.Clear();
|
||
|
if(getAllWaterAmount != null)
|
||
|
{
|
||
|
data = getAllWaterAmount(data);
|
||
|
}
|
||
|
//GetComponent<Text>().text = data.value.ToString() + "L";
|
||
|
|
||
|
//因为TrukMessage中MyCarMessage实例里的载水量,载泡沫量默认单位为吨,所以以下转换是错误的
|
||
|
//if (data.value < 1000)
|
||
|
//{
|
||
|
// GetComponent<Text>().text = data.value.ToString() + "L";
|
||
|
//}
|
||
|
//else
|
||
|
//{
|
||
|
// GetComponent<Text>().text = (data.value / 1000).ToString() + "T";
|
||
|
//}
|
||
|
|
||
|
GetComponent<Text>().text = data.value.ToString() + "T";
|
||
|
}
|
||
|
}
|