SkillKongWidget.cs 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113
  1. using Common.Utility.CombatEvent;
  2. using Core.Event.Event;
  3. using Core.Language;
  4. using Excel2Json;
  5. using Fort23.Core;
  6. using Fort23.UTool;
  7. using GameLogic.Hero;
  8. using UnityEngine;
  9. using UnityEngine.EventSystems;
  10. namespace Fort23.Mono
  11. {
  12. [UIBinding(prefab = "SkillKongWidget")]
  13. public partial class SkillKongWidget : ItemWidgetBasic
  14. {
  15. public int index;
  16. private SkillSelectPanel skillSelectPanel;
  17. public SkillInfo SkillInfo;
  18. protected bool _isSelect;
  19. private void Init()
  20. {
  21. }
  22. public override void AddEvent()
  23. {
  24. }
  25. public override void DelEvent()
  26. {
  27. }
  28. public override CTask<bool> AsyncInit(object[] uiData)
  29. {
  30. isAddLongPressBtn = (bool)uiData[0];
  31. return base.AsyncInit(uiData);
  32. }
  33. public override void AddButtonEvent()
  34. {
  35. // myButton.onClick = delegate
  36. // {
  37. // skillSelectPanel.SelectKongSkill(this);
  38. // };
  39. // myButton.OnPressAndHold = delegate
  40. // {
  41. // if (SkillInfo == null)
  42. // {
  43. // return;
  44. // }
  45. //
  46. // SkillConfig skillConfig= SkillInfo.skillConfig;
  47. // SkillMassgePanel.OpenSkillSelectPanel(LanguageManager.Instance.Text(skillConfig.name) , LanguageManager.Instance.Text(skillConfig.dec));
  48. // };
  49. base.AddButtonEvent();
  50. // //添加拖拽事件
  51. // longPressBtn.onDragStart = OnDragStart;
  52. // longPressBtn.onDrag = OnDrag;
  53. // longPressBtn.onDragEnd = OnDragEnd;
  54. }
  55. public void SelectState(bool isSelect)
  56. {
  57. _isSelect = isSelect;
  58. myBg.color = _isSelect ? Color.green : new Color32(44, 67, 71, 200);
  59. }
  60. public override void DormancyObj()
  61. {
  62. base.DormancyObj();
  63. Cleared();
  64. }
  65. public void Cleared()
  66. {
  67. this.SkillInfo = null;
  68. icon.gameObject.SetActive(false);
  69. }
  70. public void SetSKill(SkillInfo skillId)
  71. {
  72. if (skillId == null)
  73. {
  74. return;
  75. }
  76. skillId.index = index;
  77. this.SkillInfo = skillId;
  78. icon.gameObject.SetActive(true);
  79. SkillConfig skillConfig = SkillInfo.skillConfig;
  80. icon.icon_name = skillConfig.icon;
  81. Text_Tips.gameObject.SetActive(skillConfig.ID != 0 && skillConfig.SkillType == 2);
  82. }
  83. public void InitWidget(int index, SkillSelectPanel skillSelectPanel)
  84. {
  85. this.skillSelectPanel = skillSelectPanel;
  86. this.index = index;
  87. icon.gameObject.SetActive(false);
  88. SkillInfo = null;
  89. Text_Tips.gameObject.SetActive(false);
  90. }
  91. }
  92. }