using Core.Language; using GameLogic.Bag; using TMPro; using UnityEngine; using UnityEngine.UI; using Utility; namespace Fort23.Mono { [UIBinding(prefab = "ItemPanel")] public partial class ItemPanel : UIPanel { private void Init() { } protected override void AddEvent() { } protected override void DelEvent() { } public override void AddButtonEvent() { btnBack.onClick.AddListener(OnclickClose); btnDi.onClick.AddListener(OnclickClose2); } private void OnclickClose2() { OnclickClose(); } private void OnclickClose() { UIManager.Instance.HideUIUIPanel(this); eqItem.own.SetActive(false); //UIManager.Instance.DormancyGComponent(eqItem); } private WidgetItem eqItem; public async void InitItemPanel(ItemInfo itemInfo) { foreach (GameObject gameObject in attIcon) { gameObject.transform.parent.gameObject.SetActive(false); } // // foreach (GameObject gameObject in attValue) // { // gameObject.SetActive(false); // } eqItem = await UIManager.Instance.CreateGComponentForObject(item, null, root: itemRoot); eqItem.InitWidget(itemInfo); if (itemInfo.eqInfo != null) { txtlName.text = LanguageManager.Instance.Text(itemInfo.eqInfo.basicEquipConfig.eqName); zyIcon.gameObject.SetActive(true); zyIcon.icon_name = HeroUITools.GetZyIcon(itemInfo.eqInfo.basicEquipConfig.profession); desc.text = LanguageManager.Instance.Text(itemInfo.eqInfo.basicEquipConfig.desc); for (int i = 0; i < itemInfo.eqInfo.basicEquipConfig.AttType.Length; i++) { int attType = itemInfo.eqInfo.basicEquipConfig.AttType[i]; int attValue = itemInfo.eqInfo.basicEquipConfig.AttValue[i]; SetAttUI(attType, attValue, i); } } else { zyIcon.gameObject.SetActive(false); txtlName.text = LanguageManager.Instance.Text(itemInfo.config.itemName); desc.text = LanguageManager.Instance.Text(itemInfo.config.itemDesc); } } private void SetAttUI(int type, int value, int idx) { GameObject iconGo = attIcon[idx] as GameObject; GameObject attGo = attValue[idx] as GameObject; iconGo.transform.parent.gameObject.SetActive(true); attGo.GetComponent().text = value.ToStringEx(); if (type == 1) { iconGo.GetComponent().icon_name = "icon_at_hp"; } else if (type == 2) { iconGo.GetComponent().icon_name = "icon_att_Sword02"; } else if (type == 3) { iconGo.GetComponent().icon_name = "icon_att_Shield"; } } } }