SpecificProfessionEquipmentPanel.cs 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112
  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. //流光溢彩 别出心裁 千篇一律 呕心沥血
  30. private void OnclickOnce()
  31. {
  32. isClickOnce = PlayerManager.Instance.eqController.EquipZyEqs(curZy);
  33. if (isClickOnce)
  34. {
  35. UIManager.Instance.DormancyAllGComponent<WidgetItem>("eq2");
  36. HeroUITools.UpdateZyEqIcon(curZy, eqs);
  37. }
  38. }
  39. private async void OnclickClose()
  40. {
  41. UIManager.Instance.HideUIUIPanel(this);
  42. UIManager.Instance.DormancyAllGComponent<WidgetItem>("eq2");
  43. if (isClickOnce)
  44. {
  45. UIManager.Instance.DormancyAllGComponent<WidgetItem>("eq");
  46. ProfessionEquipmentPanel professionEquipmentPanel = UIManager.Instance.GetComponent<ProfessionEquipmentPanel>();
  47. // ProfessionEquipmentPanel professionEquipmentPanel = await UIManager.Instance.LoadAndOpenPanel<ProfessionEquipmentPanel>(null);
  48. // professionEquipmentPanel.UpdateZyEqs(curZy);
  49. professionEquipmentPanel.UpdateAllEq();
  50. HeroPowerUpEventData data = new HeroPowerUpEventData();
  51. data.upType = HeroUpType.BasicEquip;
  52. EventManager.Instance.Dispatch(CustomEventType.HeroPowerUp, data);
  53. }
  54. }
  55. public void InitPanel(int zy)
  56. {
  57. isClickOnce = false;
  58. curZy = zy;
  59. SetZyInfo();
  60. HeroUITools.UpdateZyEqIcon(zy, eqs, poolName:"eq2");
  61. }
  62. private void SetZyInfo()
  63. {
  64. switch (curZy)
  65. { //
  66. case 1:
  67. SetZyTxt(97);
  68. zyBg.icon_name = "bg_warrior";
  69. break;
  70. case 2:
  71. SetZyTxt(98);
  72. zyBg.icon_name = "bg_priest";
  73. break;
  74. case 3:
  75. SetZyTxt(99);
  76. zyBg.icon_name = "bg_Mage";
  77. break;
  78. case 4:
  79. SetZyTxt(100);
  80. zyBg.icon_name = "bg_Archer";
  81. break;
  82. default:
  83. break;
  84. }
  85. SetZyBg(curZy);
  86. }
  87. private void SetZyTxt(int languageId)
  88. {
  89. zyTitle.text = LanguageManager.Instance.Text(languageId);
  90. miniTitle.text = LanguageManager.Instance.Text(languageId);
  91. }
  92. private void SetZyBg(int zy)
  93. {
  94. }
  95. }
  96. }