SpecificProfessionEquipmentPanel.cs 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181
  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>(poolName : SpecificEqsPoolName);
  74. HeroUITools.UpdateZyEqIcon(curZy, eqs, poolName : SpecificEqsPoolName);
  75. altertRed.SetActive(false);
  76. }
  77. }
  78. private void SendWearEvent()
  79. {
  80. // ProfessionEquipmentPanel professionEquipmentPanel = UIManager.Instance.GetComponent<ProfessionEquipmentPanel>();
  81. //
  82. // professionEquipmentPanel.UpdateAllEq();
  83. HeroEquipEventData data = new HeroEquipEventData();
  84. data.zy = curZy;
  85. // EventManager.Instance.Dispatch(CustomEventType.HeroPowerUp, data);
  86. EventManager.Instance.Dispatch(CustomEventType.HeroEquip, data);
  87. }
  88. private async void OnclickClose()
  89. {
  90. UIManager.Instance.HideUIUIPanel(this);
  91. closeAction?.Invoke();
  92. UIManager.Instance.DormancyAllGComponent<WidgetItem>(SpecificEqsPoolName);
  93. if (isClickOnce)
  94. {
  95. // UIManager.Instance.DormancyAllGComponent<WidgetItem>("eq");
  96. }
  97. }
  98. private string SpecificEqsPoolName = "eq2";
  99. private Action closeAction;
  100. public void InitPanel(int zy, Action action = null)
  101. {
  102. isClickOnce = false;
  103. curZy = zy;
  104. closeAction = action;
  105. SetZyInfo();
  106. UIManager.Instance.DormancyAllGComponent<WidgetItem>(SpecificEqsPoolName);
  107. HeroUITools.UpdateZyEqIcon(zy, eqs, poolName : SpecificEqsPoolName);
  108. if (PlayerManager.Instance.eqController.IsBetterEqs4OneZy(curZy))
  109. {
  110. altertRed.SetActive(true);
  111. }
  112. else
  113. {
  114. altertRed.SetActive(false);
  115. }
  116. }
  117. private void SetZyInfo()
  118. {
  119. switch (curZy)
  120. { //
  121. case 1:
  122. SetZyTxt(97);
  123. zyBg.icon_name = "bg_warrior";
  124. colorBg.color = new Color(255, 215, 0);
  125. break;
  126. case 2:
  127. SetZyTxt(98);
  128. zyBg.icon_name = "bg_priest";
  129. colorBg.color = new Color(128, 0, 128);
  130. break;
  131. case 3:
  132. SetZyTxt(99);
  133. zyBg.icon_name = "bg_Mage";
  134. colorBg.color = new Color(255, 255, 204);
  135. break;
  136. case 4:
  137. SetZyTxt(100);
  138. zyBg.icon_name = "bg_Archer";
  139. colorBg.color = new Color(0, 128, 0);
  140. break;
  141. default:
  142. break;
  143. }
  144. }
  145. private void SetZyTxt(int languageId)
  146. {
  147. zyTitle.text = LanguageManager.Instance.Text(languageId);
  148. miniTitle.text = LanguageManager.Instance.Text(languageId);
  149. }
  150. private void SetZyBg(int zy)
  151. {
  152. }
  153. }
  154. }