WidgetItem.cs 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. using System;
  2. using Core.Language;
  3. using Fort23.UTool;
  4. using GameLogic.Bag;
  5. using GameLogic.Equipment;
  6. using UnityEngine;
  7. using Utility;
  8. namespace Fort23.Mono
  9. {
  10. [UIBinding(prefab = "WidgetItem")]
  11. public partial class WidgetItem : ItemWidgetBasic
  12. {
  13. public ItemInfo itemInfo;
  14. private void Init()
  15. {
  16. }
  17. public override void AddEvent()
  18. {
  19. }
  20. public override void DelEvent()
  21. {
  22. }
  23. public override void AddButtonEvent()
  24. {
  25. base.AddButtonEvent();
  26. }
  27. public void InitWidget(ItemInfo itemInfo)
  28. {
  29. this.itemInfo = itemInfo;
  30. icon.gameObject.SetActive(true);
  31. icon.icon_name = itemInfo.config.icon;
  32. Icon_WenHao.gameObject.SetActive(false);
  33. if (itemInfo.count.Value > 0)
  34. {
  35. Text_Count.gameObject.SetActive(true);
  36. Text_Count.text = itemInfo.count.Value.ToStringEx();
  37. }
  38. else
  39. {
  40. Text_Count.gameObject.SetActive(false);
  41. }
  42. }
  43. public void ShowWenhao()
  44. {
  45. Icon_WenHao.gameObject.SetActive(true);
  46. icon.gameObject.SetActive(false);
  47. Text_Count.gameObject.SetActive(false);
  48. }
  49. public override void DormancyObj()
  50. {
  51. transform.RecoverColor();
  52. base.DormancyObj();
  53. }
  54. }
  55. }