SpecificProfessionEquipmentPanel.cs 3.5 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.QuickEquip(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. colorBg.color = new Color(255, 215, 0);
  70. break;
  71. case 2:
  72. SetZyTxt(98);
  73. zyBg.icon_name = "bg_priest";
  74. colorBg.color = new Color(128, 0, 128);
  75. break;
  76. case 3:
  77. SetZyTxt(99);
  78. zyBg.icon_name = "bg_Mage";
  79. colorBg.color = new Color(255, 255, 204);
  80. break;
  81. case 4:
  82. SetZyTxt(100);
  83. zyBg.icon_name = "bg_Archer";
  84. colorBg.color = new Color(0, 128, 0);
  85. break;
  86. default:
  87. break;
  88. }
  89. }
  90. private void SetZyTxt(int languageId)
  91. {
  92. zyTitle.text = LanguageManager.Instance.Text(languageId);
  93. miniTitle.text = LanguageManager.Instance.Text(languageId);
  94. }
  95. private void SetZyBg(int zy)
  96. {
  97. }
  98. }
  99. }