Эх сурвалжийг харах

Merge branch 'main' of http://www.chatgpt918.top:3000/wartheking/WaterFlush

Void_F 9 сар өмнө
parent
commit
ca069e9930

+ 1 - 1
Assets/MapLodCtrl.cs

@@ -16,7 +16,7 @@ public class MapLodCtrl : MonoBehaviour
 
     private void Start()
     {
-        MapList[currentMapIndex].map.ShowMap();
+        //MapList[currentMapIndex].map.ShowMap();
     }
 
     private void OnDestroy()

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

@@ -84,8 +84,8 @@ RectTransform:
   m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
   m_AnchorMin: {x: 0, y: 0}
   m_AnchorMax: {x: 0, y: 0}
-  m_AnchoredPosition: {x: 325, y: -657.3}
-  m_SizeDelta: {x: 100, y: 20}
+  m_AnchoredPosition: {x: 344.33563, y: -657.30005}
+  m_SizeDelta: {x: 138.6713, y: 20}
   m_Pivot: {x: 0.5, y: 0.02}
 --- !u!222 &2742062590507750192
 CanvasRenderer:

+ 3 - 3
Assets/Prefabs/UI/XHYZT/YZT.prefab

@@ -3771,7 +3771,7 @@ RectTransform:
   - {fileID: 1691797279008194321}
   - {fileID: 5761950834214704942}
   m_Father: {fileID: 46367776369383932}
-  m_RootOrder: 1
+  m_RootOrder: 0
   m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
   m_AnchorMin: {x: 0, y: 0}
   m_AnchorMax: {x: 1, y: 1}
@@ -17287,7 +17287,7 @@ RectTransform:
   - {fileID: 489262735}
   - {fileID: 1264488847}
   m_Father: {fileID: 46367776369383932}
-  m_RootOrder: 0
+  m_RootOrder: 1
   m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
   m_AnchorMin: {x: 1, y: 0.5}
   m_AnchorMax: {x: 1, y: 0.5}
@@ -18566,8 +18566,8 @@ RectTransform:
   m_LocalScale: {x: 1, y: 1, z: 1}
   m_ConstrainProportionsScale: 0
   m_Children:
-  - {fileID: 46367775954135417}
   - {fileID: 396067363}
+  - {fileID: 46367775954135417}
   - {fileID: 7917872797199088731}
   m_Father: {fileID: 46367776346094409}
   m_RootOrder: 0

Файлын зөрүү хэтэрхий том тул дарагдсан байна
+ 1 - 98
Assets/Scene 1.unity


+ 7 - 4
Assets/Scripts/UI/UIView/YZT/RuntimePoint.cs

@@ -22,14 +22,18 @@ public class RuntimePoint : MonoBehaviour
     public GameObject bingObj;
     void Awake() {
 
-        arrow.DOLocalMoveY(-40, 1.0f).SetLoops(-1, LoopType.Yoyo);
+      //  arrow.DOLocalMoveY(-40, 1.0f).SetLoops(-1, LoopType.Yoyo);
     }
     // Start is called before the first frame update
     void Start()
     {
         
     }
-
+    public void Refresh(Sprite newIcon) {
+        Debug.Log(newIcon);
+        Debug.Log(bingObj.name);
+        icon.sprite = newIcon;
+    }
     public void InitPoint(Sprite newIcon, string name_pri, string newText) {
         text.text = newText;
         if(name_pri.Trim().Length > 0)
@@ -39,13 +43,12 @@ public class RuntimePoint : MonoBehaviour
     }
 
     // Update is called once per frame
-    void Update()
+    void LateUpdate()
     {
         this.GetComponent<RectTransform>().anchoredPosition = CameraManager.instance.secondCamera.WorldToScreenPoint(bingObj.transform.position) * 1920.0f / Screen.width;
 
         float bi = CameraManager.instance.secondCamera.GetComponent<CameraBirdSec>().currentDistance / 20;
         bi = (float)Math.Clamp(bi, 0.3, 1);
-        //print(bi);
         this.GetComponent<RectTransform>().localScale = Vector3.one / bi;
     }
 

+ 107 - 13
Assets/Scripts/UI/UIView/YZT/YZTLayer.cs

@@ -10,6 +10,7 @@ using UnityEngine.Networking;
 using UnityEngine.UI;
 using UnityAsync;
 using WaitUntil = UnityAsync.WaitUntil;
+using Best.HTTP.Caching;
 
 [System.Serializable]
 public class YZTLayerData
@@ -91,8 +92,11 @@ public class YZTLayer : YZTRootLayer
     public RectTransform layerInfo;
     public Button layerInfoExitBtn;
 
+    public List<int> cancelLayer = new List<int>();
+
     public Sprite[] sprites;
 
