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.
62 lines
1.6 KiB
62 lines
1.6 KiB
4 years ago
|
using System;
|
||
|
using System.Collections;
|
||
|
using System.Collections.Generic;
|
||
|
using UnityEngine;
|
||
|
using UnityEngine.UI;
|
||
|
|
||
|
public class PowerTransferItem : MonoBehaviour
|
||
|
{
|
||
|
public FireCarEngine MyData;
|
||
|
public Text CarType;
|
||
|
public Text PeoPleNum;
|
||
|
public Text WaterNum;
|
||
|
public Text DryPowderNum;
|
||
|
public Text FoamNum;
|
||
|
public Text Height;
|
||
|
public Text State;
|
||
|
public Toggle ControlToggle;
|
||
|
|
||
|
private void Start()
|
||
|
{
|
||
|
if (GameSettings.othersSettings.mode == Mode.Practice)
|
||
|
{
|
||
|
ControlToggle.onValueChanged.AddListener(ClearCallNum);
|
||
|
}
|
||
|
}
|
||
|
|
||
|
private void OnDestroy()
|
||
|
{
|
||
|
if (GameSettings.othersSettings.mode == Mode.Practice)
|
||
|
{
|
||
|
ControlToggle.onValueChanged.RemoveListener(ClearCallNum);
|
||
|
}
|
||
|
}
|
||
|
|
||
|
private void ClearCallNum(bool arg0)
|
||
|
{
|
||
|
transform.Find("PoliceCallNum").GetComponent<InputField>().text = "";
|
||
|
}
|
||
|
|
||
|
public void Bind(FireCarEngine data)
|
||
|
{
|
||
|
MyData = data;
|
||
|
CarType.text = data.TypeName;
|
||
|
PeoPleNum.text = data.PassengerCapacity.ToString();
|
||
|
WaterNum.text = data.WaterAmount.ToString();
|
||
|
DryPowderNum.text = data.DryPowderAmount.ToString();
|
||
|
FoamNum.text = data.FoamAmount.ToString();
|
||
|
Height.text = data.Height.ToString();
|
||
|
State.text = (data.IsActive == 0) ? "不可用" : "正常";
|
||
|
if (data.IsActive == 0)
|
||
|
{
|
||
|
if (ControlToggle.isOn)
|
||
|
ControlToggle.isOn = false;
|
||
|
ControlToggle.interactable = false;
|
||
|
}
|
||
|
else
|
||
|
{
|
||
|
ControlToggle.interactable = true;
|
||
|
}
|
||
|
}
|
||
|
}
|