2025-02-11 16:42:39 +08:00
|
|
|
using UnityEngine;
|
|
|
|
|
using UnityEngine.UI;
|
|
|
|
|
using QFramework;
|
|
|
|
|
using TMPro;
|
|
|
|
|
using UnityEngine.SceneManagement;
|
|
|
|
|
using System;
|
|
|
|
|
|
|
|
|
|
namespace QFramework.Example
|
|
|
|
|
{
|
|
|
|
|
public class UI3DObjSelectData : UIPanelData
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
public partial class UI3DObjSelect : UIPanel
|
|
|
|
|
{
|
|
|
|
|
protected override void OnInit(IUIData uiData = null)
|
|
|
|
|
{
|
|
|
|
|
mData = uiData as UI3DObjSelectData ?? new UI3DObjSelectData();
|
|
|
|
|
// please add init code here
|
2025-03-19 11:05:35 +08:00
|
|
|
CloseBtn.onClick.AddListener(() =>
|
|
|
|
|
{
|
|
|
|
|
Application.Quit();
|
|
|
|
|
});
|
2025-02-11 16:42:39 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
protected override void OnOpen(IUIData uiData = null)
|
|
|
|
|
{
|
|
|
|
|
Content.RemoveAllChildren();
|
|
|
|
|
int index = 0;
|
2025-02-12 17:36:00 +08:00
|
|
|
foreach (var item in Global.Instance.curModule.body3d.parts)
|
2025-02-11 16:42:39 +08:00
|
|
|
{
|
|
|
|
|
GameObject obj = GameObject.Instantiate(BtnItem.gameObject, Content);
|
|
|
|
|
obj.transform.Find("Label").GetComponent<TextMeshProUGUI>().text = item.Key;
|
|
|
|
|
obj.GetComponent<Button>().onClick.AddListener(() =>
|
|
|
|
|
{
|
2025-02-12 17:36:00 +08:00
|
|
|
Global.Instance.cur3DPart = Global.Instance.curModule.body3d.parts[item.Key];
|
|
|
|
|
TypeEventSystem.Global.Send<OnBody3DStart>();
|
2025-02-11 16:42:39 +08:00
|
|
|
UIBody3DData data = new UIBody3DData();
|
2025-02-12 17:36:00 +08:00
|
|
|
data.body = Global.Instance.cur3DPart;
|
2025-02-11 16:42:39 +08:00
|
|
|
UIKit.OpenPanelAsync<UIBody3D>(canvasLevel: UILevel.PopUI, uiData: data).ToAction().StartGlobal(() =>
|
|
|
|
|
{
|
|
|
|
|
Hide();
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
index++;
|
|
|
|
|
}
|
2025-03-19 11:05:35 +08:00
|
|
|
|
|
|
|
|
var more = GameObject.Instantiate(More.gameObject, Content);
|
2025-02-11 16:42:39 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
protected override void OnShow()
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
protected override void OnHide()
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
protected override void OnClose()
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|