Browse Source

修复不少bug

lantiannb 3 months ago
parent
commit
fce67a79b1

File diff suppressed because it is too large
+ 0 - 0
Assets/Fonts/Resources/msyh SDF.asset


+ 3 - 3
Assets/Prefabs/UI/RuntimePoint.prefab

@@ -210,9 +210,9 @@ RectTransform:
   m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
   m_AnchorMin: {x: 0, y: 0}
   m_AnchorMax: {x: 0, y: 0}
-  m_AnchoredPosition: {x: 344.33563, y: -657.30005}
+  m_AnchoredPosition: {x: 280.54688, y: -657.30005}
   m_SizeDelta: {x: 138.6713, y: 20}
-  m_Pivot: {x: 0.5, y: 0.02}
+  m_Pivot: {x: 0.04, y: 0.02}
 --- !u!222 &2742062590507750192
 CanvasRenderer:
   m_ObjectHideFlags: 0
@@ -647,7 +647,7 @@ RectTransform:
   m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
   m_AnchorMin: {x: 0.5, y: 0.5}
   m_AnchorMax: {x: 0.5, y: 0.5}
-  m_AnchoredPosition: {x: -0.0010824, y: 9.999975}
+  m_AnchoredPosition: {x: -0.001083374, y: 9.999975}
   m_SizeDelta: {x: 138.67, y: 0}
   m_Pivot: {x: 0.5, y: 0}
 --- !u!114 &7360078027882583284

File diff suppressed because it is too large
+ 9 - 107
Assets/Scene 1.unity


+ 2 - 2
Assets/Scripts/UI/Tools/CoordinateConverter.cs

@@ -72,8 +72,8 @@ public static class CoordinateConverter
     public static Vector3 GeoToUGUISmall(double longitude,double latitude)
     {
 
-        float x = (float)(75.642f * longitude - 8607.658f);
-        float y = (float)(87.990f * latitude - 2640.548f);
+        float x = (float)(80.124f * longitude - 9118.032f);
+        float y = (float)(92.467f * latitude - 2775.33f);
 
         return new Vector3(x, y, -0.400f);
     }

+ 3 - 0
Assets/Scripts/UI/UIView/YZT/Item0.cs

@@ -21,6 +21,8 @@ public class Item0 : MonoBehaviour, IPointerDownHandler, IPointerUpHandler
     public GameObject bingObj;
 
     public Sprite[] images;
