完善3D解剖功能

This commit is contained in:
shenjianxing 2025-02-19 13:07:05 +08:00
parent ca82f68f37
commit f369006cd9
8 changed files with 984 additions and 18 deletions

File diff suppressed because it is too large Load Diff

View File

@ -696,7 +696,7 @@ MonoBehaviour:
m_Name: m_Name:
m_EditorClassIdentifier: m_EditorClassIdentifier:
m_Content: {fileID: 230997068583847590} m_Content: {fileID: 230997068583847590}
m_Horizontal: 1 m_Horizontal: 0
m_Vertical: 1 m_Vertical: 1
m_MovementType: 1 m_MovementType: 1
m_Elasticity: 0.1 m_Elasticity: 0.1

View File

@ -884,6 +884,7 @@ MonoBehaviour:
distanceMax: 20 distanceMax: 20
pitchMinMax: {x: -20, y: 80} pitchMinMax: {x: -20, y: 80}
texture: {fileID: 8400000, guid: 187fba8368491cb428c8cbd324fa9bb4, type: 2} texture: {fileID: 8400000, guid: 187fba8368491cb428c8cbd324fa9bb4, type: 2}
lockMove: 0
--- !u!222 &102363872365703344 --- !u!222 &102363872365703344
CanvasRenderer: CanvasRenderer:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0

View File

@ -30,7 +30,7 @@ public class Body3DController : MonoSingleton<Body3DController>
private Vector2 mouseDownPosition; // 记录鼠标按下时的位置 private Vector2 mouseDownPosition; // 记录鼠标按下时的位置
Stack<GameObject> activeObjs = new Stack<GameObject>(); Stack<GameObject> activeObjs = new Stack<GameObject>();
Stack<GameObject> moveObjs = new Stack<GameObject>(); public Stack<GameObject> moveObjs = new Stack<GameObject>();
public override void OnSingletonInit() public override void OnSingletonInit()
{ {
base.OnSingletonInit(); base.OnSingletonInit();

View File

@ -84,6 +84,6 @@ public class ObjDrag : MonoBehaviour
// 在这里可以添加你想要执行的双击逻辑 // 在这里可以添加你想要执行的双击逻辑
// 例如,将物体重置到起始位置 // 例如,将物体重置到起始位置
//transform.position = startPosition; //transform.position = startPosition;
transform.DOMove(startPosition, 0.3f); transform.DOMove(startPosition, 0.1f);
} }
} }

View File

