Bläddra i källkod

提交蓄洪概况修改

wartheking 3 veckor sedan
förälder
incheckning
99d85b460e

+ 1 - 1
Assets/Art/UI/YZT/B05/img_sbtn_nor@2x.png.meta

@@ -48,7 +48,7 @@ TextureImporter:
   alignment: 0
   spritePivot: {x: 0.5, y: 0.5}
   spritePixelsToUnits: 100
-  spriteBorder: {x: 0, y: 2, z: 2, w: 2}
+  spriteBorder: {x: 0, y: 0, z: 0, w: 0}
   spriteGenerateFallbackPhysicsShape: 1
   alphaUsage: 1
   alphaIsTransparency: 1

+ 8 - 1
Assets/Prefabs/UI/ImportThing.prefab

@@ -196,7 +196,7 @@ RectTransform:
   m_AnchorMin: {x: 0, y: 0}
   m_AnchorMax: {x: 0, y: 0}
   m_AnchoredPosition: {x: 0, y: 0}
-  m_SizeDelta: {x: 158.3501, y: 39.9666}
+  m_SizeDelta: {x: 240, y: 39.9666}
   m_Pivot: {x: 0.5, y: 0.5}
 --- !u!222 &5520029608518069108
 CanvasRenderer:
@@ -296,3 +296,10 @@ MonoBehaviour:
   image: {fileID: 2340841340024246845}
   arrow: {fileID: 5883354859402315790}
   text: {fileID: 4553227958870709005}
+  data1:
+    datatime: 
+    title: 
+    importantStatic: 0
+    year: 0
+    havePic: 0
+    content: 

Filskillnaden har hållts tillbaka eftersom den är för stor
+ 991 - 23
Assets/Prefabs/UI/XHYZT/XHGK.prefab


+ 47 - 46
Assets/Scripts/HttpHelper.cs

