3D解剖功能
This commit is contained in:
parent
e3bc40bf8b
commit
194672f17c
@ -15,7 +15,7 @@ public class Body3DController : MonoSingleton<Body3DController>
|
||||
{
|
||||
Normal = 1 << 0,
|
||||
Active = 1 << 1,
|
||||
Move = 1 << 2,
|
||||
Drag = 1 << 2,
|
||||
}
|
||||
|
||||
Body3DController() { }
|
||||
@ -87,6 +87,11 @@ public class Body3DController : MonoSingleton<Body3DController>
|
||||
}
|
||||
}
|
||||
|
||||
public bool CheckStatus(Status status)
|
||||
{
|
||||
return (this.status & status) == status;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public void Active(bool isActive)
|
||||
|
||||
@ -34,18 +34,29 @@ public class Body3DOjbItem : MonoBehaviour
|
||||
|
||||
objToggle.OnValueChanged.AddListener(isOn =>
|
||||
{
|
||||
colorToggle?.SetColor(isOn);
|
||||
objDrag = gameObject.GetOrAddComponent<ObjDrag>();
|
||||
RefreshDrag();
|
||||
TypeEventSystem.Global.Send<OnBody3DSelected>(new OnBody3DSelected() { isOn = isOn, obj = gameObject });
|
||||
if (isOn)
|
||||
if (Body3DController.Instance.CheckStatus(Body3DController.Status.Active))
|
||||
{
|
||||
TypeEventSystem.Global.Register<OnBody3DDragChanged>(OnBody3DDragHandler);
|
||||
if (isOn == true)
|
||||
{
|
||||
gameObject.SetActive(false);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
TypeEventSystem.Global.UnRegister<OnBody3DDragChanged>(OnBody3DDragHandler);
|
||||
colorToggle?.SetColor(isOn);
|
||||
objDrag = gameObject.GetOrAddComponent<ObjDrag>();
|
||||
RefreshDrag();
|
||||
TypeEventSystem.Global.Send<OnBody3DSelected>(new OnBody3DSelected() { isOn = isOn, obj = gameObject });
|
||||
if (isOn)
|
||||
{
|
||||
TypeEventSystem.Global.Register<OnBody3DDragChanged>(OnBody3DDragHandler);
|
||||
}
|
||||
else
|
||||
{
|
||||
TypeEventSystem.Global.UnRegister<OnBody3DDragChanged>(OnBody3DDragHandler);
|
||||
}
|
||||
}
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
@ -61,7 +72,7 @@ public class Body3DOjbItem : MonoBehaviour
|
||||
{
|
||||
if (objToggle != null && objDrag != null)
|
||||
{
|
||||
objDrag.isOn = objToggle.isOn && Body3DController.Instance.allowDrag;
|
||||
objDrag.isOn = objToggle.isOn && Body3DController.Instance.CheckStatus(Body3DController.Status.Drag);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -17,6 +17,7 @@ namespace QFramework.Example
|
||||
{
|
||||
DragBtn.transform.Find("SubBtns").gameObject.SetActive(isOn);
|
||||
Body3DController.Instance.allowDrag = isOn;
|
||||
Body3DController.Instance.SetStatus(Body3DController.Status.Drag, isOn);
|
||||
TypeEventSystem.Global.Send<OnBody3DDragChanged>();
|
||||
});
|
||||
DragBack.onClick.AddListener(() =>
|
||||
@ -27,6 +28,7 @@ namespace QFramework.Example
|
||||
ActiveBtn.onValueChanged.AddListener(isOn =>
|
||||
{
|
||||
ActiveBtn.transform.Find("SubBtns").gameObject.SetActive(isOn);
|
||||
Body3DController.Instance.SetStatus(Body3DController.Status.Active, isOn);
|
||||
});
|
||||
|
||||
ActiveBack.onClick.AddListener(() =>
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user