|
@@ -52,6 +52,16 @@ public class HotPointData
|
|
|
public string name_pri;
|
|
|
}
|
|
|
|
|
|
+
|
|
|
+[System.Serializable]
|
|
|
+public class SWStationRecordData
|
|
|
+{
|
|
|
+ public string name;
|
|
|
+ public string time;
|
|
|
+ public float value;
|
|
|
+ public int dir;
|
|
|
+}
|
|
|
+
|
|
|
public class YZTLayer : YZTRootLayer
|
|
|
{
|
|
|
public VerticalLayoutGroup content;
|
|
@@ -96,7 +106,13 @@ public class YZTLayer : YZTRootLayer
|
|
|
|
|
|
public Sprite[] sprites;
|
|
|
|
|
|
+ public Text rainText;
|
|
|
+ public Text[] rainTextNum;
|
|
|
|
|
|
+ public GameObject thingPrefab;
|
|
|
+ public RectTransform thingParent;
|
|
|
+ public List<SWStationRecordData> rescordSWStationData = new List<SWStationRecordData>();
|
|
|
+ public List<GameObject> thing3s = new List<GameObject>();
|
|
|
// Start is called before the first frame update
|
|
|
async void Awake()
|
|
|
{
|
|
@@ -107,6 +123,8 @@ public class YZTLayer : YZTRootLayer
|
|
|
InitLayerInfo();
|
|
|
InitLayerBtns();
|
|
|
InitReturnBtn();
|
|
|
+ InitRainInfo();
|
|
|
+ InitSWHeightInfo();
|
|
|
await InitPointData();
|
|
|
InitPoint();
|
|
|
|
|
@@ -125,6 +143,142 @@ public class YZTLayer : YZTRootLayer
|
|
|
|
|
|
}
|
|
|
|
|
|
+ async void InitSWHeightInfo() {
|
|
|
+ await new WaitUntil(() => {
|
|
|
+ return GlobalData.swDatas.Count > 0;
|
|
|
+ });
|
|
|
+ if (rescordSWStationData.Count < 1)
|
|
|
+ {
|
|
|
+ for (int i = 0; i < GlobalData.swDatas.Count; i++) {
|
|
|
+ SWStationRecordData sWStationRecordData = new SWStationRecordData();
|
|
|
+ sWStationRecordData.dir = 0;
|
|
|
+ sWStationRecordData.name = GlobalData.swDatas[i].STNM;
|
|
|
+ sWStationRecordData.value = (GlobalData.swDatas[i].upz > GlobalData.swDatas[i].dwz)?GlobalData.swDatas[i].upz:GlobalData.swDatas[i].dwz;
|
|
|
+ sWStationRecordData.time = DateTime.Now.ToString("MM/dd HH:mm");
|
|
|
+ rescordSWStationData.Add(sWStationRecordData);
|
|
|
+ }
|
|
|
+
|
|
|
+ for (int i = 0; i < rescordSWStationData.Count; i++)
|
|
|
+ {
|
|
|
+ GameObject obj = Instantiate(thingPrefab);
|
|
|
+ obj.GetComponent<RectTransform>().SetParent(thingParent);
|
|
|
+ obj.transform.localScale = Vector3.one;
|
|
|
+ obj.transform.GetChild(0).GetComponent<Text>().text = (i + 1).ToString();
|
|
|
+ obj.transform.GetChild(1).GetComponent<Text>().text = rescordSWStationData[i].name.ToString();
|
|
|
+ obj.transform.GetChild(2).GetComponent<Text>().text = rescordSWStationData[i].time.ToString();
|
|
|
+ obj.transform.GetChild(3).GetComponent<Text>().text = rescordSWStationData[i].value.ToString();
|
|
|
+ if (rescordSWStationData[i].dir == 0)
|
|
|
+ {
|
|
|
+ obj.transform.GetChild(4).localEulerAngles = new Vector3(0, 0, 0);
|
|
|
+ }
|
|
|
+ else if (rescordSWStationData[i].dir == 1)
|
|
|
+ {
|
|
|
+ obj.transform.GetChild(4).localEulerAngles = new Vector3(0, 0, 90);
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ obj.transform.GetChild(4).localEulerAngles = new Vector3(0, 0, -90);
|
|
|
+ }
|
|
|
+ thing3s.Add(obj);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ for (int i = 0; i < GlobalData.swDatas.Count; i++)
|
|
|
+ {
|
|
|
+ rescordSWStationData[i].name = GlobalData.swDatas[i].STNM;
|
|
|
+ float lastValue = rescordSWStationData[i].value;
|
|
|
+ rescordSWStationData[i].value = (GlobalData.swDatas[i].upz > GlobalData.swDatas[i].dwz) ? GlobalData.swDatas[i].upz : GlobalData.swDatas[i].dwz;
|
|
|
+ rescordSWStationData[i].time = DateTime.Now.ToString("MM/dd HH:mm");
|
|
|
+ if (rescordSWStationData[i].value > lastValue)
|
|
|
+ {
|
|
|
+ rescordSWStationData[i].dir = 1;
|
|
|
+ }
|
|
|
+ else if (rescordSWStationData[i].value > lastValue)
|
|
|
+ {
|
|
|
+ rescordSWStationData[i].dir = 0;
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ rescordSWStationData[i].dir = -1;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ for (int i = 0; i < rescordSWStationData.Count; i++)
|
|
|
+ {
|
|
|
+ thing3s[i].transform.GetChild(0).GetComponent<Text>().text = (i + 1).ToString();
|
|
|
+ thing3s[i].transform.GetChild(1).GetComponent<Text>().text = rescordSWStationData[i].name.ToString();
|
|
|
+ thing3s[i].transform.GetChild(2).GetComponent<Text>().text = rescordSWStationData[i].time.ToString();
|
|
|
+ thing3s[i].transform.GetChild(3).GetComponent<Text>().text = rescordSWStationData[i].value.ToString();
|
|
|
+ if (rescordSWStationData[i].dir == 0)
|
|
|
+ {
|
|
|
+ thing3s[i].transform.GetChild(4).localEulerAngles = new Vector3(0, 0, 0);
|
|
|
+ }
|
|
|
+ else if (rescordSWStationData[i].dir == 1)
|
|
|
+ {
|
|
|
+ thing3s[i].transform.GetChild(4).localEulerAngles = new Vector3(0, 0, 90);
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ thing3s[i].transform.GetChild(4).localEulerAngles = new Vector3(0, 0, -90);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ async void InitRainInfo() {
|
|
|
+ await new WaitUntil(() => {
|
|
|
+ return GlobalData.qXZDatas.Count > 0;
|
|
|
+ });
|
|
|
+ int qxzCount = GlobalData.qXZDatas.Count;
|
|
|
+ string maxName = "";
|
|
|
+ float maxValue = -99f;
|
|
|
+ int value010 = 0;
|
|
|
+ int value1025 = 0;
|
|
|
+ int value2550 = 0;
|
|
|
+ int value50100 = 0;
|
|
|
+ int value100200 = 0;
|
|
|
+ int value200 = 0;
|
|
|
+ for (int i = 0; i < qxzCount; i++) {
|
|
|
+ float value = GlobalData.qXZDatas[i].dropSum6;
|
|
|
+ if (value > maxValue) {
|
|
|
+
|
|
|
+ maxValue = value;
|
|
|
+ maxName = GlobalData.qXZDatas[i].STNM;
|
|
|
+ }
|
|
|
+ if (value >= 0 && value < 10)
|
|
|
+ {
|
|
|
+ value010++;
|
|
|
+ }
|
|
|
+ else if (value >= 10 && value < 25)
|
|
|
+ {
|
|
|
+ value1025++;
|
|
|
+ }
|
|
|
+ else if (value >= 25 && value < 50)
|
|
|
+ {
|
|
|
+ value2550++;
|
|
|
+ }
|
|
|
+ else if (value >= 50 && value < 100)
|
|
|
+ {
|
|
|
+ value50100++;
|
|
|
+ }
|
|
|
+ else if (value >= 100 && value < 200)
|
|
|
+ {
|
|
|
+ value100200++;
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ value200++;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ rainText.text = $"数据时间:17日12时至18日12时(过去24小时)\r\n蓄洪区共有{qxzCount}个雨量站,其中几个雨量站监测有降雨最大降雨测站为{maxName}站点,降雨量{maxValue}mm.";
|
|
|
+ rainTextNum[0].text = value010.ToString();
|
|
|
+ rainTextNum[1].text = value1025.ToString();
|
|
|
+ rainTextNum[2].text = value2550.ToString();
|
|
|
+ rainTextNum[3].text = value50100.ToString();
|
|
|
+ rainTextNum[4].text = value100200.ToString();
|
|
|
+ rainTextNum[5].text = value200.ToString();
|
|
|
+ }
|
|
|
+
|
|
|
void InitLayerInfo() {
|
|
|
|
|
|
Button[] btns = layerInfo.GetComponentsInChildren<Button>();
|
|
@@ -160,7 +314,12 @@ public class YZTLayer : YZTRootLayer
|
|
|
for (int i = 0; i < leftContent.childCount; i++) {
|
|
|
leftContent.transform.GetChild(i).gameObject.SetActive(false);
|
|
|
}
|
|
|
+
|
|
|
leftContent.transform.GetChild(index).gameObject.SetActive(true);
|
|
|
+
|
|
|
+ if (index == 1) {
|
|
|
+ InitSWHeightInfo();
|
|
|
+ }
|
|
|
}
|
|
|
void InitLayerBtns()
|
|
|
{
|