|
@@ -199,24 +199,20 @@ public class GCJKLayer : YZTRootLayer
|
|
|
|
|
|
private InputField _obsSearchInputField;
|
|
|
|
|
|
-
|
|
|
//水位图标
|
|
|
[Header("水位数据")] public GameObject shuiweiIconPrefab;
|
|
|
private List<ShuiWeiIconCtrl> _shuiWeiIconCtrls = new List<ShuiWeiIconCtrl>();
|
|
|
private Transform _shuiWeiIconContent;
|
|
|
- private bool creatShuiWeiIcon = false;
|
|
|
|
|
|
//水压
|
|
|
public GameObject shuiYaIconPrefab;
|
|
|
private List<ShuiYaIconCtrl> _shuiYaIconCtrls = new List<ShuiYaIconCtrl>();
|
|
|
private Transform _shuiYaIconContent;
|
|
|
- private bool creatShuiYaIcon = false;
|
|
|
|
|
|
//位移
|
|
|
public GameObject weiYiIconPrefab;
|
|
|
private List<WeiYiIconCtrl> _weiYiIconCtrls = new List<WeiYiIconCtrl>();
|
|
|
private Transform _weiYiIconContent;
|
|
|
- private bool creatWeiYiIcon = false;
|
|
|
|
|
|
private Toggle obsToggle;
|
|
|
private Toggle shuiWeiToggle;
|
|
@@ -250,6 +246,7 @@ public class GCJKLayer : YZTRootLayer
|
|
|
|
|
|
public GameObject runtimePointObj;
|
|
|
|
|
|
+ private int currentDataType = -1;
|
|
|
|
|
|
private void Awake()
|
|
|
{
|
|
@@ -265,18 +262,12 @@ public class GCJKLayer : YZTRootLayer
|
|
|
{
|
|
|
StaticLod.instance.OnFoucusStatic(0);
|
|
|
|
|
|
- bool waitInitZhaZhanJianKongData = false;
|
|
|
if (GlobalData.buYuanSensorData != null)
|
|
|
{
|
|
|
if (GlobalData.buYuanSensorData.data.Count < 1)
|
|
|
{
|
|
|
await HttpHelper._Instance.SendBuYuan_GetSensorData();
|
|
|
}
|
|
|
-
|
|
|
- if (GlobalData.buYuanSensorData.data.Count > 0)
|
|
|
- {
|
|
|
- waitInitZhaZhanJianKongData = true;
|
|
|
- }
|
|
|
}
|
|
|
|
|
|
if (GlobalData.taoKouSensorData != null)
|
|
@@ -285,16 +276,6 @@ public class GCJKLayer : YZTRootLayer
|
|
|
{
|
|
|
await HttpHelper._Instance.SendTaoKou_GetSensorData();
|
|
|
}
|
|
|
-
|
|
|
- if (GlobalData.taoKouSensorData.data.Count > 0)
|
|
|
- {
|
|
|
- waitInitZhaZhanJianKongData = true;
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- if (waitInitZhaZhanJianKongData)
|
|
|
- {
|
|
|
- SetZhaZhanJianKongData();
|
|
|
}
|
|
|
|
|
|
if (GlobalData.BuYuanShuiWeiDataList.Count < 1)
|
|
@@ -302,35 +283,17 @@ public class GCJKLayer : YZTRootLayer
|
|
|
await HttpHelper._Instance.InitSWYJData();
|
|
|
}
|
|
|
|
|
|
- if (!creatShuiWeiIcon && GlobalData.BuYuanShuiWeiDataList.Count > 0)
|
|
|
- {
|
|
|
- CreatShuiWeiIcon();
|
|
|
- FindShuiWeiTargetObje();
|
|
|
- }
|
|
|
-
|
|
|
if (GlobalData.BuYuanShuiYaDataList.Count < 1)
|
|
|
{
|
|
|
HttpHelper._Instance.GetBuYuanDevicesGroupInfo();
|
|
|
}
|
|
|
|
|
|
- if (!creatShuiYaIcon && GlobalData.BuYuanShuiWeiDataList.Count > 0)
|
|
|
- {
|
|
|
- CreatShuiYaIcon();
|
|
|
- FindShuiYaTargetObje();
|
|
|
- }
|
|
|
-
|
|
|
- if (!creatWeiYiIcon && GlobalData.BuYuanWeiYiDataList.Count > 0)
|
|
|
+ if (GlobalData.TaoKouShuiYaDataList.Count < 1)
|
|
|
{
|
|
|
- CreatWeiYiIcon();
|
|
|
- FindWeiYiTargetObje();
|
|
|
+ HttpHelper._Instance.GetTaoKouDevicesGroupInfo();
|
|
|
}
|
|
|
|
|
|
- SetObsIconActive(obsToggle.isOn);
|
|
|
- SetShuiWeiIconActive(shuiWeiToggle.isOn);
|
|
|
- SetShuiYaIconActive(shuiYaToggle.isOn);
|
|
|
- SetWeiYiIconActive(weiYiToggle.isOn);
|
|
|
-
|
|
|
- SetGongChengLieBiaoData();
|
|
|
+ SetCurrentDataToPanel(0);
|
|
|
}
|
|
|
|
|
|
|
|
@@ -607,6 +570,39 @@ public class GCJKLayer : YZTRootLayer
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+
|
|
|
+ public void SetCurrentDataToPanel(int type)
|
|
|
+ {
|
|
|
+ if (currentDataType == type)
|
|
|
+ {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ currentDataType = type;
|
|
|
+
|
|
|
+ SetZhaZhanJianKongData();
|
|
|
+
|
|
|
+ //水位图标
|
|
|
+ CreatShuiWeiIcon();
|
|
|
+ FindShuiWeiTargetObje();
|
|
|
+
|
|
|
+ //水压图标
|
|
|
+ CreatShuiYaIcon();
|
|
|
+ FindShuiYaTargetObje();
|
|
|
+
|
|
|
+ //位移图标
|
|
|
+ CreatWeiYiIcon();
|
|
|
+ FindWeiYiTargetObje();
|
|
|
+
|
|
|
+ SetObsIconActive(obsToggle.isOn);
|
|
|
+ SetShuiWeiIconActive(shuiWeiToggle.isOn);
|
|
|
+ SetShuiYaIconActive(shuiYaToggle.isOn);
|
|
|
+ SetWeiYiIconActive(weiYiToggle.isOn);
|
|
|
+
|
|
|
+ SetGongChengLieBiaoData();
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
public void SetZhaZhanJianKongData()
|
|
|
{
|
|
|
List<ZhaZhanJianKongData> datas = new List<ZhaZhanJianKongData>();
|
|
@@ -615,7 +611,7 @@ public class GCJKLayer : YZTRootLayer
|
|
|
datas.Add(new ZhaZhanJianKongData()
|
|
|
{
|
|
|
name = "闸门_" + GlobalData.buYuanSensorData.data[i].sensor_id,
|
|
|
- openValue = GlobalData.buYuanSensorData.data[i].opening_degree*0.01f,
|
|
|
+ openValue = GlobalData.buYuanSensorData.data[i].opening_degree * 0.01f,
|
|
|
state = GlobalData.buYuanSensorData.data[i].gate_open
|
|
|
? ZhaZhanState.open
|
|
|
: ZhaZhanState.close,
|
|
@@ -627,7 +623,7 @@ public class GCJKLayer : YZTRootLayer
|
|
|
datas.Add(new ZhaZhanJianKongData()
|
|
|
{
|
|
|
name = "闸门_" + GlobalData.taoKouSensorData.data[i].sensor_id,
|
|
|
- openValue = GlobalData.taoKouSensorData.data[i].opening_degree*0.01f,
|
|
|
+ openValue = GlobalData.taoKouSensorData.data[i].opening_degree * 0.01f,
|
|
|
state = GlobalData.taoKouSensorData.data[i].gate_open
|
|
|
? ZhaZhanState.open
|
|
|
: ZhaZhanState.close,
|
|
@@ -684,7 +680,7 @@ public class GCJKLayer : YZTRootLayer
|
|
|
{
|
|
|
List<GongChengLieBiaoData> datas = new List<GongChengLieBiaoData>();
|
|
|
//水位
|
|
|
- foreach (var tempData in GlobalData.BuYuanShuiWeiDataList)
|
|
|
+ foreach (var tempData in currentDataType==0?GlobalData.BuYuanShuiWeiDataList:GlobalData.TaoKouShuiWeiDataList)
|
|
|
{
|
|
|
GongChengLieBiaoData tempLieBiaoData = new GongChengLieBiaoData();
|
|
|
tempLieBiaoData.name = tempData.name;
|
|
@@ -694,7 +690,7 @@ public class GCJKLayer : YZTRootLayer
|
|
|
}
|
|
|
|
|
|
//水压
|
|
|
- foreach (var tempData in GlobalData.BuYuanShuiYaDataList)
|
|
|
+ foreach (var tempData in currentDataType==0?GlobalData.BuYuanShuiYaDataList:GlobalData.TaoKouShuiYaDataList)
|
|
|
{
|
|
|
GongChengLieBiaoData tempLieBiaoData = new GongChengLieBiaoData();
|
|
|
tempLieBiaoData.name = tempData.name;
|
|
@@ -704,7 +700,7 @@ public class GCJKLayer : YZTRootLayer
|
|
|
}
|
|
|
|
|
|
//位移
|
|
|
- foreach (var tempData in GlobalData.BuYuanWeiYiDataList)
|
|
|
+ foreach (var tempData in currentDataType==0?GlobalData.BuYuanWeiYiDataList:GlobalData.TaoKouWeiYiDataList)
|
|
|
{
|
|
|
GongChengLieBiaoData tempLieBiaoData = new GongChengLieBiaoData();
|
|
|
tempLieBiaoData.name = tempData.name;
|
|
@@ -714,15 +710,7 @@ public class GCJKLayer : YZTRootLayer
|
|
|
}
|
|
|
|
|
|
//监控
|
|
|
- foreach (var tempData in GlobalData.obsDatas_by)
|
|
|
- {
|
|
|
- GongChengLieBiaoData tempLieBiaoData = new GongChengLieBiaoData();
|
|
|
- tempLieBiaoData.name = tempData.name;
|
|
|
- tempLieBiaoData.type = GongChengType.shiPin;
|
|
|
- tempLieBiaoData.state = tempData.status ? GongChengState.normal : GongChengState.warning;
|
|
|
- datas.Add(tempLieBiaoData);
|
|
|
- }
|
|
|
- foreach (var tempData in GlobalData.obsDatas_tk)
|
|
|
+ foreach (var tempData in currentDataType==0?GlobalData.obsDatas_by:GlobalData.obsDatas_tk)
|
|
|
{
|
|
|
GongChengLieBiaoData tempLieBiaoData = new GongChengLieBiaoData();
|
|
|
tempLieBiaoData.name = tempData.name;
|
|
@@ -809,33 +797,46 @@ public class GCJKLayer : YZTRootLayer
|
|
|
//监控列表
|
|
|
public async void CreatObsItem()
|
|
|
{
|
|
|
- await new WaitUntil(() => { return GlobalData.obsDatas_by.Count > 0&& GlobalData.obsDatas_tk.Count>0; });
|
|
|
+ await new WaitUntil(() => { return GlobalData.obsDatas_by.Count > 0 && GlobalData.obsDatas_tk.Count > 0; });
|
|
|
_obsItems = new List<ObsItem>();
|
|
|
_obsIconCtrls = new List<ObsIconCtrl>();
|
|
|
+ for (int i = 0; i < _obsItems.Count; i++)
|
|
|
+ {
|
|
|
+ Destroy(_obsItems[i].gameObject);
|
|
|
+ }
|
|
|
+ for (int i = 0; i < _obsIconCtrls.Count; i++)
|
|
|
+ {
|
|
|
+ Destroy(_obsIconCtrls[i].gameObject);
|
|
|
+ }
|
|
|
//Debug.Log("监控列表数量:"+GlobalData.obsDatas_by.Count);
|
|
|
- for (int i = 0; i < GlobalData.obsDatas_by.Count; i++)
|
|
|
+ if (currentDataType == 0)
|
|
|
{
|
|
|
- ObsItem tempItem = Instantiate(obsItemPrefab, obsItemContent).GetComponent<ObsItem>();
|
|
|
- tempItem.SetData(GlobalData.obsDatas_by[i]);
|
|
|
- _obsItems.Add(tempItem);
|
|
|
- ObsIconCtrl tempIcon = Instantiate(obsIconPrefab, _obsIconContent).GetComponent<ObsIconCtrl>();
|
|
|
- Debug.Log(GlobalData.obsDatas_by[i].name +" "+GlobalData.obsDatas_by[i].targetName);
|
|
|
- tempIcon.Init(GlobalData.obsDatas_by[i]);
|
|
|
- _obsIconCtrls.Add(tempIcon);
|
|
|
- //Debug.Log(StaticLod.instance.GetStaticObj(GlobalData.obsDatas[i].name).gameObject.name);
|
|
|
+ for (int i = 0; i < GlobalData.obsDatas_by.Count; i++)
|
|
|
+ {
|
|
|
+ ObsItem tempItem = Instantiate(obsItemPrefab, obsItemContent).GetComponent<ObsItem>();
|
|
|
+ tempItem.SetData(GlobalData.obsDatas_by[i]);
|
|
|
+ _obsItems.Add(tempItem);
|
|
|
+ ObsIconCtrl tempIcon = Instantiate(obsIconPrefab, _obsIconContent).GetComponent<ObsIconCtrl>();
|
|
|
+ Debug.Log(GlobalData.obsDatas_by[i].name + " " + GlobalData.obsDatas_by[i].targetName);
|
|
|
+ tempIcon.Init(GlobalData.obsDatas_by[i]);
|
|
|
+ _obsIconCtrls.Add(tempIcon);
|
|
|
+ //Debug.Log(StaticLod.instance.GetStaticObj(GlobalData.obsDatas[i].name).gameObject.name);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ //Debug.Log($"创建补元监控对象:{_obsItems.Count} {_obsIconCtrls.Count} {GlobalData.obsDatas_by.Count} {GlobalData.obsDatas_tk.Count}");
|
|
|
+ for (int i = 0; i < GlobalData.obsDatas_tk.Count; i++)
|
|
|
+ {
|
|
|
+ ObsItem tempItem = Instantiate(obsItemPrefab, obsItemContent).GetComponent<ObsItem>();
|
|
|
+ tempItem.SetData(GlobalData.obsDatas_tk[i]);
|
|
|
+ _obsItems.Add(tempItem);
|
|
|
+ ObsIconCtrl tempIcon = Instantiate(obsIconPrefab, _obsIconContent).GetComponent<ObsIconCtrl>();
|
|
|
+ tempIcon.Init(GlobalData.obsDatas_tk[i]);
|
|
|
+ _obsIconCtrls.Add(tempIcon);
|
|
|
+ //Debug.Log(StaticLod.instance.GetStaticObj(GlobalData.obsDatas[i].name).gameObject.name);
|
|
|
+ }
|
|
|
}
|
|
|
- //Debug.Log($"创建补元监控对象:{_obsItems.Count} {_obsIconCtrls.Count} {GlobalData.obsDatas_by.Count} {GlobalData.obsDatas_tk.Count}");
|
|
|
- // for (int i = 0; i < GlobalData.obsDatas_tk.Count; i++)
|
|
|
- // {
|
|
|
- // ObsItem tempItem = Instantiate(obsItemPrefab, obsItemContent).GetComponent<ObsItem>();
|
|
|
- // tempItem.SetData(GlobalData.obsDatas_tk[i]);
|
|
|
- // _obsItems.Add(tempItem);
|
|
|
- // ObsIconCtrl tempIcon = Instantiate(obsIconPrefab, _obsIconContent).GetComponent<ObsIconCtrl>();
|
|
|
- // tempIcon.Init(GlobalData.obsDatas_tk[i]);
|
|
|
- // _obsIconCtrls.Add(tempIcon);
|
|
|
- // //Debug.Log(StaticLod.instance.GetStaticObj(GlobalData.obsDatas[i].name).gameObject.name);
|
|
|
- // }
|
|
|
-
|
|
|
SetObsIconActive(obsToggle.isOn);
|
|
|
}
|
|
|
|
|
@@ -926,16 +927,22 @@ public class GCJKLayer : YZTRootLayer
|
|
|
//水位图标
|
|
|
public void CreatShuiWeiIcon()
|
|
|
{
|
|
|
+ for (int i = 0; i < _shuiWeiIconCtrls.Count; i++)
|
|
|
+ {
|
|
|
+ Destroy(_shuiWeiIconCtrls[i].gameObject);
|
|
|
+ }
|
|
|
+
|
|
|
_shuiWeiIconCtrls = new List<ShuiWeiIconCtrl>();
|
|
|
- for (int i = 0; i < GlobalData.BuYuanShuiWeiDataList.Count; i++)
|
|
|
+
|
|
|
+ var DataList = currentDataType == 0 ? GlobalData.BuYuanShuiWeiDataList : GlobalData.TaoKouShuiWeiDataList;
|
|
|
+ for (int i = 0; i < DataList.Count; i++)
|
|
|
{
|
|
|
ShuiWeiIconCtrl tempIcon =
|
|
|
Instantiate(shuiweiIconPrefab, _shuiWeiIconContent).GetComponent<ShuiWeiIconCtrl>();
|
|
|
- tempIcon.Init(GlobalData.BuYuanShuiWeiDataList[i]);
|
|
|
+ tempIcon.Init(DataList[i]);
|
|
|
_shuiWeiIconCtrls.Add(tempIcon);
|
|
|
}
|
|
|
-
|
|
|
- creatShuiWeiIcon = true;
|
|
|
+ Debug.Log(DataList.Count);
|
|
|
}
|
|
|
|
|
|
//查找场景中的水位坐标对象
|
|
@@ -979,15 +986,20 @@ public class GCJKLayer : YZTRootLayer
|
|
|
//水压图标
|
|
|
public void CreatShuiYaIcon()
|
|
|
{
|
|
|
+ for (int i = 0; i < _shuiYaIconCtrls.Count; i++)
|
|
|
+ {
|
|
|
+ Destroy(_shuiYaIconCtrls[i].gameObject);
|
|
|
+ }
|
|
|
+
|
|
|
_shuiYaIconCtrls = new List<ShuiYaIconCtrl>();
|
|
|
- for (int i = 0; i < GlobalData.BuYuanShuiYaDataList.Count; i++)
|
|
|
+
|
|
|
+ var DataList = currentDataType == 0 ? GlobalData.BuYuanShuiYaDataList : GlobalData.TaoKouShuiYaDataList;
|
|
|
+ for (int i = 0; i < DataList.Count; i++)
|
|
|
{
|
|
|
ShuiYaIconCtrl tempIcon = Instantiate(shuiYaIconPrefab, _shuiYaIconContent).GetComponent<ShuiYaIconCtrl>();
|
|
|
- tempIcon.Init(GlobalData.BuYuanShuiYaDataList[i]);
|
|
|
+ tempIcon.Init(DataList[i]);
|
|
|
_shuiYaIconCtrls.Add(tempIcon);
|
|
|
}
|
|
|
-
|
|
|
- creatShuiYaIcon = true;
|
|
|
}
|
|
|
|
|
|
public void FindShuiYaTargetObje()
|
|
@@ -1030,15 +1042,18 @@ public class GCJKLayer : YZTRootLayer
|
|
|
//位移图标
|
|
|
public void CreatWeiYiIcon()
|
|
|
{
|
|
|
+ for (int i = 0; i < _weiYiIconCtrls.Count; i++)
|
|
|
+ {
|
|
|
+ Destroy(_weiYiIconCtrls[i].gameObject);
|
|
|
+ }
|
|
|
_weiYiIconCtrls = new List<WeiYiIconCtrl>();
|
|
|
- for (int i = 0; i < GlobalData.BuYuanWeiYiDataList.Count; i++)
|
|
|
+ var DataList = currentDataType == 0 ? GlobalData.BuYuanWeiYiDataList : GlobalData.TaoKouWeiYiDataList;
|
|
|
+ for (int i = 0; i < DataList.Count; i++)
|
|
|
{
|
|
|
WeiYiIconCtrl tempIcon = Instantiate(weiYiIconPrefab, _weiYiIconContent).GetComponent<WeiYiIconCtrl>();
|
|
|
- tempIcon.Init(GlobalData.BuYuanWeiYiDataList[i]);
|
|
|
+ tempIcon.Init(DataList[i]);
|
|
|
_weiYiIconCtrls.Add(tempIcon);
|
|
|
}
|
|
|
-
|
|
|
- creatWeiYiIcon = true;
|
|
|
}
|
|
|
|
|
|
public void FindWeiYiTargetObje()
|
|
@@ -1047,7 +1062,6 @@ public class GCJKLayer : YZTRootLayer
|
|
|
{
|
|
|
return;
|
|
|
}
|
|
|
-
|
|
|
GameObject[] BY_targs = GameObject.FindGameObjectsWithTag(weiYiType.BuYuanWeiYi.ToString());
|
|
|
GameObject[] TK_targs = GameObject.FindGameObjectsWithTag(weiYiType.TaoKouWeiYi.ToString());
|
|
|
for (int i = 0; i < _weiYiIconCtrls.Count; i++)
|