SpecificProfessionEquipmentPanel.cs 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170
  1. using System;
  2. using System.Collections.Generic;
  3. using Common.Utility.CombatEvent;
  4. using Core.Language;
  5. using Fort23.Core;
  6. using Fort23.UTool;
  7. using GameLogic.Bag;
  8. using UnityEngine;
  9. namespace Fort23.Mono
  10. {
  11. [UIBinding(prefab = "SpecificProfessionEquipmentPanel" )]
  12. public partial class SpecificProfessionEquipmentPanel : UIPanel
  13. {
  14. private void Init()
  15. {
  16. }
  17. protected override void AddEvent()
  18. {
  19. }
  20. protected override void DelEvent()
  21. {
  22. }
  23. public override void AddButtonEvent()
  24. {
  25. btnBack.onClick.AddListener(OnclickClose);
  26. btnOnce.onClick.AddListener(OnclickOnce);
  27. btnZs.onClick.AddListener(OnclickZS);
  28. btnFs.onClick.AddListener(OnclickFS);
  29. btnMs.onClick.AddListener(OnclickMS);
  30. btnYx.onClick.AddListener(OnclickYX);
  31. }
  32. private void OnclickZS()
  33. {
  34. if (curZy == 1)
  35. {
  36. return;
  37. }
  38. HeroUITools.OpenSpecificProfessionEquipmentPanel(1);
  39. }
  40. private void OnclickFS()
  41. {
  42. if (curZy == 2)
  43. {
  44. return;
  45. }
  46. HeroUITools.OpenSpecificProfessionEquipmentPanel(2);
  47. }
  48. private void OnclickMS()
  49. {
  50. if (curZy == 3)
  51. {
  52. return;
  53. }
  54. HeroUITools.OpenSpecificProfessionEquipmentPanel(3);
  55. }
  56. private void OnclickYX()
  57. {
  58. if (curZy == 4)
  59. {
  60. return;
  61. }
  62. HeroUITools.OpenSpecificProfessionEquipmentPanel(4);
  63. }
  64. private bool isClickOnce = false;
  65. public int curZy;
  66. //流光溢彩 别出心裁 千篇一律 呕心沥血
  67. private void OnclickOnce()
  68. {
  69. isClickOnce = PlayerManager.Instance.eqController.QuickEquip(curZy);
  70. if (isClickOnce)
  71. {
  72. SendWearEvent();
  73. UIManager.Instance.DormancyAllGComponent<WidgetItem>("eq2");
  74. HeroUITools.UpdateZyEqIcon(curZy, eqs);
  75. }
  76. }
  77. private void SendWearEvent()
  78. {
  79. // ProfessionEquipmentPanel professionEquipmentPanel = UIManager.Instance.GetComponent<ProfessionEquipmentPanel>();
  80. //
  81. // professionEquipmentPanel.UpdateAllEq();
  82. HeroEquipEventData data = new HeroEquipEventData();
  83. data.zy = curZy;
  84. // EventManager.Instance.Dispatch(CustomEventType.HeroPowerUp, data);
  85. EventManager.Instance.Dispatch(CustomEventType.HeroEquip, data);
  86. }
  87. private async void OnclickClose()
  88. {
  89. UIManager.Instance.HideUIUIPanel(this);
  90. closeAction?.Invoke();
  91. UIManager.Instance.DormancyAllGComponent<WidgetItem>(spoolName);
  92. if (isClickOnce)
  93. {
  94. UIManager.Instance.DormancyAllGComponent<WidgetItem>("eq");
  95. }
  96. }
  97. private string spoolName = "eq2";
  98. private Action closeAction;
  99. public void InitPanel(int zy, Action action = null)
  100. {
  101. isClickOnce = false;
  102. curZy = zy;
  103. closeAction = action;
  104. SetZyInfo();
  105. UIManager.Instance.DormancyAllGComponent<WidgetItem>(spoolName);
  106. HeroUITools.UpdateZyEqIcon(zy, eqs, poolName : spoolName);
  107. }
  108. private void SetZyInfo()
  109. {
  110. switch (curZy)
  111. { //
  112. case 1:
  113. SetZyTxt(97);
  114. zyBg.icon_name = "bg_warrior";
  115. colorBg.color = new Color(255, 215, 0);
  116. break;
  117. case 2:
  118. SetZyTxt(98);
  119. zyBg.icon_name = "bg_priest";
  120. colorBg.color = new Color(128, 0, 128);
  121. break;
  122. case 3:
  123. SetZyTxt(99);
  124. zyBg.icon_name = "bg_Mage";
  125. colorBg.color = new Color(255, 255, 204);
  126. break;
  127. case 4:
  128. SetZyTxt(100);
  129. zyBg.icon_name = "bg_Archer";
  130. colorBg.color = new Color(0, 128, 0);
  131. break;
  132. default:
  133. break;
  134. }
  135. }
  136. private void SetZyTxt(int languageId)
  137. {
  138. zyTitle.text = LanguageManager.Instance.Text(languageId);
  139. miniTitle.text = LanguageManager.Instance.Text(languageId);
  140. }
  141. private void SetZyBg(int zy)
  142. {
  143. }
  144. }
  145. }