Преглед на файлове

迁移部分接口地址

Void_F преди 6 месеца
родител
ревизия
7cb2ec07a9

+ 1 - 1
Assets/AVProVideo/Demos/Scenes/Demo_MediaPlayer.unity

@@ -6664,7 +6664,7 @@ MonoBehaviour:
   _mediaReference: {fileID: 11400000, guid: 7b8a48f17a76b0d449f396690db75ebf, type: 2}
   _mediaPath:
     _pathType: 0
-    _path: http://www.chatgpt918.top:9080/rtp/34020000001180000001_34020000001310000001/hls.m3u8
+    _path: http://10.123.10.18:18088/rtp/34020000001180000002_34020000001310000001/hls.m3u8
   _fallbackMediaHints:
     transparency: 0
     alphaPacking: 0

+ 2 - 2
Assets/Prefabs/UI/XHYZT/GCJK.prefab

@@ -2170,8 +2170,8 @@ RectTransform:
   m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
   m_AnchorMin: {x: 0.5, y: 1}
   m_AnchorMax: {x: 0.5, y: 1}
-  m_AnchoredPosition: {x: 0, y: -345.3158}
-  m_SizeDelta: {x: 378, y: 496.6317}
+  m_AnchoredPosition: {x: 0, y: -495.568}
+  m_SizeDelta: {x: 378, y: 797.1361}
   m_Pivot: {x: 0.5, y: 0.5}
 --- !u!222 &6663124512898349510
 CanvasRenderer:

Файловите разлики са ограничени, защото са твърде много
+ 1 - 98
Assets/Scene 1.unity


+ 119 - 20
Assets/Scripts/HttpHelper.cs

@@ -314,7 +314,8 @@ public class HttpHelper : MonoBehaviour
     public async Task InitYZTData()
     {
         InitYZTData1();//已完成迁移
-        InitYZTData2();//未完成迁移
+        InitYZTData_BY_Obs();//已完成迁移
+        InitYZTData_TK_Obs();//新增
         InitYZTData3();//已完成迁移
 
     }
@@ -375,12 +376,11 @@ public class HttpHelper : MonoBehaviour
         }
     }
 
