2025-05-09 10:20:30 +08:00

39 lines
1.1 KiB
C#

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using ZXKFramework;
using UnityEngine.UI;
public class ShiTuItem : MonoBehaviour
{
public GameObject model { get; set; }
ModelChildShowOne loTu;
OutLineManager outLineManager = new OutLineManager();
public void Init(GameObject tModel)
{
if (tModel == null) return;
model = tModel;
loTu = transform.FindFirst<ModelChildShowOne>("Tu");
outLineManager.Init(model.transform, model.GetComponent<QuickOutline.Outline>());
Transform loBtnParent = transform.FindFirst<Transform>("AllBtn");
if (loBtnParent != null && loBtnParent.childCount != 0)
{
foreach (Transform item in loBtnParent.transform)
{
item.GetComponent<Button>().onClick.AddListener(() =>
{
loTu?.ShowModel(item.name);
outLineManager?.OpenHightLightAndCloseOther(item.name);
});
}
}
}
public void ToReset()
{
loTu?.CloseAllModel();
outLineManager?.CloseAllOutLine();
}
}