+
+    public string mSpecial;
     // Start is called before the first frame update
     void Start()
     {
@@ -29,6 +31,7 @@ public class Item0 : MonoBehaviour, IPointerDownHandler, IPointerUpHandler
 
     public void InitPoint(Sprite newIcon, string name_pri, string newText, string special)
     {
+        mSpecial = special;
         if (special != "1")
         {
             bg.gameObject.SetActive(false);

+ 33 - 43
Assets/Scripts/UI/UIView/YZT/YZTLayer.cs

@@ -32,7 +32,8 @@ public enum LayerUnitType
 }
 
 [System.Serializable]
-public class JKYJData {
+public class JKYJData
+{
     public int normal;
     public int total;
     public int fault;
@@ -50,7 +51,7 @@ public class JKYJChildData
     public bool onlineStatus;
 }
 
-    public class GCGKData
+public class GCGKData
 {
     public string name;
     public string type;
@@ -234,7 +235,8 @@ public class YZTLayer : YZTRootLayer
 
     }
 
-    async void InitGCGKData() {
+    async void InitGCGKData()
+    {
         await new WaitUntil(() =>
         {
             return GlobalData.gcgkContents.Count > 2;
@@ -247,18 +249,19 @@ public class YZTLayer : YZTRootLayer
 
     async void InitJKYJData()
     {
-       // Debug.Log("111");
+        // Debug.Log("111");
         await new WaitUntil(() =>
         {
             return GlobalData.byJKYJContents.total > 0 && GlobalData.tkJKYJContents.total > 0;
         });
         //Debug.Log("222");
-        for (int i = 0; i < GlobalData.byJKYJContents.items.Count; i++) {
+        for (int i = 0; i < GlobalData.byJKYJContents.items.Count; i++)
+        {
             Thing0 thing0 = Instantiate(thing0Prefab);
             thing0.transform.SetParent(thing0Content);
             thing0.transform.localPosition = Vector3.zero;
             thing0.transform.localScale = Vector3.one;
-            thing0.SetData(i.ToString(), GlobalData.byJKYJContents.items[i].name, "补元", "开启", GlobalData.byJKYJContents.items[i].onlineStatus?"正常":"故障");
+            thing0.SetData(i.ToString(), GlobalData.byJKYJContents.items[i].name, "补元", "开启", GlobalData.byJKYJContents.items[i].onlineStatus ? "正常" : "故障");
         }
         //Debug.Log("333");
         for (int i = 0; i < GlobalData.tkJKYJContents.items.Count; i++)
@@ -269,7 +272,7 @@ public class YZTLayer : YZTRootLayer
             thing0.transform.localScale = Vector3.one;
             thing0.SetData((i + GlobalData.byJKYJContents.total).ToString(), GlobalData.tkJKYJContents.items[i].name, "套口", "开启", GlobalData.tkJKYJContents.items[i].onlineStatus ? "正常" : "故障");
         }
-       // Debug.Log("444");
+        // Debug.Log("444");
         totalJKNum.text = (GlobalData.byJKYJContents.total + GlobalData.tkJKYJContents.total).ToString();
         normalJKNum.text = (GlobalData.byJKYJContents.normal + GlobalData.tkJKYJContents.normal).ToString();
         errorJKNum.text = (GlobalData.byJKYJContents.fault + GlobalData.tkJKYJContents.fault).ToString();
@@ -756,36 +759,15 @@ public class YZTLayer : YZTRootLayer
     void InitPoint()
     {
         GameObject shaPan = GameObject.FindGameObjectWithTag("ShaPan");
+        List<Item0> item0s = new List<Item0>();
         for (int i = 0; i < GlobalData.hotPointDatas.Count; i++)
         {
 
             HotPointData temp = GlobalData.hotPointDatas[i];
             Vector3 tempLocalPosition = CoordinateConverter.GeoToUGUISmall(temp.longitude, temp.latitude);
-            //bool have = false;
-            //for (int j = 0; j < runtimePointLib.Count; j++)
-            //{
-            //    if (Vector3.Distance(tempLocalPosition, runtimePointLib[j].bingObj.transform.localPosition) < 0.1)
-            //    {
-            //        if (runtimePointLib[j].layerIDs.Contains((int)temp.type))
-            //        {
-            //            have = true;
-            //            break;
-            //        }
-            //        else {
-            //            have = true;
-            //            runtimePointLib[j].Refresh(hotPointSprite[8]);
-            //            runtimePointLib[j].layerIDs.Add((int)temp.type);
-
-            //            break;
-            //        }
-            //    }
-            //}
-            //if (have) {
-            //    continue;
-            //}
 
             RuntimePoint newPoint = Instantiate(pointPrefab, Vector3.zero, Quaternion.identity);
-            
+
             int tempI = i;
             newPoint.GetComponent<RectTransform>().SetParent(pointParent);
             newPoint.InitPoint(hotPointSprite[(int)(temp.type)], temp.namePri, temp.name);
@@ -800,30 +782,38 @@ public class YZTLayer : YZTRootLayer
             if ((int)temp.type == 6 || (int)temp.type == 7)
             {
                 int index = FindIndexByLayerUnitName(temp.name);
-                
+
                 Item0 item0 = Instantiate(item0Prefab, Vector3.zero, Quaternion.identity);
-                item0.GetComponent<RectTransform>().SetParent(item0Parent.transform);
                 item0.InitPoint(hotPointSprite[(int)(temp.type)], temp.namePri, temp.name, GlobalData.layerUnitDatas[index].special);
+                item0s.Add(item0);
                 item0.onPointClick = () =>
                 {
                     OnNewPointClick(temp, item0);
                 };
             }
-
-            Item0 item1 = Instantiate(item0Prefab, Vector3.zero, Quaternion.identity);
-            item1.GetComponent<RectTransform>().SetParent(item0Parent.transform);
-            item1.InitPoint(hotPointSprite[7], "GeTi", "隔提", "1");
-            //item1.onPointClick = () =>
-            //{
-            //    OnNewPointClick(temp, item1);
-            //};
-
             newPoint.onPointClick = () =>
             {
                 OnNewPointClick(temp, newPoint);
             };
             runtimePointLib.Add(newPoint);
         }
+
+        for (int i = 0; i < item0s.Count; i++)
+        {
+            if (item0s[i].mSpecial != "1")
+                item0s[i].GetComponent<RectTransform>().SetParent(item0Parent.transform);
+        }
+
+        for (int i = 0; i < item0s.Count; i++)
+        {
+            if (item0s[i].mSpecial == "1")
+                item0s[i].GetComponent<RectTransform>().SetParent(item0Parent.transform);
+        }
+
+        Item0 item1 = Instantiate(item0Prefab, Vector3.zero, Quaternion.identity);
+        item1.GetComponent<RectTransform>().SetParent(item0Parent.transform);
+        item1.InitPoint(hotPointSprite[7], "GeTi", "隔提", "1");
+
         RunTimeLayerClick(0);
         RunTimeLayerClick(1);
         RunTimeLayerClick(2);
@@ -832,7 +822,7 @@ public class YZTLayer : YZTRootLayer
         RunTimeLayerClick(5);
         RunTimeLayerClick(6);
 
-        BaseLayer3BtnOnClick(true);
+        BaseLayer0BtnOnClick(true);
     }
 
     int FindIndexByLayerUnitName(string name)
@@ -1072,7 +1062,7 @@ public class YZTLayer : YZTRootLayer
                     lakeLayerInfo[i].anchoredPosition = CameraManager.instance.secondCamera.WorldToScreenPoint(lakeLayerObj[i].transform.position) / Screen.width * 1920.0f;
                 }
             }
-           
+
         }
         else
         {

Some files were not shown because too many files changed in this diff