@@ -77,7 +77,7 @@ public class HttpHelper : MonoBehaviour
 
         if (GlobalData.pageIndex == PageIndex.Page1)
         {
-            
+
             SendBuYuan_GetSensorData();
             SendTaoKou_GetSensorData();
             GetBuYuanDevicesGroupInfo();
@@ -480,7 +480,7 @@ public class HttpHelper : MonoBehaviour
         {
             if (GlobalData.layerUnitDatas[i].type == LayerUnitType.JK)
             {
-                if(!GlobalData.obsCameraLib.ContainsKey(GlobalData.layerUnitDatas[i].name))
+                if (!GlobalData.obsCameraLib.ContainsKey(GlobalData.layerUnitDatas[i].name))
                     GlobalData.obsCameraLib.Add(GlobalData.layerUnitDatas[i].name, GlobalData.layerUnitDatas[i].namePri);
             }
         }
@@ -505,7 +505,7 @@ public class HttpHelper : MonoBehaviour
             }
             else
             {
-                Debug.Log("补元监控数据返回:"+requestData.downloadHandler.text);
+                Debug.Log("补元监控数据返回:" + requestData.downloadHandler.text);
                 string postResult = requestData.downloadHandler.text;
                 if (useAes)
                 {
@@ -596,7 +596,7 @@ public class HttpHelper : MonoBehaviour
             else
             {
 
-                Debug.Log("套口监控数据返回:"+requestData.downloadHandler.text);
+                Debug.Log("套口监控数据返回:" + requestData.downloadHandler.text);
                 string postResult = requestData.downloadHandler.text;
                 if (useAes)
                 {
@@ -617,6 +617,7 @@ public class HttpHelper : MonoBehaviour
                     {
                         ObsData obsData = new ObsData();
                         string originName = serverObsDatas.list[i].name;
+                        Debug.Log("111111111111111:" + originName);
                         obsData.name = "套口-" + serverObsDatas.list[i].name;
                         if (GlobalData.obsCameraLib.TryGetValue(originName, out var value))
                         {
@@ -660,21 +661,21 @@ public class HttpHelper : MonoBehaviour
     }
 
 
-     public async Task<string> GetObsUrl(string deviceId,string channelId)
-     {
-         string result = "";
-         string cmdUrl = ServerAddress.API_PlayStart;
-         cmdUrl += $"/{deviceId}/{channelId}";
-         Debug.Log($"send:{cmdUrl}");
-         UnityWebRequest requestData = UnityWebRequest.Get(cmdUrl);
-         await requestData.SendWebRequest();
-         if (requestData.result != UnityWebRequest.Result.Success)
-         {
-             Debug.LogWarning($"获取监控播放地址不成功,原因:返request不成功:" + requestData.downloadHandler.text);
-         }
-         else
-         {
-             Debug.Log(requestData.downloadHandler.text);
+    public async Task<string> GetObsUrl(string deviceId, string channelId)
+    {
+        string result = "";
+        string cmdUrl = ServerAddress.API_PlayStart;
+        cmdUrl += $"/{deviceId}/{channelId}";
+        Debug.Log($"send:{cmdUrl}");
+        UnityWebRequest requestData = UnityWebRequest.Get(cmdUrl);
+        await requestData.SendWebRequest();
+        if (requestData.result != UnityWebRequest.Result.Success)
+        {
+            Debug.LogWarning($"获取监控播放地址不成功,原因:返request不成功:" + requestData.downloadHandler.text);
+        }
+        else
+        {
+            Debug.Log(requestData.downloadHandler.text);
             string postResult = requestData.downloadHandler.text;
             if (useAes)
             {
@@ -684,13 +685,13 @@ public class HttpHelper : MonoBehaviour
             JObject jsonObject = JObject.Parse(postResult);
             // 提取data字段的值
             JToken dataToken = jsonObject["data"];
-             ObsPlayUrlData urlData = JsonConvert.DeserializeObject<ObsPlayUrlData>(dataToken.ToString());
-             result = urlData.hls;
-             Debug.Log("获取到监控播放路径:"+result);
-         }
-         requestData.Dispose();
-         return result;
-     }
+            ObsPlayUrlData urlData = JsonConvert.DeserializeObject<ObsPlayUrlData>(dataToken.ToString());
+            result = urlData.hls;
+            Debug.Log("获取到监控播放路径:" + result);
+        }
+        requestData.Dispose();
+        return result;
+    }
 
     public async Task InitYZTData3()
     {
@@ -948,7 +949,7 @@ public class HttpHelper : MonoBehaviour
     public async Task InitSWYJData()
     {
         InitSWYJData0();
-        
+
         await InitSWYJData1();
         await InitSWYJData2();
         OnSWYJRefresh?.Invoke();
@@ -1073,7 +1074,7 @@ public class HttpHelper : MonoBehaviour
             GetSingleDevicesRequest tempData = JsonConvert.DeserializeObject<GetSingleDevicesRequest>(hourResult);
             GlobalData.buYuanShuiWei_hour = new ShuiWeiBianHuaData();
             GlobalData.buYuanShuiWei_hour.name = new string[tempData.data.Count];
-            GlobalData.buYuanShuiWei_hour.value =  new double[tempData.data.Count];
+            GlobalData.buYuanShuiWei_hour.value = new double[tempData.data.Count];
             for (int i = 0; i < tempData.data.Count; i++)
             {
                 GlobalData.buYuanShuiWei_hour.name[i] = tempData.data[i].timeGroup;
@@ -1222,7 +1223,7 @@ public class HttpHelper : MonoBehaviour
         //tempData.idsList = new List<DevicesMessage>();
         foreach (var device in _devicesIdDatas.Values)
         {
-            
+
             if (device.stationName.Equals("补元") && device.sensorType.Equals("渗压计"))
             {
                 GlobalData.BuYuanShuiYaDataList.Add(new ShuiYaData()
@@ -1234,8 +1235,8 @@ public class HttpHelper : MonoBehaviour
                 });
             }
         }
-        Debug.Log("添加补元渗压记:"+ GlobalData.BuYuanShuiYaDataList.Count);
-        
+        Debug.Log("添加补元渗压记:" + GlobalData.BuYuanShuiYaDataList.Count);
+
         Debug.Log("获取补元所有位移记");
         //获取所有位移记
         foreach (var device in _devicesIdDatas.Values)
@@ -1245,13 +1246,13 @@ public class HttpHelper : MonoBehaviour
                 GlobalData.BuYuanWeiYiDataList.Add(new WeiYiData()
                 {
                     name = device.sensorName,
-                    value =device.realtimeValue1,
+                    value = device.realtimeValue1,
                     type = weiYiType.BuYuanWeiYi,
                     targetName = $"BY_{device.sensorName}"
                 });
             }
         }
-        Debug.Log("添加补元位移记:"+ GlobalData.BuYuanWeiYiDataList.Count);
+        Debug.Log("添加补元位移记:" + GlobalData.BuYuanWeiYiDataList.Count);
     }
 
     public async void GetTaoKouDevicesGroupInfo()
@@ -1271,8 +1272,8 @@ public class HttpHelper : MonoBehaviour
                 });
             }
         }
-        Debug.Log("添加套口渗压记:"+ GlobalData.TaoKouShuiYaDataList.Count);
-        
+        Debug.Log("添加套口渗压记:" + GlobalData.TaoKouShuiYaDataList.Count);
+
         Debug.Log("获取套口所有位移记");
         //获取所有位移记
         foreach (var device in _devicesIdDatas.Values)
@@ -1282,15 +1283,15 @@ public class HttpHelper : MonoBehaviour
                 GlobalData.TaoKouWeiYiDataList.Add(new WeiYiData()
                 {
                     name = device.sensorName,
-                    value =device.realtimeValue1,
+                    value = device.realtimeValue1,
                     type = weiYiType.TaoKouWeiYi,
                     targetName = $"TK_{device.sensorName}"
                 });
             }
         }
