using UnityEngine; using UnityEngine.UI; using System.Collections.Generic; namespace Snxxz.UI { public class ModelShowPerfab : MonoBehaviour { [SerializeField] public Text titleText; [SerializeField] public RawImage modelImg; [SerializeField] public Text fightPowerText; [SerializeField] public Image fightImg; ModelShowType showType; FashionDressModel fashionDressModel { get { return ModelCenter.Instance.GetModel(); } } ItemTipsModel tipsModel { get { return ModelCenter.Instance.GetModel(); } } 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: fightImg.SetSprite("FightingLv_Normal"); UI3DTreasureExhibition.Instance.BeginShowTreasure(id, modelImg); break; case ModelShowType.mount: fightImg.SetSprite("FightingLv_Max"); UI3DModelExhibition.Instance.ShowHourse(id, modelImg); break; case ModelShowType.pet: fightImg.SetSprite("FightingLv_Max"); var npcConfig = NPCConfig.Get(id); UI3DModelExhibition.Instance.ShowNPC(id, npcConfig.UIModeLOffset, npcConfig.UIModelRotation, modelImg); break; case ModelShowType.FashionDress: fightImg.SetSprite("FightingLv_Normal"); var itemConfig = ItemConfig.Get(id); if(itemConfig != null) { int fashionType = 0; int fashionId = 0; bool isFashion = tipsModel.TryGetItemFashionData(itemConfig.ID, out fashionType, out fashionId); if(isFashion) { List fashionIds = null; fashionDressModel.TryGetFashionIds(fashionType, out fashionIds); if(fashionIds != null && fashionIds.Count > 0) { UI3DModelExhibition.Instance.ShowPlayer(modelImg, SetFashionDressData(fashionIds)); } } } break; } if (fightValue == 0) { fightImg.gameObject.SetActive(false); fightPowerText.gameObject.SetActive(false); } else { fightImg.gameObject.SetActive(true); fightPowerText.gameObject.SetActive(true); fightPowerText.text = fightValue.ToString(); fightImg.SetNativeSize(); } } public UI3DPlayerExhibitionData SetFashionDressData(List fashionIds) { var job = PlayerDatas.Instance.baseData.Job; var fashionClothesId = 0; var fashionWeaponId = 0; var fashionSecondaryId = 0; foreach(var fashionId in fashionIds) { FashionDress fashionDress = null; bool isFashion = fashionDressModel.TryGetFashionDress(fashionId, out fashionDress); if (isFashion) { int itemId = fashionDress.requireLevelUpItem; var itemConfig = ItemConfig.Get(itemId); switch (fashionDress.fashionDressType) { case 1: fashionClothesId = fashionDress.GetEquipItemId(); break; case 2: fashionWeaponId = fashionDress.GetEquipItemId(); break; case 3: fashionSecondaryId = fashionDress.GetEquipItemId(); break; } } } var data = new UI3DPlayerExhibitionData() { job = job, fashionClothesId = fashionClothesId, fashionWeaponId = fashionWeaponId, fashionSecondaryId = fashionSecondaryId, isDialogue = false, }; return data; } } public enum ModelShowType { treasure, //法宝 mount, //坐骑 pet, //灵宠 FashionDress, //时装 } }