修复bug
This commit is contained in:
parent
fe1f8fa83b
commit
c8642b1afb
@ -456,9 +456,6 @@ public class Show3DCamera : MonoBehaviour
|
||||
// 相机始终朝向目标点
|
||||
transform.LookAt(targetPos);
|
||||
}
|
||||
#if Turing
|
||||
TypeEventSystem.Global.Send<OnUpdatePos>(new OnUpdatePos() { pos = gameObject.Position(), rot = gameObject.LocalEulerAngles() });
|
||||
#endif
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@ -28,13 +28,19 @@ public class TuringDraggableEx : Draggable, IObjDrag
|
||||
|
||||
|
||||
Vector3 startPosition;
|
||||
Vector3 startRotation;
|
||||
private void Start()
|
||||
{
|
||||
isOn = false;
|
||||
startPosition = gameObject.transform.position;
|
||||
startPosition = gameObject.transform.localPosition;
|
||||
startRotation = gameObject.transform.localEulerAngles;
|
||||
}
|
||||
public override void OnBeginDrag(PointerEventData eventData)
|
||||
{
|
||||
if (eventData.button != 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
beginPos = gameObject.Position();
|
||||
if (isOn == false)
|
||||
{
|
||||
@ -51,6 +57,10 @@ public class TuringDraggableEx : Draggable, IObjDrag
|
||||
|
||||
public override void OnDrag(PointerEventData eventData)
|
||||
{
|
||||
if (eventData.button != 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (isOn)
|
||||
{
|
||||
base.OnDrag(eventData);
|
||||
@ -63,6 +73,10 @@ public class TuringDraggableEx : Draggable, IObjDrag
|
||||
|
||||
public override void OnEndDrag(PointerEventData eventData)
|
||||
{
|
||||
if (eventData.button != 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (isOn)
|
||||
{
|
||||
base.OnEndDrag(eventData);
|
||||
@ -73,7 +87,8 @@ public class TuringDraggableEx : Draggable, IObjDrag
|
||||
|
||||
public void OnDoubleClick()
|
||||
{
|
||||
transform.DOMove(startPosition, 0.1f);
|
||||
transform.DOLocalMove(startPosition, 0.1f);
|
||||
transform.localEulerAngles = startRotation;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -7,6 +7,7 @@ using UnityEngine.UI;
|
||||
using XMLTool;
|
||||
using System;
|
||||
using static XMLTool.Body3D;
|
||||
using Turing.Core.TuringInput;
|
||||
|
||||
namespace QFramework.Example
|
||||
{
|
||||
@ -356,8 +357,30 @@ namespace QFramework.Example
|
||||
|
||||
TypeEventSystem.Global.Register<OnModuleQuit>((arg) => Hide()).UnRegisterWhenGameObjectDestroyed(gameObject);
|
||||
|
||||
|
||||
#if Turing
|
||||
|
||||
UIRoot.Instance.transform.Find("ZStylus").GetComponent<TuringStylus>().OnButtonPressing.AddListener(OnButtonPressing);
|
||||
#endif
|
||||
|
||||
|
||||
}
|
||||
|
||||
#if Turing
|
||||
private void OnButtonPressing(TuringPointer arg0, int arg1)
|
||||
{
|
||||
if (arg1 == 1)
|
||||
{
|
||||
// 向左旋转物体,使用 Time.deltaTime 确保旋转速度与帧率无关
|
||||
root.transform.Rotate(Vector3.up, -100 * Time.deltaTime);
|
||||
}
|
||||
else if (arg1 == 2)
|
||||
{ // 向右旋转物体,使用 Time.deltaTime 确保旋转速度与帧率无关
|
||||
root.transform.Rotate(Vector3.up, 100 * Time.deltaTime);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
private void OnUIBody3DMenuTreeClose()
|
||||
{
|
||||
@ -528,6 +551,21 @@ namespace QFramework.Example
|
||||
}
|
||||
}
|
||||
|
||||
//private void Update()
|
||||
//{
|
||||
// if (Input.GetKey(KeyCode.A))
|
||||
// {
|
||||
// // 向左旋转物体,使用 Time.deltaTime 确保旋转速度与帧率无关
|
||||
// root.transform.Rotate(Vector3.up, -100 * Time.deltaTime);
|
||||
|
||||
// }
|
||||
|
||||
// if (Input.GetKey(KeyCode.B))
|
||||
// {
|
||||
// // 向右旋转物体,使用 Time.deltaTime 确保旋转速度与帧率无关
|
||||
// root.transform.Rotate(Vector3.up, 100 * Time.deltaTime);
|
||||
// }
|
||||
//}
|
||||
protected override void OnHide()
|
||||
{
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user