+
     // Start is called before the first frame update
     async void Awake()
     {
@@ -122,6 +126,19 @@ public class YZTLayer : YZTRootLayer
     }
 
     void InitLayerInfo() {
+
+        Button[] btns = layerInfo.GetComponentsInChildren<Button>();
+        for (int i = 0; i < btns.Length - 2; i++) {
+            int temp = i;
+            btns[i].onClick.AddListener(() =>
+            {
+                bool active = btns[temp].GetComponent<CanvasGroup>().alpha > 0.5f;
+                btns[temp].GetComponent<CanvasGroup>().alpha = active ? 0.5f : 1.0f;
+                bool newActive = !active;
+                ChangeRuntimeLayer(temp, newActive);
+            });
+        }
+
         layerButton.onClick.AddListener(() => {
             layerInfo.gameObject.SetActive(true);
         });
@@ -216,7 +233,7 @@ public class YZTLayer : YZTRootLayer
                 }
                 layerBtns[index].SetUseful(true);
                 layerBtns[index].secContent.gameObject.SetActive(true);
-                ChangeRuntimeLayer(index);
+                //ChangeRuntimeLayer(index);
             });
 
             layerBtn.SetLayerBtnData(layerSprite[layerDatas[i].layerID], layerDatas[i].layerName, num.ToString());
@@ -259,7 +276,32 @@ public class YZTLayer : YZTRootLayer
         GameObject shaPan = GameObject.FindGameObjectWithTag("ShaPan");
         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);
@@ -269,24 +311,46 @@ public class YZTLayer : YZTRootLayer
             newPoint.bingObj.transform.SetParent(shaPan.transform.GetChild(6));
             newPoint.bingObj.transform.localEulerAngles = Vector3.zero;
             newPoint.bingObj.transform.localScale = Vector3.one;
-            newPoint.bingObj.transform.localPosition = CoordinateConverter.GeoToUGUISmall(temp.longitude, temp.latitude);
+            newPoint.bingObj.transform.localPosition = tempLocalPosition;
             newPoint.bingObj.name = temp.name;
+
+            
             newPoint.btn.onClick.AddListener(() =>
             {
-                CameraManager.SwitchCamera(0);
-                viewMode = ViewMode.normal;
-                if((int)temp.type >= 6)
+                
+                
+                if ((int)temp.type >= 6)
+                {
+                    CameraManager.SwitchCamera(0);
+                    viewMode = ViewMode.normal;
                     StaticLod.instance.OnFoucusStatic(newPoint.staticImp);
-                yZT.gameObject.SetActive(true);
-                ChangeRightContent(tempI);
-                middleContent.gameObject.SetActive(false);
-                rightContent.gameObject.SetActive(false);
-                LeftBtnClick(1, false);
+                    yZT.gameObject.SetActive(true);
+                    int index = FindIndexByLayerUnitName(temp.name);
+                    ChangeRightContent(index);
+                    middleContent.gameObject.SetActive(false);
+                    rightContent.gameObject.SetActive(false);
+                    LeftBtnClick(1, false);
+                }
+                
             });
             runtimePointLib.Add(newPoint);
         }
     }
 
+
+    int FindIndexByLayerUnitName(string name) {
+        for (int i = 0; i < GlobalData.layerUnitDatas.Count; i++) {
+            if (GlobalData.layerUnitDatas[i].name == name.Trim()) {
+                return i;
+            }
+        }
+        return -1;
+    }
+
+    //void OnNewPointClick(HotPointData temp,) {
+    
+    //}
+
     async Task InitData() {
         await new WaitUntil(() => {
             return GlobalData.layerUnitDatas.Count > 0;
@@ -317,11 +381,41 @@ public class YZTLayer : YZTRootLayer
         });
     }
 
-    void ChangeRuntimeLayer(int layer) {
+    void ChangeRuntimeLayer(int layer,bool show) {
+        if (show)
+        {
+            if (cancelLayer.Contains(layer))
+            {
+                cancelLayer.Remove(layer);
+            }
+        }
+        else {
+            if (!cancelLayer.Contains(layer))
+            {
+                cancelLayer.Add(layer);
+            }
+        }
         for (int i = 0; i < runtimePointLib.Count; i++) {
-            runtimePointLib[i].gameObject.SetActive(false);
             if (runtimePointLib[i].layerIDs.Contains(layer)) {
-                runtimePointLib[i].gameObject.SetActive(true);
+                if (runtimePointLib[i].layerIDs.Count < 2)
+                {
+                    runtimePointLib[i].gameObject.SetActive(show);
+                }
+                else {
+                    List<int> tempLayers = new List<int>(runtimePointLib[i].layerIDs);
+                    for (int j = 0; j < cancelLayer.Count; j++) {
+                        if (tempLayers.Contains(cancelLayer[j])) {
+                            tempLayers.Remove(cancelLayer[j]);
+                        }
+                    }
+                    if (tempLayers.Count < 1)
+                    {
+                        runtimePointLib[i].gameObject.SetActive(false);
+                    }
+                    else {
+                        runtimePointLib[i].gameObject.SetActive(true);
+                    }
+                }
             }
         }
     }

Энэ ялгаанд хэт олон файл өөрчлөгдсөн тул зарим файлыг харуулаагүй болно