Browse Source

添加日志

zhaoyang 3 years ago
parent
commit
6f5ff06210

+ 2 - 2
GameClient/Assets/Game/HotUpdate/DressUp/SceneController.cs

@@ -234,7 +234,7 @@ namespace GFGGame
             for (int i = 0; i < parentObj.transform.childCount; i++)
             {
                 GameObject childGameObj = parentObj.transform.GetChild(i).gameObject;
-                Vector2 childSize = childGameObj.GetComponent<SpriteRenderer>().bounds.size;
+                Vector2 childSize = childGameObj.GetComponent<SpriteRenderer>().size;
 
                 if (size.x <= childSize.x)
                 {
@@ -245,7 +245,7 @@ namespace GFGGame
                     size.y = childSize.y;
                 }
             }
-            return size / parentObj.transform.localScale * 100;
+            return size * 100;
         }
         //设置物体中心点
         public static void SetGameObjectCenter(GameObject parentObj)

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

@@ -274,8 +274,9 @@ namespace GFGGame
             if (gameObject == null) return;
             InputEvent inputEvent = (InputEvent)context.data;
             Vector2 pt1 = this.viewCom.GlobalToLocal(new Vector2(inputEvent.x, inputEvent.y));
-            Vector2 pt2 = this.viewCom.GlobalToLocal(_ui.m_comSelectBox.target.position);
+            Vector2 pt2 = this.viewCom.GlobalToLocal(new Vector2(_ui.m_comSelectBox.target.x, _ui.m_comSelectBox.target.y));
             Vector2 curPos = pt1 - pt2;
+            Debug.Log("pt1" + pt1 + "   pt2:" + pt2 + "  curPos:" + curPos + "    lastPos:" + lastPos);
             float angle = Vector3.Angle(lastPos, curPos); //求出两向量之间的夹角 
             Vector3 normal = Vector3.Cross(lastPos, curPos);//叉乘求出法线向量 
             angle *= Mathf.Sign(Vector3.Dot(normal, Vector3.forward));  //Mathf.Sign()求符号,Vector3.Dot()求方向,求法线向量与物体上方向向量点乘,结果为1或-1,修正旋转方向 
@@ -286,6 +287,8 @@ namespace GFGGame
             // Vector2 pt1 = this.viewCom.GlobalToLocal(new Vector2(inputEvent.x, inputEvent.y));
             // Vector2 pt2 = this.viewCom.GlobalToLocal(_ui.m_comSelectBox.target.position);
             float dist = Vector2.Distance(pt1, pt2);
+            Debug.Log("dist:" + dist);
+
             float ss = dist / _startDistance;
             float newValue = Mathf.Clamp(ss, 0.1f, 2);
             ControllerScale(newValue, gameObject);