SpecificProfessionEquipmentPanel.cs 3.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  1. using System.Collections.Generic;
  2. using Fort23.UTool;
  3. using GameLogic.Bag;
  4. using UnityEngine;
  5. namespace Fort23.Mono
  6. {
  7. [UIBinding(prefab = "SpecificProfessionEquipmentPanel" )]
  8. public partial class SpecificProfessionEquipmentPanel : UIPanel
  9. {
  10. private void Init()
  11. {
  12. }
  13. protected override void AddEvent()
  14. {
  15. }
  16. protected override void DelEvent()
  17. {
  18. }
  19. public override void AddButtonEvent()
  20. {
  21. btnBack.onClick.AddListener(OnclickClose);
  22. btnOnce.onClick.AddListener(OnclickOnce);
  23. }
  24. private void OnclickOnce()
  25. {
  26. PlayerManager.Instance.eqController.EquipZyEqs(curZy);
  27. HeroUITools.UpdateZyEqIcon(curZy, eqs);
  28. }
  29. private void OnclickClose()
  30. {
  31. UIManager.Instance.HideUIUIPanel(this);
  32. }
  33. public void InitPanel(int zy)
  34. {
  35. // SetEqs(zy);
  36. curZy = zy;
  37. HeroUITools.UpdateZyEqIcon(zy, eqs, 30);
  38. }
  39. public int curZy;
  40. private async void SetEqs(int zy)
  41. {
  42. curZy = zy;
  43. // foreach (GameObject eqGo in eqs)
  44. // {
  45. // WidgetItem eqItem = await UIManager.Instance.
  46. // CreateGComponentForObject<WidgetItem>(eqGo,
  47. // null, root:eqGo.GetComponent<RectTransform>());
  48. // LogTool.Log(eqGo + "设置");
  49. // eqItem.SetEmpty();
  50. // }
  51. HeroUITools.UpdateZyEqIcon(zy, eqs, 30);
  52. // if (PlayerManager.Instance.eqController.zyEqDic.TryGetValue(zy, out Dictionary<int ,List<ItemInfo>> bwDic))
  53. // {
  54. // foreach (KeyValuePair<int,List<ItemInfo>> keyValuePair in bwDic)
  55. // {
  56. // //遍历每个部位下的全部装备
  57. // foreach (ItemInfo eqInfo in keyValuePair.Value)
  58. // {
  59. // if (eqInfo.eqInfo.isEquip)
  60. // {
  61. // GameObject eqGo = eqs[keyValuePair.Key - 1] as GameObject;
  62. // WidgetItem eqItem = await UIManager.Instance.
  63. // CreateGComponentForObject<WidgetItem>(eqGo, null, root:eqGo.GetComponent<RectTransform>());
  64. // eqItem.InitWidget(eqInfo);
  65. // }
  66. // }
  67. // }
  68. // }
  69. // if (PlayerManager.Instance.eqController.zyEqDic.TryGetValue(zy, out var bwDic))
  70. // {
  71. // List<ItemInfo> eqList = BagController.Instance.EqDic[zy];
  72. // foreach (ItemInfo eqInfo in eqList)
  73. // {
  74. // if (eqInfo.eqInfo.isEquip)
  75. // {
  76. // // if(eqInfo.eqInfo.basicEquipConfig.Type)
  77. // GameObject eqGo = eqs[eqInfo.eqInfo.basicEquipConfig.Type - 1] as GameObject;
  78. // WidgetItem eqItem = await UIManager.Instance.
  79. // CreateGComponentForObject<WidgetItem>(eqGo, null, root:eqGo.GetComponent<RectTransform>());
  80. // eqItem.InitWidget(eqInfo);
  81. // }
  82. // }
  83. // }
  84. }
  85. }
  86. }