using UnityEngine; using UnityEngine.UI; using TableConfig; namespace Snxxz.UI { public class ModelShowPerfab : MonoBehaviour { [SerializeField] public Text titleText; [SerializeField] public RawImage modelImg; [SerializeField] public Text fightPowerText; [SerializeField] public GameObject fightImg; ModelShowType showType; public void OnDisable() { switch (showType) { case ModelShowType.treasure: UI3DTreasureExhibition.Instance.StopShow(); break; case ModelShowType.mount: break; case ModelShowType.pet: break; } } public void SetModelShow(int id, ModelShowType showType, string title, int fightValue = 0) { titleText.text = title; this.showType = showType; switch (showType) { case ModelShowType.treasure: UI3DTreasureExhibition.Instance.BeginShowTreasure(id, modelImg); break; case ModelShowType.mount: UI3DModelExhibition.Instance.BeginShowHourse(id, modelImg); break; case ModelShowType.pet: var config = Config.Instance.Get(id); UI3DModelExhibition.Instance.BeginShowNPC(id, config.UIModeLOffset, config.UIModelRotation, modelImg); break; } if (fightValue == 0) { fightImg.SetActive(false); fightPowerText.gameObject.SetActive(false); } else { fightImg.SetActive(true); fightPowerText.gameObject.SetActive(true); fightPowerText.text = fightValue.ToString(); } } } public enum ModelShowType { treasure, //法宝 mount, //坐骑 pet, } }