VirtualFramework/Assets/Scripts/UI/UIBody3DInfo.cs

113 lines
3.5 KiB
C#
Raw Normal View History

2025-02-12 17:36:00 +08:00
using UnityEngine;
using UnityEngine.UI;
using QFramework;
using XMLTool;
using DG.Tweening;
using TMPro;
namespace QFramework.Example
{
public class UIBody3DInfoData : UIPanelData
2025-02-12 17:36:00 +08:00
{
public Body3D.Body body;
}
public partial class UIBody3DInfo : UIPanel
2025-02-12 17:36:00 +08:00
{
2025-02-13 11:02:16 +08:00
GameObject obj;
2025-02-12 17:36:00 +08:00
protected override void OnInit(IUIData uiData = null)
{
Group.onValueChanged.AddListener(isOn =>
{
TypeEventSystem.Global.Send<OnBody3DGroupTypeChanged>(new OnBody3DGroupTypeChanged() { isGroup = isOn });
if (isOn)
{
Group.transform.Find("Label").GetComponent<TextMeshProUGUI>().text = "<22><>ѡ";
}
else
{
Group.transform.Find("Label").GetComponent<TextMeshProUGUI>().text = "<22><>ѡ";
}
});
Active.onValueChanged.AddListener(isOn =>
{
obj.SetActive(isOn);
if (isOn)
{
Active.transform.Find("Label").GetComponent<TextMeshProUGUI>().text = "<22><><EFBFBD><EFBFBD>";
}
else
{
Active.transform.Find("Label").GetComponent<TextMeshProUGUI>().text = "<22><>ʾ";
}
});
Transparent.onValueChanged.AddListener(isOn =>
{
if (isOn)
{
Transparent.transform.Find("Label").GetComponent<TextMeshProUGUI>().text = <><CAB5>";
}
else
{
Transparent.transform.Find("Label").GetComponent<TextMeshProUGUI>().text = <><CDB8>";
}
Utility.SetSurfaceType(obj.GetComponent<MeshRenderer>().material, isOn);
});
Single.onClick.AddListener(() =>
{
2025-02-13 11:02:16 +08:00
Body3DController.Instance.Active(false);
Back.gameObject.SetActive(true);
Active.gameObject.SetActive(false);
Single.gameObject.SetActive(false);
Transparent.gameObject.SetActive(false);
TransparentOther.gameObject.SetActive(false);
2025-02-12 17:36:00 +08:00
});
TransparentOther.onValueChanged.AddListener(isOn =>
{
if (isOn)
{
TransparentOther.transform.Find("Label").GetComponent<TextMeshProUGUI>().text = <><CAB5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>";
}
else
{
TransparentOther.transform.Find("Label").GetComponent<TextMeshProUGUI>().text = <><CDB8><EFBFBD><EFBFBD><EFBFBD><EFBFBD>";
}
Body3DController.Instance.Transparent(obj, isOn, true);
});
2025-02-13 11:02:16 +08:00
Back.onClick.AddListener(() =>
{
Body3DController.Instance.Active(true);
Back.gameObject.SetActive(false);
Active.gameObject.SetActive(true);
Single.gameObject.SetActive(true);
Transparent.gameObject.SetActive(true);
TransparentOther.gameObject.SetActive(true);
});
}
protected override void OnOpen(IUIData uiData = null)
{
mData = uiData as UIBody3DInfoData ?? new UIBody3DInfoData();
2025-02-13 11:02:16 +08:00
PartName.text = mData.body.Name;
obj = Utility.FindObj(mData.body.Path);
2025-02-12 17:36:00 +08:00
}
protected override void OnShow()
{
}
protected override void OnHide()
{
}
protected override void OnClose()
{
}
}
}