123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105 |
- 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<WidgetItem>(item, null,
- root: itemRoot);
- eqItem.InitWidget(itemInfo);
- if (itemInfo.eqInfo != null)
- {
- txtlName.text = LanguageManager.Instance.Text(itemInfo.eqInfo.basicEquipConfig.eqName);
- 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
- {
- 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<TextMeshProUGUI>().text = value.ToStringEx();
- if (type == 1)
- {
- iconGo.GetComponent<MyImage>().icon_name = "icon_at_hp";
- }
- else if (type == 2)
- {
- iconGo.GetComponent<MyImage>().icon_name = "icon_att_Sword02";
- }
- else if (type == 3)
- {
- iconGo.GetComponent<MyImage>().icon_name = "icon_att_Shield";
- }
- }
- }
- }
|