SpecificProfessionEquipmentPanel.cs 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. using System.Collections.Generic;
  2. using Common.Utility.CombatEvent;
  3. using Fort23.Core;
  4. using Fort23.UTool;
  5. using GameLogic.Bag;
  6. using UnityEngine;
  7. namespace Fort23.Mono
  8. {
  9. [UIBinding(prefab = "SpecificProfessionEquipmentPanel" )]
  10. public partial class SpecificProfessionEquipmentPanel : UIPanel
  11. {
  12. private void Init()
  13. {
  14. }
  15. protected override void AddEvent()
  16. {
  17. }
  18. protected override void DelEvent()
  19. {
  20. }
  21. public override void AddButtonEvent()
  22. {
  23. btnBack.onClick.AddListener(OnclickClose);
  24. btnOnce.onClick.AddListener(OnclickOnce);
  25. }
  26. private bool isClickOnce = false;
  27. public int curZy;
  28. private void OnclickOnce()
  29. {
  30. isClickOnce = PlayerManager.Instance.eqController.EquipZyEqs(curZy);
  31. HeroUITools.UpdateZyEqIcon(curZy, eqs);
  32. }
  33. private async void OnclickClose()
  34. {
  35. UIManager.Instance.HideUIUIPanel(this);
  36. UIManager.Instance.DormancyAllGComponent<WidgetItem>("eq2");
  37. if (isClickOnce)
  38. {
  39. ProfessionEquipmentPanel professionEquipmentPanel = UIManager.Instance.GetComponent<ProfessionEquipmentPanel>();
  40. // ProfessionEquipmentPanel professionEquipmentPanel = await UIManager.Instance.LoadAndOpenPanel<ProfessionEquipmentPanel>(null);
  41. professionEquipmentPanel.UpdateZyEqs(curZy);
  42. HeroPowerUpEventData data = new HeroPowerUpEventData();
  43. data.upType = HeroUpType.BasicEquip;
  44. EventManager.Instance.Dispatch(CustomEventType.HeroPowerUp, data);
  45. }
  46. }
  47. public void InitPanel(int zy)
  48. {
  49. isClickOnce = false;
  50. curZy = zy;
  51. HeroUITools.UpdateZyEqIcon(zy, eqs, poolName:"eq2");
  52. }
  53. }
  54. }