JiNanCementPlantForUnity/Assets/Scripts/UITIP.cs

97 lines
3.8 KiB
C#

using System.Collections;
using System.Collections.Generic;
using TMPro;
using UnityEngine;
using UnityEngine.UI;
public enum TipType
{
None,
,
,
}
public class UITIP : MonoBehaviour
{
public TipType type;
public string Message;
// Start is called before the first frame update
void Start()
{
GameObject go = GameObject.Find("Canvas/FloatingTip");
GetComponentInChildren<Button>().onClick.AddListener(() =>
{
switch (type)
{
case TipType.None:
break;
case TipType.:
go.transform.Find("水").gameObject.SetActive(true);
go.transform.Find("水/Name").GetComponent<TextMeshProUGUI>().text = Message;
WaterData wd = new WaterData();
ServerPort.Instance.GetWater(Message, g =>
{
go.transform.Find("水").GetComponent<UITIPData>().Datas.Clear();
go.transform.Find("水").GetComponent<UITIPData>().Datas.Add(g.data[0].Water.ToString());
go.transform.Find("水").GetComponent<UITIPData>().Datas.Add(g.data[0].OutletPressure.ToString());
go.transform.Find("水").GetComponent<UITIPData>().Datas.Add(g.data[0].Speed.ToString());
go.transform.Find("水").GetComponent<UITIPData>().Datas.Add(g.data[0].State.ToString());
go.transform.Find("水").GetComponent<UITIPData>().DatShow();
});
break;
case TipType.:
go.transform.Find("电").gameObject.SetActive(true);
go.transform.Find("电/Name").GetComponent<TextMeshProUGUI>().text = Message;
ElectricityData ed = new ElectricityData();
ServerPort.Instance.GetElectricity(Message, g =>
{
go.transform.Find("电").GetComponent<UITIPData>().Datas.Clear();
go.transform.Find("电").GetComponent<UITIPData>().Datas.Add(g.data[0].EH.ToString());
go.transform.Find("电").GetComponent<UITIPData>().Datas.Add(g.data[0].State.ToString());
go.transform.Find("电").GetComponent<UITIPData>().Datas.Add(g.data[0].P.ToString());
go.transform.Find("电").GetComponent<UITIPData>().DatShow();
});
break;
case TipType.:
go.transform.Find("煤").gameObject.SetActive(true);
go.transform.Find("煤/Name").GetComponent<TextMeshProUGUI>().text = Message;
//if (Message == "3号线煤磨")
//{
// go.transform.Find("煤/videoBtn").gameObject.SetActive(true);
//}
CoalData cd = new CoalData();
ServerPort.Instance.GetCoal(Message, g =>
{
go.transform.Find("煤").GetComponent<UITIPData>().Datas.Clear();
go.transform.Find("煤").GetComponent<UITIPData>().Datas.Add(g.data[0].Coal.ToString());
go.transform.Find("煤").GetComponent<UITIPData>().Datas.Add(g.data[0].State.ToString());
go.transform.Find("煤").GetComponent<UITIPData>().Datas.Add(g.data[0].Carbon.ToString());
go.transform.Find("煤").GetComponent<UITIPData>().DatShow();
});
break;
default:
break;
}
});
}
/// <summary>
/// 对接后端参数
/// </summary>
public void xxx()
{
}
public void BtnClick()
{
}
// Update is called once per frame
void Update()
{
}
}