zhaoyang 3 år sedan
förälder
incheckning
66cfb6f04b
1 ändrade filer med 6 tillägg och 1 borttagningar
  1. 6 1
      GameClient/Assets/Game/HotUpdate/Views/DressUp/PhotographView.cs

+ 6 - 1
GameClient/Assets/Game/HotUpdate/Views/DressUp/PhotographView.cs

@@ -236,9 +236,14 @@ namespace GFGGame
             Debug.Log("物体世界坐标:" + hitParentGameObj.transform.position);
             //位置:角色、道具、npc全用对应父物体的位置
             Vector2 objScreenPos = Camera.main.WorldToScreenPoint(hitParentGameObj.transform.position);
+            this.viewCom.GlobalToLocal(objScreenPos);
+
             Debug.Log("物体屏幕坐标:" + hitParentGameObj.transform.position);
             Debug.Log("屏幕高:" + Screen.height);
-            Vector2 localPos = new Vector2(objScreenPos.x, (Screen.height - objScreenPos.y));
+            // Vector2 localPos = new Vector2(objScreenPos.x, (Screen.height - objScreenPos.y));
+            Vector2 localPos = this.viewCom.GlobalToLocal(new Vector2(objScreenPos.x, (Screen.height - objScreenPos.y)));
+
+            Debug.Log("localPos:" + localPos);
             Debug.Log("选框坐标:" + _ui.m_comSelectBox.target.position);
 
             _ui.m_comSelectBox.target.position = localPos;//(localPos.x, localPos.y);