Browse Source

拍照翻转

zhaoyang 3 năm trước cách đây
mục cha
commit
95a0da6c5a

+ 22 - 3
GameClient/Assets/Game/HotUpdate/Views/DressUp/PhotographView.cs

@@ -214,15 +214,34 @@ namespace GFGGame
                     PhotographDataManager.Instance.SetItemLayer(hitGameObj, maxLayer);
                     maxLayer = PhotographDataManager.Instance.GetMaxLayer(hitGameObj, maxLayer) + 1;
                     _ui.m_comSelectBox.target.visible = true;
-
-                    SceneController.SetGameObjectCenter(hitGameObj);
+                    if (!_equipDistance.ContainsKey(hitGameObj))
+                    {
+                        SceneController.SetGameObjectCenter(hitGameObj);
+                    }
                 }
                 memoryHitGameObj = hitGameObj;
 
                 distance = Input.mousePosition - Camera.main.WorldToScreenPoint(hitGameObj.transform.position);
 
                 Vector3 localEulerAngles = hitGameObj.transform.localEulerAngles;
-                _ui.m_comSelectBox.target.rotation = localEulerAngles.y != 0 ? hitGameObj.transform.localEulerAngles.z : -hitGameObj.transform.localEulerAngles.z;
+                float rotation = 0;
+                if (localEulerAngles.y == 0)
+                {
+                    rotation = -hitGameObj.transform.localEulerAngles.z;
+                }
+                else
+                {
+                    if (hitGameObj.transform.localEulerAngles.z > 180)
+                    {
+                        rotation = hitGameObj.transform.localEulerAngles.z - 360;
+                    }
+                    else
+                    {
+                        rotation = hitGameObj.transform.localEulerAngles.z;
+                    }
+                }
+                _ui.m_comSelectBox.target.rotation = rotation;// localEulerAngles.y != 0 ? hitGameObj.transform.localEulerAngles.z : -hitGameObj.transform.localEulerAngles.z;
+                Debug.Log("rotation:" + _ui.m_comSelectBox.target.rotation + "   " + _ui.m_comSelectBox.target.rotationX + "    " + _ui.m_comSelectBox.target.rotationY);
                 _ui.m_comSelectBox.target.size = SceneController.GetGameObjectSize(hitGameObj);
                 ControllerSelectBoxPos();
             }