@ -5,7 +5,7 @@ using QFramework;
namespace QFramework.Example namespace QFramework.Example
{ {
// Generate Id:72ad2108-5768-445e-af82-c0c5db90d8e7 // Generate Id:b3c99476-8a23-45c1-8eeb-fca6bca1bfda
public partial class UIBody3D public partial class UIBody3D
{ {
public const string Name = "UIBody3D"; public const string Name = "UIBody3D";
@ -15,16 +15,20 @@ namespace QFramework.Example
[SerializeField] [SerializeField]
public RectTransform BodyList; public RectTransform BodyList;
[SerializeField] [SerializeField]
public RectTransform LeftContent;
[SerializeField]
public UnityEngine.UI.Button ResetBtn; public UnityEngine.UI.Button ResetBtn;
[SerializeField] [SerializeField]
public UnityEngine.UI.Toggle HideAll;
[SerializeField]
public RectTransform LeftContent;
[SerializeField]
public UnityEngine.UI.Toggle ActiveBtn; public UnityEngine.UI.Toggle ActiveBtn;
[SerializeField] [SerializeField]
public UnityEngine.UI.Button ActiveBack; public UnityEngine.UI.Button ActiveBack;
[SerializeField] [SerializeField]
public UnityEngine.UI.Toggle DragBtn; public UnityEngine.UI.Toggle DragBtn;
[SerializeField] [SerializeField]
public UnityEngine.UI.Button DragReset;
[SerializeField]
public UnityEngine.UI.Button DragBack; public UnityEngine.UI.Button DragBack;
[SerializeField] [SerializeField]
public UnityEngine.UI.Button MenuBtn; public UnityEngine.UI.Button MenuBtn;
@ -39,11 +43,13 @@ namespace QFramework.Example
{ {
BodyContent = null; BodyContent = null;
BodyList = null; BodyList = null;
LeftContent = null;
ResetBtn = null; ResetBtn = null;
HideAll = null;
LeftContent = null;
ActiveBtn = null; ActiveBtn = null;
ActiveBack = null; ActiveBack = null;
DragBtn = null; DragBtn = null;
DragReset = null;
DragBack = null; DragBack = null;
MenuBtn = null; MenuBtn = null;
BodyItem = null; BodyItem = null;

View File

@ -4,7 +4,7 @@ using XMLTool;
using TMPro; using TMPro;
using System.Collections.Generic; using System.Collections.Generic;
using static XMLTool.Body3D; using static XMLTool.Body3D;
using UnityEngine.Assertions.Must; using DG.Tweening;
namespace QFramework.Example namespace QFramework.Example
{ {
@ -92,12 +92,38 @@ namespace QFramework.Example
UIKit.OpenPanelAsync<UIBody3DMenuTree>(canvasLevel: UILevel.PopUI, new UIBody3DMenuTreeData() { body = mData.body }).ToAction().StartGlobal(); UIKit.OpenPanelAsync<UIBody3DMenuTree>(canvasLevel: UILevel.PopUI, new UIBody3DMenuTreeData() { body = mData.body }).ToAction().StartGlobal();
Hide(); Hide();
}); });
DragReset.onClick.AddListener(() =>
{
while (Body3DController.Instance.moveObjs.Count > 0)
{
GameObject obj = Body3DController.Instance.PopMoveObj();
if (obj != null)
{
obj.GetComponent<ObjDrag>().OnDoubleClick();
}
}
});
HideAll.onValueChanged.AddListener(isOn =>
{
if (isOn)
{
LeftContent.GetComponent<DOTweenAnimation>().DORestart();
HideAll.transform.Find("Label").GetComponent<TextMeshProUGUI>().text = "ÏÔʾ";
}
else
{
LeftContent.GetComponent<DOTweenAnimation>().DOPlayBackwards();
HideAll.transform.Find("Label").GetComponent<TextMeshProUGUI>().text = "Òþ²Ø";
}
});
} }
protected override void OnOpen(IUIData uiData = null) protected override void OnOpen(IUIData uiData = null)
{ {
if (uiData!=null) if (uiData != null)
{ {
mData = uiData as UIBody3DData ?? new UIBody3DData(); mData = uiData as UIBody3DData ?? new UIBody3DData();
} }

View File

@ -211,13 +211,11 @@ namespace QFramework.Example
}); });
Input.onSelect.AddListener(str => Input.onSelect.AddListener(str =>
{ {
Debug.LogError("onSelect:" + str);
SearchContent.gameObject.SetActive(true); SearchContent.gameObject.SetActive(true);
Content.gameObject.SetActive(false); Content.gameObject.SetActive(false);
}); });
Input.onEndEdit.AddListener(str => Input.onEndEdit.AddListener(str =>
{ {
Debug.LogError("onEndEdit:" + str);
if (string.IsNullOrEmpty(str)) if (string.IsNullOrEmpty(str))
{ {
SearchContent.gameObject.SetActive(false); SearchContent.gameObject.SetActive(false);
@ -239,6 +237,7 @@ namespace QFramework.Example
{ {
mData = uiData as UIBody3DMenuTreeData ?? new UIBody3DMenuTreeData(); mData = uiData as UIBody3DMenuTreeData ?? new UIBody3DMenuTreeData();
Content.RemoveAllChildren(); Content.RemoveAllChildren();
objBtnDataMap.Clear();
BuildTreeUI(mData.body); BuildTreeUI(mData.body);
} }
private void BuildTreeUI(Body3D.Body data, int depth = 0, Transform parent = null) private void BuildTreeUI(Body3D.Body data, int depth = 0, Transform parent = null)