-    public async Task InitYZTData2()
+    public async Task InitYZTData_BY_Obs()
     {
-        Debug.Log("!!!!!");
         bool successInternet = true;
         string sendUrl = ServerAddress.API_GetDevicesInfo;
-        sendUrl += "/34020000001180000001/channels?page=1&count=40";
+        sendUrl += "/34020000001180000001/channels?page=1&count=100";
         Debug.Log(sendUrl);
         UnityWebRequest requestData = UnityWebRequest.Get(sendUrl);
         requestData.timeout = timeOut;
@@ -402,7 +402,7 @@ public class HttpHelper : MonoBehaviour
                 JToken codeToken = jsonObject["code"];
                 if (codeToken.ToString() == "0")
                 {
-                    GlobalData.obsDatas = new List<ObsData>();
+                    GlobalData.obsDatas_by = new List<ObsData>();
                     ServerObsDatas serverObsDatas = JsonConvert.DeserializeObject<ServerObsDatas>(dataToken.ToString());
                     for (int i = 0; i < serverObsDatas.list.Count; i++)
                     {
@@ -422,7 +422,7 @@ public class HttpHelper : MonoBehaviour
                         obsData.deviceId = serverObsDatas.list[i].deviceId;
                         obsData.channelId = serverObsDatas.list[i].channelId;
                         obsData.status = serverObsDatas.list[i].status;
-                        GlobalData.obsDatas.Add(obsData);
+                        GlobalData.obsDatas_by.Add(obsData);
                     }
                 }
                 else
@@ -441,14 +441,91 @@ public class HttpHelper : MonoBehaviour
 
         if (!successInternet)
         {
-            WWW www = new WWW(Application.streamingAssetsPath + "/ObsDatas.json");
+            WWW www = new WWW(Application.streamingAssetsPath + "/ObsDatas_BY.json");
             await new UnityAsync.WaitUntil(() =>
             {
                 return www.isDone;
             });
             
             Debug.Log($"缓存数据:{www.text}");
-            GlobalData.obsDatas = JsonConvert.DeserializeObject<List<ObsData>>(www.text);
+            GlobalData.obsDatas_by = JsonConvert.DeserializeObject<List<ObsData>>(www.text);
+            www.Dispose();
+        }
+    }
+    
+     public async Task InitYZTData_TK_Obs()
+    {
+        bool successInternet = true;
+        string sendUrl = ServerAddress.API_GetDevicesInfo;
+        sendUrl += "/34020000001180000002/channels?page=1&count=100";
+        Debug.Log(sendUrl);
+        UnityWebRequest requestData = UnityWebRequest.Get(sendUrl);
+        requestData.timeout = timeOut;
+        await requestData.SendWebRequest();
+        try
+        {
+            if (requestData.result != UnityWebRequest.Result.Success)
+            {
+                Debug.LogWarning("监控数据联网不成功,原因:返request不成功:" + requestData.error);
+                successInternet = false;
+            }
+            else
+            {
+                Debug.Log(requestData.downloadHandler.text);
+                JObject jsonObject = JObject.Parse(requestData.downloadHandler.text);
+
+                // 提取data字段的值
+                JToken dataToken = jsonObject["data"];
+                JToken codeToken = jsonObject["code"];
+                if (codeToken.ToString() == "0")
+                {
+                    GlobalData.obsDatas_tk = new List<ObsData>();
+                    ServerObsDatas serverObsDatas = JsonConvert.DeserializeObject<ServerObsDatas>(dataToken.ToString());
+                    for (int i = 0; i < serverObsDatas.list.Count; i++)
+                    {
+                        ObsData obsData = new ObsData();
+                        obsData.name = serverObsDatas.list[i].name;
+                        obsData.targetName = GlobalData.obsCameraLib[obsData.name];
+                        // if (i > 0)
+                        // {
+                        //     obsData.url =
+                        //         "http://www.chatgpt918.top:9080/rtp/34020000001180000001_34020000001310000001/hls.m3u8";
+                        // }
+                        // else
+                        // {
+                        obsData.url = ServerAddress.ObsSeverM3U8Address + string.Format("/rtp/{0}_{1}/hls.m3u8", serverObsDatas.list[i].deviceId, serverObsDatas.list[i].channelId);
+                        //}
+                        obsData.type = obsType.TaoKouObs;
+                        obsData.deviceId = serverObsDatas.list[i].deviceId;
+                        obsData.channelId = serverObsDatas.list[i].channelId;
+                        obsData.status = serverObsDatas.list[i].status;
+                        GlobalData.obsDatas_tk.Add(obsData);
+                    }
+                }
+                else
+                {
+                    Debug.LogWarning("监控数据联网不成功,原因:返序列化失败");
+                    successInternet = false;
+                }
+            }
+        }
+        catch (Exception e)
+        {
+            successInternet = false;
+            Debug.LogWarning("监控数据联网不成功,原因:" + e.ToString());
+        }
+        requestData.Dispose();
+
+        if (!successInternet)
+        {
+            WWW www = new WWW(Application.streamingAssetsPath + "/ObsDatas_TK.json");
+            await new UnityAsync.WaitUntil(() =>
+            {
+                return www.isDone;
+            });
+            
+            Debug.Log($"缓存数据:{www.text}");
+            GlobalData.obsDatas_tk = JsonConvert.DeserializeObject<List<ObsData>>(www.text);
             www.Dispose();
         }
     }
@@ -920,15 +997,26 @@ public class HttpHelper : MonoBehaviour
         //获取所有渗压记
         GetDevicesData tempData = new GetDevicesData();
         tempData.idsList = new List<DevicesMessage>();
-        for (int i = 0; i < 13; i++)
+        foreach (var device in _devicesIdDatas.Values)
         {
-            var devicesInfo = _devicesIdDatas[$"P{i + 1}"];
-            tempData.idsList.Add(new DevicesMessage()
+            if (device.stationName.Equals("补元") && device.sensorType.Equals("渗压计"))
             {
-                DeviceID = devicesInfo.dataSid,
-                ChannelID = devicesInfo.dataGid
-            });
+                tempData.idsList.Add(new DevicesMessage()
+                {
+                    DeviceID = device.dataSid,
+                    ChannelID = device.dataGid
+                });
+            }
         }
+        // for (int i = 0; i < 13; i++)
+        // {
+        //     var devicesInfo = _devicesIdDatas[$"P{i + 1}"];
+        //     tempData.idsList.Add(new DevicesMessage()
+        //     {
+        //         DeviceID = devicesInfo.dataSid,
+        //         ChannelID = devicesInfo.dataGid
+        //     });
+        // }
         string jsonStr;
         try
         {
@@ -957,15 +1045,26 @@ public class HttpHelper : MonoBehaviour
         //获取所有位移记
         tempData = new GetDevicesData();
         tempData.idsList = new List<DevicesMessage>();
-        for (int i = 0; i < 8; i++)
+        foreach (var device in _devicesIdDatas.Values)
         {
-            var devicesInfo = _devicesIdDatas[$"M{i + 1}"];
-            tempData.idsList.Add(new DevicesMessage()
+            if (device.stationName.Equals("补元") && device.sensorType.Equals("静力水准仪"))
             {
-                DeviceID = devicesInfo.dataSid,
-                ChannelID = devicesInfo.dataGid
-            });
+                tempData.idsList.Add(new DevicesMessage()
+                {
+                    DeviceID = device.dataSid,
+                    ChannelID = device.dataGid
+                });
+            }
         }
