完善3D功能
This commit is contained in:
parent
b101114067
commit
2ade54fc37
File diff suppressed because it is too large
Load Diff
@ -62,7 +62,6 @@ public class Body3DOjbItem : MonoBehaviour
|
|||||||
Body3DController.Instance.AddMoveObj(gameObject);
|
Body3DController.Instance.AddMoveObj(gameObject);
|
||||||
});
|
});
|
||||||
RefreshDrag();
|
RefreshDrag();
|
||||||
TypeEventSystem.Global.Send<OnBody3DSelected>(new OnBody3DSelected() { isOn = isOn, obj = gameObject });
|
|
||||||
if (isOn)
|
if (isOn)
|
||||||
{
|
{
|
||||||
TypeEventSystem.Global.Register<OnBody3DDragChanged>(OnBody3DDragHandler);
|
TypeEventSystem.Global.Register<OnBody3DDragChanged>(OnBody3DDragHandler);
|
||||||
@ -72,6 +71,7 @@ public class Body3DOjbItem : MonoBehaviour
|
|||||||
TypeEventSystem.Global.UnRegister<OnBody3DDragChanged>(OnBody3DDragHandler);
|
TypeEventSystem.Global.UnRegister<OnBody3DDragChanged>(OnBody3DDragHandler);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
TypeEventSystem.Global.Send<OnBody3DSelected>(new OnBody3DSelected() { isOn = isOn, obj = gameObject });
|
||||||
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,11 +1,6 @@
|
|||||||
using DG.Tweening;
|
using DG.Tweening;
|
||||||
using GCSeries.Core;
|
|
||||||
using System;
|
|
||||||
using Unity.Burst.CompilerServices;
|
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using UnityEngine.EventSystems;
|
using UnityEngine.EventSystems;
|
||||||
using UnityEngine.UI;
|
|
||||||
using UnityEngine.UIElements;
|
|
||||||
|
|
||||||
public class Show3DCamera : MonoBehaviour
|
public class Show3DCamera : MonoBehaviour
|
||||||
{
|
{
|
||||||
@ -175,7 +170,7 @@ public class Show3DCamera : MonoBehaviour
|
|||||||
targetPos = target;
|
targetPos = target;
|
||||||
this.distance = distance;
|
this.distance = distance;
|
||||||
offset = new Vector3(0, 0, -distance);
|
offset = new Vector3(0, 0, -distance);
|
||||||
if (moveTime!=-1)
|
if (moveTime != -1)
|
||||||
{
|
{
|
||||||
transform.DOMove(cameraPos, moveTime);
|
transform.DOMove(cameraPos, moveTime);
|
||||||
}
|
}
|
||||||
@ -211,6 +206,7 @@ public class Show3DCamera : MonoBehaviour
|
|||||||
float mouseY = Input.GetAxis("Mouse Y") * moveSpeed;
|
float mouseY = Input.GetAxis("Mouse Y") * moveSpeed;
|
||||||
|
|
||||||
transform.Translate(new Vector3(-mouseX, -mouseY, 0));
|
transform.Translate(new Vector3(-mouseX, -mouseY, 0));
|
||||||
|
targetPos += new Vector3(-mouseX, -mouseY, 0);
|
||||||
}
|
}
|
||||||
// Ëõ·ÅÏà»ú
|
// Ëõ·ÅÏà»ú
|
||||||
private void ZoomCamera(float scroll)
|
private void ZoomCamera(float scroll)
|
||||||
|
|||||||
28
Assets/Scripts/UI/UIBody3DInfo.Designer.cs
generated
28
Assets/Scripts/UI/UIBody3DInfo.Designer.cs
generated
@ -5,16 +5,30 @@ using QFramework;
|
|||||||
|
|
||||||
namespace QFramework.Example
|
namespace QFramework.Example
|
||||||
{
|
{
|
||||||
// Generate Id:6a156460-e46d-43cb-8f5b-c213ad89d195
|
// Generate Id:049dcd2b-a5af-4cf7-a8ee-72f902b5f835
|
||||||
public partial class UIBody3DInfo
|
public partial class UIBody3DInfo
|
||||||
{
|
{
|
||||||
public const string Name = "UI3DBodyInfo";
|
public const string Name = "UIBody3DInfo";
|
||||||
|
|
||||||
|
[SerializeField]
|
||||||
|
public UnityEngine.RectTransform Content;
|
||||||
[SerializeField]
|
[SerializeField]
|
||||||
public UnityEngine.UI.Toggle Group;
|
public UnityEngine.UI.Toggle Group;
|
||||||
[SerializeField]
|
[SerializeField]
|
||||||
public TMPro.TextMeshProUGUI PartName;
|
public TMPro.TextMeshProUGUI PartName;
|
||||||
[SerializeField]
|
[SerializeField]
|
||||||
|
public UnityEngine.UI.Toggle ShowTip;
|
||||||
|
[SerializeField]
|
||||||
|
public UnityEngine.UI.Toggle AudioBtn;
|
||||||
|
[SerializeField]
|
||||||
|
public UnityEngine.UI.Toggle AudioSpeed;
|
||||||
|
[SerializeField]
|
||||||
|
public RectTransform Center;
|
||||||
|
[SerializeField]
|
||||||
|
public RectTransform ListContent;
|
||||||
|
[SerializeField]
|
||||||
|
public TMPro.TextMeshProUGUI Des;
|
||||||
|
[SerializeField]
|
||||||
public UnityEngine.UI.Button Back;
|
public UnityEngine.UI.Button Back;
|
||||||
[SerializeField]
|
[SerializeField]
|
||||||
public UnityEngine.UI.Toggle Active;
|
public UnityEngine.UI.Toggle Active;
|
||||||
@ -24,18 +38,28 @@ namespace QFramework.Example
|
|||||||
public UnityEngine.UI.Button Single;
|
public UnityEngine.UI.Button Single;
|
||||||
[SerializeField]
|
[SerializeField]
|
||||||
public UnityEngine.UI.Toggle TransparentOther;
|
public UnityEngine.UI.Toggle TransparentOther;
|
||||||
|
[SerializeField]
|
||||||
|
public UnityEngine.UI.Image ListItem;
|
||||||
|
|
||||||
private UIBody3DInfoData mPrivateData = null;
|
private UIBody3DInfoData mPrivateData = null;
|
||||||
|
|
||||||
protected override void ClearUIComponents()
|
protected override void ClearUIComponents()
|
||||||
{
|
{
|
||||||
|
Content = null;
|
||||||
Group = null;
|
Group = null;
|
||||||
PartName = null;
|
PartName = null;
|
||||||
|
ShowTip = null;
|
||||||
|
AudioBtn = null;
|
||||||
|
AudioSpeed = null;
|
||||||
|
Center = null;
|
||||||
|
ListContent = null;
|
||||||
|
Des = null;
|
||||||
Back = null;
|
Back = null;
|
||||||
Active = null;
|
Active = null;
|
||||||
Transparent = null;
|
Transparent = null;
|
||||||
Single = null;
|
Single = null;
|
||||||
TransparentOther = null;
|
TransparentOther = null;
|
||||||
|
ListItem = null;
|
||||||
|
|
||||||
mData = null;
|
mData = null;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -4,6 +4,7 @@ using QFramework;
|
|||||||
using XMLTool;
|
using XMLTool;
|
||||||
using DG.Tweening;
|
using DG.Tweening;
|
||||||
using TMPro;
|
using TMPro;
|
||||||
|
using System;
|
||||||
|
|
||||||
namespace QFramework.Example
|
namespace QFramework.Example
|
||||||
{
|
{
|
||||||
@ -14,8 +15,10 @@ namespace QFramework.Example
|
|||||||
public partial class UIBody3DInfo : UIPanel
|
public partial class UIBody3DInfo : UIPanel
|
||||||
{
|
{
|
||||||
GameObject obj;
|
GameObject obj;
|
||||||
|
float bgH;
|
||||||
protected override void OnInit(IUIData uiData = null)
|
protected override void OnInit(IUIData uiData = null)
|
||||||
{
|
{
|
||||||
|
bgH = Content.sizeDelta.y;
|
||||||
Group.onValueChanged.AddListener(isOn =>
|
Group.onValueChanged.AddListener(isOn =>
|
||||||
{
|
{
|
||||||
TypeEventSystem.Global.Send<OnBody3DGroupTypeChanged>(new OnBody3DGroupTypeChanged() { isGroup = isOn });
|
TypeEventSystem.Global.Send<OnBody3DGroupTypeChanged>(new OnBody3DGroupTypeChanged() { isGroup = isOn });
|
||||||
@ -87,16 +90,73 @@ namespace QFramework.Example
|
|||||||
Transparent.gameObject.SetActive(true);
|
Transparent.gameObject.SetActive(true);
|
||||||
TransparentOther.gameObject.SetActive(true);
|
TransparentOther.gameObject.SetActive(true);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
ShowTip.onValueChanged.AddListener(isOn =>
|
||||||
|
{
|
||||||
|
|
||||||
|
if (isOn)
|
||||||
|
{
|
||||||
|
DOTween.To(() => Content.sizeDelta.y, (v) =>
|
||||||
|
{
|
||||||
|
Content.sizeDelta = new Vector2(Content.sizeDelta.x, v);
|
||||||
|
}, bgH + Center.sizeDelta.y, 0.2f);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
DOTween.To(() => Content.sizeDelta.y, (v) =>
|
||||||
|
{
|
||||||
|
Content.sizeDelta = new Vector2(Content.sizeDelta.x, v);
|
||||||
|
}, bgH, 0.2f);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
AudioBtn.onValueChanged.AddListener(isOn =>
|
||||||
|
{
|
||||||
|
AudioSpeed.gameObject.SetActive(isOn);
|
||||||
|
});
|
||||||
|
AudioSpeed.onValueChanged.AddListener((isOn) =>
|
||||||
|
{
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public void RefreshTipPath()
|
||||||
|
{
|
||||||
|
ListContent.RemoveAllChildren();
|
||||||
|
ListItemFacotry(mData.body);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Refresh()
|
||||||
|
{
|
||||||
|
PartName.text = mData.body.Name;
|
||||||
|
obj = Utility.FindObj(mData.body.Path);
|
||||||
|
Des.text = mData.body.Tip;
|
||||||
|
RefreshTipPath();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void ListItemFacotry(Body3D.Body body)
|
||||||
|
{
|
||||||
|
GameObject obj = GameObject.Instantiate(ListItem.gameObject, ListContent);
|
||||||
|
obj.transform.Find("Label").GetComponent<TextMeshProUGUI>().text = body.Name;
|
||||||
|
obj.transform.SetAsFirstSibling();
|
||||||
|
if (body.parent != null)
|
||||||
|
{
|
||||||
|
ListItemFacotry(body.parent);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void OnOpen(IUIData uiData = null)
|
protected override void OnOpen(IUIData uiData = null)
|
||||||
{
|
{
|
||||||
mData = uiData as UIBody3DInfoData ?? new UIBody3DInfoData();
|
mData = uiData as UIBody3DInfoData ?? new UIBody3DInfoData();
|
||||||
PartName.text = mData.body.Name;
|
|
||||||
obj = Utility.FindObj(mData.body.Path);
|
|
||||||
|
|
||||||
|
Refresh();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
protected override void OnShow()
|
protected override void OnShow()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|||||||
@ -182,6 +182,8 @@ namespace XMLTool
|
|||||||
|
|
||||||
public ObjectToggle toggle;
|
public ObjectToggle toggle;
|
||||||
public Dictionary<string, Body> subBody { get; set; } = new Dictionary<string, Body>();
|
public Dictionary<string, Body> subBody { get; set; } = new Dictionary<string, Body>();
|
||||||
|
|
||||||
|
public Body parent;
|
||||||
//public Dictionary<string, Body> bodyList { get; set; } = new Dictionary<string, Body>();
|
//public Dictionary<string, Body> bodyList { get; set; } = new Dictionary<string, Body>();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -395,7 +397,7 @@ namespace XMLTool
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
private static Body3D.Body ParseBody(XElement bodyElement)
|
private static Body3D.Body ParseBody(XElement bodyElement, Body parent = null)
|
||||||
{
|
{
|
||||||
Body3D.Body body = new Body3D.Body
|
Body3D.Body body = new Body3D.Body
|
||||||
{
|
{
|
||||||
@ -430,10 +432,10 @@ namespace XMLTool
|
|||||||
}
|
}
|
||||||
foreach (var childElement in bodyElement.Elements("Body"))
|
foreach (var childElement in bodyElement.Elements("Body"))
|
||||||
{
|
{
|
||||||
var subBody = ParseBody(childElement);
|
var subBody = ParseBody(childElement, body);
|
||||||
body.subBody.Add(subBody.Name, subBody);
|
body.subBody.Add(subBody.Name, subBody);
|
||||||
}
|
}
|
||||||
|
body.parent = parent;
|
||||||
return body;
|
return body;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -24,6 +24,46 @@
|
|||||||
|
|
||||||
<Body3D>
|
<Body3D>
|
||||||
<Body name="头颈" icon="" path="Ren/Tou" >
|
<Body name="头颈" icon="" path="Ren/Tou" >
|
||||||
|
<Body name="骨骼系统" path="Ren/Tou/GuGe" isShow="false">
|
||||||
|
<Body name="肋骨" path="Ren/Tou/GuGe/LeiGu">
|
||||||
|
<Body name="左肋" path="Ren/Tou/GuGe/LeiGu/ZuoLei">
|
||||||
|
<Body name="左一" path="Ren/Tou/GuGe/LeiGu/ZuoLei/1" tip="左一肋骨描述">
|
||||||
|
<ObjectToggle>
|
||||||
|
<Color isOn="0,255,255" isOff="255,255,255"></Color>
|
||||||
|
</ObjectToggle>
|
||||||
|
</Body>
|
||||||
|
<Body name="左二" path="Ren/Tou/GuGe/LeiGu/ZuoLei/2" tip="左二肋骨描述">
|
||||||
|
<ObjectToggle>
|
||||||
|
<Color isOn="0,255,255" isOff="255,255,255"></Color>
|
||||||
|
</ObjectToggle>
|
||||||
|
</Body>
|
||||||
|
</Body>
|
||||||
|
<Body name="右肋" path="Ren/Tou/GuGe/LeiGu/YouLei">
|
||||||
|
<Body name="右一" path="Ren/Tou/GuGe/LeiGu/YouLei/1" tip="7右一肋骨描述">
|
||||||
|
<ObjectToggle>
|
||||||
|
<Color isOn="0,255,255" isOff="255,255,255"></Color>
|
||||||
|
</ObjectToggle>
|
||||||
|
</Body>
|
||||||
|
<Body name="右二" path="Ren/Tou/GuGe/LeiGu/YouLei/2" tip="右二肋骨描述">
|
||||||
|
<ObjectToggle>
|
||||||
|
<Color isOn="0,255,255" isOff="255,255,255"></Color>
|
||||||
|
</ObjectToggle>
|
||||||
|
</Body>
|
||||||
|
</Body>
|
||||||
|
</Body>
|
||||||
|
</Body>
|
||||||
|
<Body name="皮肤系统" path="Ren/Tou/PiFu" isShow="false">
|
||||||
|
<Body name="肋骨" path="Ren/Tou/PiFu/LeiGu">
|
||||||
|
<Body name="左肋" path="Ren/Tou/PiFu/LeiGu/ZuoLei">
|
||||||
|
<Body name="左一" path="Ren/Tou/PiFu/LeiGu/ZuoLei/1"></Body>
|
||||||
|
<Body name="左二" path="Ren/Tou/PiFu/LeiGu/ZuoLei/2"></Body>
|
||||||
|
</Body>
|
||||||
|
<Body name="右肋" path="Ren/Tou/PiFu/LeiGu/YouLei">
|
||||||
|
<Body name="右一" path="Ren/Tou/PiFu/LeiGu/YouLei/1"></Body>
|
||||||
|
<Body name="右二" path="Ren/Tou/PiFu/LeiGu/YouLei/2"></Body>
|
||||||
|
</Body>
|
||||||
|
</Body>
|
||||||
|
</Body>
|
||||||
<Body name="肌肉" isBodyList="true">
|
<Body name="肌肉" isBodyList="true">
|
||||||
<Body name="111" path="Ren/Tou/JiRou/1">
|
<Body name="111" path="Ren/Tou/JiRou/1">
|
||||||
<ObjectToggle>
|
<ObjectToggle>
|
||||||
@ -58,46 +98,6 @@
|
|||||||
</ObjectToggle>
|
</ObjectToggle>
|
||||||
</Body>
|
</Body>
|
||||||
</Body>-->
|
</Body>-->
|
||||||
<Body name="骨骼系统" path="Ren/Tou/GuGe" isShow="false">
|
|
||||||
<Body name="肋骨" path="Ren/Tou/GuGe/LeiGu">
|
|
||||||
<Body name="左肋" path="Ren/Tou/GuGe/LeiGu/ZuoLei">
|
|
||||||
<Body name="左一" path="Ren/Tou/GuGe/LeiGu/ZuoLei/1" Tip="左一肋骨描述">
|
|
||||||
<ObjectToggle>
|
|
||||||
<Color isOn="0,255,255" isOff="255,255,255"></Color>
|
|
||||||
</ObjectToggle>
|
|
||||||
</Body>
|
|
||||||
<Body name="左二" path="Ren/Tou/GuGe/LeiGu/ZuoLei/2" Tip="左二肋骨描述">
|
|
||||||
<ObjectToggle>
|
|
||||||
<Color isOn="0,255,255" isOff="255,255,255"></Color>
|
|
||||||
</ObjectToggle>
|
|
||||||
</Body>
|
|
||||||
</Body>
|
|
||||||
<Body name="右肋" path="Ren/Tou/GuGe/LeiGu/YouLei">
|
|
||||||
<Body name="右一" path="Ren/Tou/GuGe/LeiGu/YouLei/1" Tip="7右一肋骨描述">
|
|
||||||
<ObjectToggle>
|
|
||||||
<Color isOn="0,255,255" isOff="255,255,255"></Color>
|
|
||||||
</ObjectToggle>
|
|
||||||
</Body>
|
|
||||||
<Body name="右二" path="Ren/Tou/GuGe/LeiGu/YouLei/2" Tip="右二肋骨描述">
|
|
||||||
<ObjectToggle>
|
|
||||||
<Color isOn="0,255,255" isOff="255,255,255"></Color>
|
|
||||||
</ObjectToggle>
|
|
||||||
</Body>
|
|
||||||
</Body>
|
|
||||||
</Body>
|
|
||||||
</Body>
|
|
||||||
<Body name="皮肤系统" path="Ren/Tou/PiFu" isShow="false">
|
|
||||||
<Body name="肋骨" path="Ren/Tou/PiFu/LeiGu">
|
|
||||||
<Body name="左肋" path="Ren/Tou/PiFu/LeiGu/ZuoLei">
|
|
||||||
<Body name="左一" path="Ren/Tou/PiFu/LeiGu/ZuoLei/1"></Body>
|
|
||||||
<Body name="左二" path="Ren/Tou/PiFu/LeiGu/ZuoLei/2"></Body>
|
|
||||||
</Body>
|
|
||||||
<Body name="右肋" path="Ren/Tou/PiFu/LeiGu/YouLei">
|
|
||||||
<Body name="右一" path="Ren/Tou/PiFu/LeiGu/YouLei/1"></Body>
|
|
||||||
<Body name="右二" path="Ren/Tou/PiFu/LeiGu/YouLei/2"></Body>
|
|
||||||
</Body>
|
|
||||||
</Body>
|
|
||||||
</Body>
|
|
||||||
</Body>
|
</Body>
|
||||||
<Body name="肩膀" icon="" path="Ren/JianBang" >
|
<Body name="肩膀" icon="" path="Ren/JianBang" >
|
||||||
<Body name="肩膀系统1" path="Ren/JianBang/Cube">
|
<Body name="肩膀系统1" path="Ren/JianBang/Cube">
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user