SpecificProfessionEquipmentPanel.cs 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  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. if (isClickOnce)
  32. {
  33. UIManager.Instance.DormancyAllGComponent<WidgetItem>("eq2");
  34. HeroUITools.UpdateZyEqIcon(curZy, eqs);
  35. }
  36. }
  37. private async void OnclickClose()
  38. {
  39. UIManager.Instance.HideUIUIPanel(this);
  40. UIManager.Instance.DormancyAllGComponent<WidgetItem>("eq2");
  41. if (isClickOnce)
  42. {
  43. UIManager.Instance.DormancyAllGComponent<WidgetItem>("eq");
  44. ProfessionEquipmentPanel professionEquipmentPanel = UIManager.Instance.GetComponent<ProfessionEquipmentPanel>();
  45. // ProfessionEquipmentPanel professionEquipmentPanel = await UIManager.Instance.LoadAndOpenPanel<ProfessionEquipmentPanel>(null);
  46. // professionEquipmentPanel.UpdateZyEqs(curZy);
  47. professionEquipmentPanel.UpdateAllEq();
  48. HeroPowerUpEventData data = new HeroPowerUpEventData();
  49. data.upType = HeroUpType.BasicEquip;
  50. EventManager.Instance.Dispatch(CustomEventType.HeroPowerUp, data);
  51. }
  52. }
  53. public void InitPanel(int zy)
  54. {
  55. isClickOnce = false;
  56. curZy = zy;
  57. HeroUITools.UpdateZyEqIcon(zy, eqs, poolName:"eq2");
  58. }
  59. }
  60. }