+        // for (int i = 0; i < 8; i++)
+        // {
+        //     var devicesInfo = _devicesIdDatas[$"M{i + 1}"];
+        //     tempData.idsList.Add(new DevicesMessage()
+        //     {
+        //         DeviceID = devicesInfo.dataSid,
+        //         ChannelID = devicesInfo.dataGid
+        //     });
+        // }
         try
         {
             jsonStr = await Devices(tempData);

+ 6 - 1
Assets/Scripts/UI/Data/GlobalData.cs

@@ -44,9 +44,14 @@ public class GlobalData
     /// <summary>
     /// 一张图第三页补元监控数据
     /// </summary>
-    public static List<ObsData> obsDatas = new List<ObsData>();
+    public static List<ObsData> obsDatas_by = new List<ObsData>();
 
 
+    /// <summary>
+    /// 一张图第三页补元监控数据
+    /// </summary>
+    public static List<ObsData> obsDatas_tk = new List<ObsData>();
+    
     /// <summary>
     /// 一张图第四页蓄洪调度数据
     /// </summary>

+ 11 - 11
Assets/Scripts/UI/Tools/ServerAddress.cs

@@ -6,8 +6,8 @@ public class ServerAddress
 {
     public static string YZTServerAddress = "http://10.123.10.11:9080";
     public static string Server_TextureSavePath = "http://www.chatgpt918.top:15001/images/";
-    public static string ObsSeverAddress = "http://111.4.141.191:18089";
-    public static string ObsSeverM3U8Address = "http://111.4.141.191:18088";
+    public static string ObsSeverAddress = "http://10.123.10.18:18089";
+    public static string ObsSeverM3U8Address = "http://10.123.10.18:18088";
     
     /// <summary>
     /// 获取一张图所有工程数据
@@ -92,19 +92,19 @@ public class ServerAddress
 
     public static string API_TextureUploadPath = YZTServerAddress + "/upload";
 
-    public static string API_B08_dataStatis = "http://111.4.141.191:9080/open/dataStatis?projectId=";
-    public static string API_B08_inspectResult = "http://111.4.141.191:9080/open/inspectResult?projectId=";
-    public static string API_B08_projectExamine = "http://111.4.141.191:9080/open/projectExamine?projectId=";
-    public static string API_B08_event = "http://111.4.141.191:9080/open/event?projectId=";
-    public static string API_B08_questionStatis = "http://111.4.141.191:9080/open/questionStatis?projectId=";
-    public static string API_B08_inspectType = "http://111.4.141.191:9080/open/inspectType?projectId=";
+    public static string API_B08_dataStatis = "http://10.123.10.11:9080/open/dataStatis?projectId=";
+    public static string API_B08_inspectResult = "http://10.123.10.11:9080/open/inspectResult?projectId=";
+    public static string API_B08_projectExamine = "http://10.123.10.11:9080/open/projectExamine?projectId=";
+    public static string API_B08_event = "http://10.123.10.11:9080/open/event?projectId=";
+    public static string API_B08_questionStatis = "http://10.123.10.11:9080/open/questionStatis?projectId=";
+    public static string API_B08_inspectType = "http://10.123.10.11:9080/open/inspectType?projectId=";
     
     /// <summary>
     /// 获取站点水位信息(折线图和信息列表)
     /// </summary>
-    public static string API_GetWaterTrend_chart = "http://111.4.141.191:9080/open/water1?stcd=";
-    public static string API_GetWaterTrend_list = "http://111.4.141.191:9080/open/water2?stcd=";
-    public static string API_GetWaterData = "http://111.4.141.191:9080/open/water3";
+    public static string API_GetWaterTrend_chart = "http://10.123.10.11:9080/open/water1?stcd=";
+    public static string API_GetWaterTrend_list = "http://10.123.10.11:9080/open/water2?stcd=";
+    public static string API_GetWaterData = "http://10.123.10.11:9080/open/water3";
 
     //  http://111.4.141.191:9081/open/dataStatis 
     //

+ 12 - 5
Assets/Scripts/UI/UIView/3D/SPJKLayer.cs

@@ -30,16 +30,23 @@ public class SPJKLayer : MonoBehaviour
     private async Task InitObsData() {
         await new WaitUntil(() =>
         {
-            return GlobalData.obsDatas.Count > 0;
+            return GlobalData.obsDatas_by.Count > 0&&GlobalData.obsDatas_tk.Count>0;
         });
-        ObsData[] obs = GlobalData.obsDatas.ToArray();
-        for (int i = 0; i < obs.Length; i++)
+        ObsData[] obs_by = GlobalData.obsDatas_by.ToArray();
+        for (int i = 0; i < obs_by.Length; i++)
         {
             SPJK_ObsItem tempItem = Instantiate(spjkItemOri, spjkItemContent).GetComponent<SPJK_ObsItem>();
-            tempItem.SetData(obs[i]);
+            tempItem.SetData(obs_by[i]);
             currentObsDataList.Add(tempItem);
         }
-        countText.text = $"监控列表 (<color=#FFFFFF>{obs.Length}</color>)";
+        ObsData[] obs_tk = GlobalData.obsDatas_tk.ToArray();
+        for (int i = 0; i < obs_tk.Length; i++)
+        {
+            SPJK_ObsItem tempItem = Instantiate(spjkItemOri, spjkItemContent).GetComponent<SPJK_ObsItem>();
+            tempItem.SetData(obs_tk[i]);
+            currentObsDataList.Add(tempItem);
+        }
+        countText.text = $"监控列表 (<color=#FFFFFF>{obs_by.Length+obs_tk.Length}</color>)";
     }
     
     public void SearchObsItem(string s_name)

+ 16 - 4
Assets/Scripts/UI/UIView/BigScreen/BigScreenLayer.cs

@@ -629,24 +629,36 @@ public class BigScreenLayer : MonoBehaviour
     {
         await new WaitUntil(() =>
         {
-            return GlobalData.obsDatas.Count > 0;
+            return GlobalData.obsDatas_by.Count > 0&& GlobalData.obsDatas_tk.Count>0;
         });
         for (int i = 0; i < obsItemList.Count; i++)
         {
             Destroy(obsItemList[i].gameObject);
         }
         obsItemList.Clear();
-        var obsDatas = GlobalData.obsDatas;
-        for (int i = 0; i < obsDatas.Count; i++)
+        var obsDatasBy = GlobalData.obsDatas_by;
+        for (int i = 0; i < obsDatasBy.Count; i++)
         {
             var tempObj = Instantiate(obsItemPrefab, obsItemContent).GetComponent<ObsItem>();
-            tempObj.SetData(obsDatas[i]);
+            tempObj.SetData(obsDatasBy[i]);
             tempObj._button.onClick.AddListener(() =>
             {
                 ShowObsPanel(tempObj._data);
             });
             obsItemList.Add(tempObj);
         }
+        var obsDatasTk = GlobalData.obsDatas_tk;
+        for (int i = 0; i < obsDatasTk.Count; i++)
+        {
+            var tempObj = Instantiate(obsItemPrefab, obsItemContent).GetComponent<ObsItem>();
+            tempObj.SetData(obsDatasTk[i]);
+            tempObj._button.onClick.AddListener(() =>
+            {
+                ShowObsPanel(tempObj._data);
+            });
+            obsItemList.Add(tempObj);
+        }
+        
     }
 
     public void SearchObsItem(string s_name)

+ 25 - 5
Assets/Scripts/UI/UIView/GCJK/GCJKLayer.cs

@@ -715,7 +715,15 @@ public class GCJKLayer : YZTRootLayer
         }
 
         //监控
-        foreach (var tempData in GlobalData.obsDatas)
+        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)
         {
             GongChengLieBiaoData tempLieBiaoData = new GongChengLieBiaoData();
             tempLieBiaoData.name = tempData.name;
@@ -802,16 +810,28 @@ public class GCJKLayer : YZTRootLayer
     //监控列表
     public async Task CreatObsItem()
     {
-        await new WaitUntil(() => { return GlobalData.obsDatas.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 < GlobalData.obsDatas.Count; i++)
+        
+        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>();
+            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_tk.Count; i++)
         {
             ObsItem tempItem = Instantiate(obsItemPrefab, obsItemContent).GetComponent<ObsItem>();
-            tempItem.SetData(GlobalData.obsDatas[i]);
+            tempItem.SetData(GlobalData.obsDatas_tk[i]);
             _obsItems.Add(tempItem);
             ObsIconCtrl tempIcon = Instantiate(obsIconPrefab, _obsIconContent).GetComponent<ObsIconCtrl>();
-            tempIcon.Init(GlobalData.obsDatas[i]);
+            tempIcon.Init(GlobalData.obsDatas_tk[i]);
             _obsIconCtrls.Add(tempIcon);
             //Debug.Log(StaticLod.instance.GetStaticObj(GlobalData.obsDatas[i].name).gameObject.name);
         }

+ 0 - 0
Assets/StreamingAssets/ObsDatas.json → Assets/StreamingAssets/ObsDatas_BY.json


Някои файлове не бяха показани, защото твърде много файлове са промени