Ver código fonte

调整一部分代码

wartheking 4 meses atrás
pai
commit
5402698220

+ 6 - 6
Assets/AIPagedLod/Scripts/WebGL/CameraBirdSec.cs

@@ -120,12 +120,12 @@ public class CameraBirdSec : MonoBehaviour
             if (Input.GetAxis("Mouse ScrollWheel") > 0)
             {
                 //Debug.Log($"{Input.mousePosition} {Screen.width*0.5f}:{Screen.height*0.5f}");
-                float offSetX =  Screen.width * 0.5f-Input.mousePosition.x;
-                float offSetY =   Screen.height * 0.5f-Input.mousePosition.y;
-                Vector3 moveDirection = Vector3.down * offSetY*translateSpeed + Vector3.left * offSetX*translateSpeed;
+                float offSetX =  (Screen.width * 0.5f-Input.mousePosition.x) / Screen.width;
+                float offSetY =   (Screen.height * 0.5f-Input.mousePosition.y) / Screen.height;
+                Vector3 moveDirection = Vector3.down * offSetY*translateSpeed * 110 * 9.0f / 16.0f + Vector3.left * offSetX* translateSpeed * 110;
                 // 平滑移动摄像头到目标位置
                 float cameraDistanceRange = Mathf.Clamp(currentDistance * 1.0f / maxDistance * 1.0f, 0.5f, 0.9f); 
-                target.position += moveDirection.normalized*cameraDistanceRange;
+                target.position += moveDirection*cameraDistanceRange;
                 //限制移动范围
                 if (fixMoveRange)
                 {
@@ -141,13 +141,13 @@ public class CameraBirdSec : MonoBehaviour
         }
       
         // 鼠标左键拖拽平移摄像头
-        if (Input.GetMouseButtonDown(0) && !onUI)
+        if (Input.GetMouseButtonDown(1) && !onUI)
         {
             beginDrag?.Invoke();
             isDragging = true;
             lastMousePosition = Input.mousePosition;
         }
-        else if (Input.GetMouseButtonUp(0))
+        else if (Input.GetMouseButtonUp(1))
         {
             isDragging = false;
         }

+ 6 - 2
Assets/MapLodCtrl.cs

@@ -49,7 +49,7 @@ public class MapLodCtrl : MonoBehaviour
         //     SetCameraRange(value);
         for (int i = 0; i < MapStayList.Count; i++)
         {
-            if (value >= MapStayList[i].cameraDistanceMin && value < MapStayList[i].cameraDistanceMax)
+            if (value < MapStayList[i].cameraDistanceMax)
             {
                 MapStayList[i].map.ShowMap();
             }
@@ -93,7 +93,11 @@ public class MapLodCtrl : MonoBehaviour
         float minX =currentLayer.min_X_Range.x+Mathf.Abs(currentLayer.min_X_Range.x-currentLayer.max_X_Range.x)*distanceRange; 
         float maxX =currentLayer.min_X_Range.y-Mathf.Abs(currentLayer.min_X_Range.y-currentLayer.max_X_Range.y)*distanceRange; 
         float minY =currentLayer.min_Y_Range.y+Mathf.Abs(currentLayer.min_Y_Range.y-currentLayer.max_Y_Range.y)*distanceRange; 
-        float maxY =currentLayer.min_Y_Range.x-Mathf.Abs(currentLayer.min_Y_Range.x-currentLayer.max_Y_Range.x)*distanceRange; 
+        float maxY =currentLayer.min_Y_Range.x-Mathf.Abs(currentLayer.min_Y_Range.x-currentLayer.max_Y_Range.x)*distanceRange;
+        //Debug.Log(minX);
+        //Debug.Log(maxX);
+        //Debug.Log(minY);
+        //Debug.Log(maxY);
         cameraBirdSec.SetRange(minX,maxX,minY,maxY);
     }
     

Diferenças do arquivo suprimidas por serem muito extensas
+ 99 - 2
Assets/Scene 1.unity


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

@@ -110,16 +110,22 @@ public class RuntimePoint : MonoBehaviour, IPointerDownHandler, IPointerUpHandle
 
     public void OnPointerDown(PointerEventData eventData)
     {
-        lastTime = Time.time;
+        if (eventData.button == PointerEventData.InputButton.Left)
+        {
+            lastTime = Time.time;
+        }
     }
 
     public void OnPointerUp(PointerEventData eventData)
     {
-        if (Time.time - lastTime < 0.5f)
+        if (eventData.button == PointerEventData.InputButton.Left)
         {
-            onPointClick?.Invoke();
+            if (Time.time - lastTime < 0.5f)
+            {
+                onPointClick?.Invoke();
+            }
+
         }
-       
     }
 
     

Alguns arquivos não foram mostrados porque muitos arquivos mudaram nesse diff