SpecificProfessionEquipmentPanel.cs 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110
  1. using System.Collections.Generic;
  2. using Common.Utility.CombatEvent;
  3. using Core.Language;
  4. using Fort23.Core;
  5. using Fort23.UTool;
  6. using GameLogic.Bag;
  7. using UnityEngine;
  8. namespace Fort23.Mono
  9. {
  10. [UIBinding(prefab = "SpecificProfessionEquipmentPanel" )]
  11. public partial class SpecificProfessionEquipmentPanel : UIPanel
  12. {
  13. private void Init()
  14. {
  15. }
  16. protected override void AddEvent()
  17. {
  18. }
  19. protected override void DelEvent()
  20. {
  21. }
  22. public override void AddButtonEvent()
  23. {
  24. btnBack.onClick.AddListener(OnclickClose);
  25. btnOnce.onClick.AddListener(OnclickOnce);
  26. }
  27. private bool isClickOnce = false;
  28. public int curZy;
  29. private void OnclickOnce()
  30. {
  31. isClickOnce = PlayerManager.Instance.eqController.EquipZyEqs(curZy);
  32. if (isClickOnce)
  33. {
  34. UIManager.Instance.DormancyAllGComponent<WidgetItem>("eq2");
  35. HeroUITools.UpdateZyEqIcon(curZy, eqs);
  36. }
  37. }
  38. private async void OnclickClose()
  39. {
  40. UIManager.Instance.HideUIUIPanel(this);
  41. UIManager.Instance.DormancyAllGComponent<WidgetItem>("eq2");
  42. if (isClickOnce)
  43. {
  44. UIManager.Instance.DormancyAllGComponent<WidgetItem>("eq");
  45. ProfessionEquipmentPanel professionEquipmentPanel = UIManager.Instance.GetComponent<ProfessionEquipmentPanel>();
  46. // ProfessionEquipmentPanel professionEquipmentPanel = await UIManager.Instance.LoadAndOpenPanel<ProfessionEquipmentPanel>(null);
  47. // professionEquipmentPanel.UpdateZyEqs(curZy);
  48. professionEquipmentPanel.UpdateAllEq();
  49. HeroPowerUpEventData data = new HeroPowerUpEventData();
  50. data.upType = HeroUpType.BasicEquip;
  51. EventManager.Instance.Dispatch(CustomEventType.HeroPowerUp, data);
  52. }
  53. }
  54. public void InitPanel(int zy)
  55. {
  56. isClickOnce = false;
  57. curZy = zy;
  58. SetZyInfo();
  59. HeroUITools.UpdateZyEqIcon(zy, eqs, poolName:"eq2");
  60. }
  61. private void SetZyInfo()
  62. {
  63. switch (curZy)
  64. { //
  65. case 1:
  66. SetZyTxt(97);
  67. zyBg.icon_name = "bg_warrior";
  68. break;
  69. case 2:
  70. SetZyTxt(98);
  71. zyBg.icon_name = "bg_priest";
  72. break;
  73. case 3:
  74. SetZyTxt(99);
  75. zyBg.icon_name = "bg_Mage";
  76. break;
  77. case 4:
  78. SetZyTxt(100);
  79. zyBg.icon_name = "bg_Archer";
  80. break;
  81. default:
  82. break;
  83. }
  84. SetZyBg(curZy);
  85. }
  86. private void SetZyTxt(int languageId)
  87. {
  88. zyTitle.text = LanguageManager.Instance.Text(languageId);
  89. miniTitle.text = LanguageManager.Instance.Text(languageId);
  90. }
  91. private void SetZyBg(int zy)
  92. {
  93. }
  94. }
  95. }