WidgetItem.cs 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. using GameLogic.Bag;
  2. using GameLogic.Equipment;
  3. using UnityEngine;
  4. namespace Fort23.Mono
  5. {
  6. [UIBinding(prefab = "WidgetItem" )]
  7. public partial class WidgetItem : UIComponent
  8. {
  9. public ItemInfo itemInfo;
  10. private WidgetItemColorConfig colorConfig;
  11. private void Init()
  12. {
  13. colorConfig = btnClick.gameObject.GetComponent<WidgetItemColorConfig>();
  14. }
  15. public override void AddEvent()
  16. {
  17. }
  18. public override void DelEvent()
  19. {
  20. }
  21. public override void AddButtonEvent()
  22. {
  23. }
  24. public void InitWidget(ItemInfo itemInfo)
  25. {
  26. this.itemInfo = itemInfo;
  27. numObj.SetActive(false);
  28. alertRed.SetActive(false);
  29. icon.gameObject.SetActive(true);
  30. if (itemInfo.eqInfo != null)
  31. {
  32. icon.icon_name = HeroUITools.GetEquipmentIconName(itemInfo);
  33. bg.color = colorConfig.bgColors[itemInfo.eqInfo.quality];
  34. corner.color = colorConfig.cornerColors[itemInfo.eqInfo.quality];
  35. light.color = colorConfig.lightColors[itemInfo.eqInfo.quality];
  36. border.color = colorConfig.borderColors[itemInfo.eqInfo.quality];
  37. glow.color = colorConfig.glowColors[itemInfo.eqInfo.quality];
  38. }
  39. else
  40. {
  41. icon.icon_name = itemInfo.config.icon;
  42. // switch (itemInfo.eqInfo.quality)
  43. // {
  44. // case 1:
  45. // case 2:
  46. // bg.color = colorConfig.bgColors[1];
  47. // break;
  48. // }
  49. // bg.color = Color.blue;
  50. }
  51. // if (itemInfo.config.itemTyp == 4)
  52. // {
  53. // itemInfo.eqInfo = PlayerManager.Instance.eqController
  54. // .BuildEquipment(itemInfo.config, 1, 1);
  55. // //itemInfo.eqInfo.InitEquipment(itemInfo.config,1,1);
  56. // }
  57. }
  58. public void SetEmpty()
  59. {
  60. numObj.SetActive(false);
  61. icon.gameObject.SetActive(false);
  62. alertRed.SetActive(false);
  63. corner.gameObject.SetActive(false);
  64. glow.gameObject.SetActive(false);
  65. bg.color = colorConfig.bgColors[0];
  66. light.color = colorConfig.lightColors[0];
  67. border.color = colorConfig.borderColors[0];
  68. }
  69. }
  70. }