-        Debug.Log("添加套口位移记:"+ GlobalData.TaoKouWeiYiDataList.Count);
+        Debug.Log("添加套口位移记:" + GlobalData.TaoKouWeiYiDataList.Count);
     }
-    
+
     public async Task SendTaoKou_GetSensorData()
     {
         UnityWebRequest www = UnityWebRequest.Get(ServerAddress.API_TaoKou_GetSensorData);
@@ -1469,7 +1470,7 @@ public class HttpHelper : MonoBehaviour
     /// <param name="type"></param>
     public async Task InitGCYWData1(int type)
     {
-        Debug.Log($"获取B08GCYW 数据:{(type==0?"补元":"套口")}");
+        Debug.Log($"获取B08GCYW 数据:{(type == 0 ? "补元" : "套口")}");
         GlobalData.B08_Type = type;
         string jsonStr;
         try
@@ -1535,9 +1536,9 @@ public class HttpHelper : MonoBehaviour
             GlobalData.B08TaskListInfos = new B08_TaskListInfoData[GlobalData.B08InspectType.data.Length];
             for (int i = 0; i < GlobalData.B08InspectType.data.Length; i++)
             {
-                string tempResult = await B08_API_TaskInfo(type,i);
+                string tempResult = await B08_API_TaskInfo(type, i);
                 Debug.Log($"B08_API_TaskInfo type={i}:" + tempResult);
-                GlobalData.B08TaskListInfos[i]= JsonConvert.DeserializeObject<B08_TaskListInfoData>(tempResult);
+                GlobalData.B08TaskListInfos[i] = JsonConvert.DeserializeObject<B08_TaskListInfoData>(tempResult);
             }
         }
         catch (Exception e)
@@ -1552,7 +1553,7 @@ public class HttpHelper : MonoBehaviour
         {
             cmdUrl += "1794245918999351298";
         }
-        else if(type==1)
+        else if (type == 1)
         {
             cmdUrl += "1798366756789653505";
         }
@@ -1570,20 +1571,20 @@ public class HttpHelper : MonoBehaviour
         www.Dispose();
         return result;
     }
-    public async Task<string> B08_API_TaskInfo(int type,int xunjian_type)
+    public async Task<string> B08_API_TaskInfo(int type, int xunjian_type)
     {
         string cmdUrl = ServerAddress.API_B08_taskInfo;
         if (type == 0)
         {
             cmdUrl += "1794245918999351298";
         }
-        else if(type==1)
+        else if (type == 1)
         {
             cmdUrl += "1798366756789653505";
         }
 
         cmdUrl += "&xunjian_type=" + xunjian_type;
-        Debug.Log("!!!:"+cmdUrl);
+        Debug.Log("!!!:" + cmdUrl);
         UnityWebRequest www = new UnityWebRequest(cmdUrl, "Get");
         www.downloadHandler = new DownloadHandlerBuffer();
         www.SetRequestHeader("Content-Type", "application/json");
@@ -1596,7 +1597,7 @@ public class HttpHelper : MonoBehaviour
         www.Dispose();
         return result;
     }
-    
+
 
     /// <summary>
     /// 获取站点水位信息

+ 71 - 28
Assets/Scripts/UI/UIView/XHGK/XHGKLayer.cs

@@ -12,7 +12,8 @@ using UnityEngine.Networking;
 using UnityEngine.UI;
 using WaitUntil = UnityAsync.WaitUntil;
 
-public enum XHGKImportantStatic { 
+public enum XHGKImportantStatic
+{
     BY,
     TK,
     GTK,
@@ -20,14 +21,16 @@ public enum XHGKImportantStatic {
 }
 
 [System.Serializable]
-public class DSJData {
+public class DSJData
+{
     public string year;
     public string date;
     public string title;
     public string pos;
     public string content;
 
-    public DSJData(string y,string d,string t,string p,string c) {
+    public DSJData(string y, string d, string t, string p, string c)
+    {
         year = y;
         date = d;
         title = t;
@@ -111,23 +114,39 @@ public class XHGKLayer : YZTRootLayer
     public Button compareBtn;
 
     public Button exitCompareBtn;
+
+    public Transform filterContent;
+
+    private string[] filterName = new string[5] { "", "补元闸", "套口闸", "腰口泵站", "高潭口二站" }; 
     // Start is called before the first frame update
 
     async void Awake()
     {
+        for (int i = 0; i < filterContent.childCount; i++)
+        {
+            Button btn = filterContent.GetChild(i).GetComponent<Button>();
+            int temp = i;
+            btn.onClick.AddListener(() =>
+            {
+                InitDSJ(filterName[temp]);
+            });
+        }
+
         yearBtns = new List<YearBtn>();
-        for (int i = 0; i < yearContent.childCount; i++) {
+        for (int i = 0; i < yearContent.childCount; i++)
+        {
             yearBtns.Add(yearContent.GetChild(i).GetComponent<YearBtn>());
             int temp = i;
             if (yearBtns[i].defaultActive)
             {
                 currentActive = temp;
             }
-            yearBtns[temp].heightY = -224 + 56 * temp;
+            yearBtns[temp].heightY = -320 + 56 * temp;
             yearBtns[temp].GetComponent<UnityEngine.UI.Button>().onClick.AddListener(() =>
             {
                 yearContent.DOLocalMoveY(yearBtns[temp].heightY, 0.3f);
-                for (int j = 0; j < yearBtns.Count; j++) {
+                for (int j = 0; j < yearBtns.Count; j++)
+                {
                     yearBtns[j].OnActive(false);
                 }
                 currentActive = temp;
@@ -149,21 +168,33 @@ public class XHGKLayer : YZTRootLayer
         InitDSJ();
     }
 
-    async Task InitData() {
-        await new WaitUntil(() => {
+    async Task InitData()
+    {
+        await new WaitUntil(() =>
+        {
             return GlobalData.dsjContents.Count > 0;
         });
     }
 
-    void InitDSJ() {
-
+    void InitDSJ(string filter = "")
+    {
+        xHGKLayerDatas16.Clear();
+        xHGKLayerDatas17.Clear();
+        xHGKLayerDatas18.Clear();
+        xHGKLayerDatas19.Clear();
+        xHGKLayerDatas20.Clear();
+        xHGKLayerDatas21.Clear();
+        xHGKLayerDatas22.Clear();
         for (int i = 0; i < GlobalData.dsjContents.Count; i++)
         {
             XHGKLayerData xHGKLayerDatas = new XHGKLayerData();
             xHGKLayerDatas.year = int.Parse(GlobalData.dsjContents[i].year);
             xHGKLayerDatas.datatime = GlobalData.dsjContents[i].date;
             xHGKLayerDatas.title = GlobalData.dsjContents[i].title;
-            Debug.Log(GlobalData.dsjContents[i].pos);
+            if (filter != "" && filter != GlobalData.dsjContents[i].pos)
+            {
+                continue;
+            }
             switch (GlobalData.dsjContents[i].pos)
             {
                 case "补元闸":
@@ -222,9 +253,11 @@ public class XHGKLayer : YZTRootLayer
     }
 
 
-    async void RefreshRightImage(int year, int index) {
+    async void RefreshRightImage(int year, int index)
+    {
         string picName = "";
-        switch (index) {
+        switch (index)
+        {
             case 0:
                 picName = "by.jpg";
                 break;
@@ -251,7 +284,8 @@ public class XHGKLayer : YZTRootLayer
         Resources.UnloadUnusedAssets();
     }
 
-    void RefreshToFirst() {
+    void RefreshToFirst()
+    {
         if (importBtns.Count < 1) return;
         for (int i = 0; i < importBtns.Count; i++)
         {
@@ -264,11 +298,12 @@ public class XHGKLayer : YZTRootLayer
         rightContent.GetChild(staticIndex).gameObject.SetActive(true);
         leftImage.sprite = workImages[staticIndex];
         beforeImage.sprite = workImages[staticIndex];
-        RefreshRightImage(importBtns[staticIndex].data1.year,staticIndex);
+        RefreshRightImage(importBtns[staticIndex].data1.year, staticIndex);
         compareText.text = importBtns[staticIndex].data1.content;
     }
 
-    void ChangeImportantToCurrent() {
+    void ChangeImportantToCurrent()
+    {
         switch (currentActive)
         {
             case 0:
@@ -295,7 +330,8 @@ public class XHGKLayer : YZTRootLayer
         }
     }
 
-    async Task InitDSJPanel(List<XHGKLayerData> xHGKLayerDatas) {
+    async Task InitDSJPanel(List<XHGKLayerData> xHGKLayerDatas)
+    {
 
         if (middleContent.gameObject.activeSelf)
         {
@@ -315,12 +351,14 @@ public class XHGKLayer : YZTRootLayer
         });
 
         scrollView.GetComponent<CanvasGroup>().alpha = 0;
-        for (int i = importBtns.Count - 1; i >= 0; i--) {
+        for (int i = importBtns.Count - 1; i >= 0; i--)
+        {
             Destroy(importBtns[i].gameObject);
             importBtns.RemoveAt(i);
         }
-        
-        for (int i = 0; i < xHGKLayerDatas.Count; i++) {
+
+        for (int i = 0; i < xHGKLayerDatas.Count; i++)
+        {
             ImportBtn btn = Instantiate(importThingPrefab);
             btn.GetComponent<RectTransform>().SetParent(importantContent);
             btn.GetComponent<RectTransform>().localScale = Vector3.one;
@@ -340,7 +378,7 @@ public class XHGKLayer : YZTRootLayer
                 rightContent.GetChild(staticIndex).gameObject.SetActive(true);
                 leftImage.sprite = workImages[staticIndex];
                 beforeImage.sprite = workImages[staticIndex];
-                RefreshRightImage(importBtns[tempI].data1.year,staticIndex);
+                RefreshRightImage(importBtns[tempI].data1.year, staticIndex);
                 compareText.text = importBtns[tempI].data1.content;
             });
 
@@ -354,27 +392,32 @@ public class XHGKLayer : YZTRootLayer
     // Update is called once per frame
     void Update()
     {
-        if (yearBtns.Count > 0) {
-            for (int i = 0; i < yearBtns.Count; i++) {
+        if (yearBtns.Count > 0)
+        {
+            for (int i = 0; i < yearBtns.Count; i++)
+            {
                 int offset = Mathf.Abs(i - currentActive);
                 yearBtns[i].normalDig.color = new Color(1, 1, 1, 1 - 0.2f * offset);
                 yearBtns[i].activeDig.color = new Color(1, 1, 1, 1 - 0.2f * offset);
             }
         }
 
-        if (StaticLod.instance.currentStatic != null) {
-            if (middleContent.gameObject.activeSelf) {
+        if (StaticLod.instance.currentStatic != null)
+        {
+            if (middleContent.gameObject.activeSelf)
+            {
                 Vector3 pos = CameraManager.instance.mainCamera.WorldToScreenPoint(StaticLod.instance.currentStatic.transform.position) * 1920.0f / Screen.width;
-                middleContent.anchoredPosition = new Vector3(pos.x - 400,pos.y + 200, pos.z) ;
+                middleContent.anchoredPosition = new Vector3(pos.x - 400, pos.y + 200, pos.z);
 
-                if (middleContent.anchoredPosition.x < 150 || middleContent.anchoredPosition.x > 1500 || middleContent.anchoredPosition.y < 70 || middleContent.anchoredPosition.y > 950)
+                if (middleContent.anchoredPosition.x < 500 || middleContent.anchoredPosition.x > 1400 || middleContent.anchoredPosition.y < 70 || middleContent.anchoredPosition.y > 950)
                 {
                     if (middleContent.GetComponent<CanvasGroup>().alpha > 0)
                     {
                         middleContent.GetComponent<CanvasGroup>().alpha -= Time.deltaTime * 3;
                     }
                 }
-                else {
+                else
+                {
                     if (middleContent.GetComponent<CanvasGroup>().alpha < 1)
                     {
                         middleContent.GetComponent<CanvasGroup>().alpha += Time.deltaTime * 3;

Vissa filer visades inte eftersom för många filer har ändrats