PlayerAdvacnceSkilNestedCtrl.cs 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. /// #pkgName FGUI包名
  2. /// #panelName UIPanel名字
  3. /// #UIName = $"{#pkgName}{#panelName}" UIKey名字
  4. /// 该脚本由模板创建
  5. /// created by cb 2024
  6. using FairyGUI;
  7. using XGame.Database;
  8. using XGame.Framework.UI;
  9. namespace FL.FGUI
  10. {
  11. /// <summary>
  12. /// UI逻辑处理类
  13. /// </summary>
  14. /// <typeparam name=""></typeparam>
  15. public partial class PlayerAdvacnceSkilNestedCtrl : UIController<PlayerAdvacnceSkilNestedVM>
  16. {
  17. protected override void OnEnable(object intent)
  18. {
  19. AddUIListenres();
  20. }
  21. protected override void OnDisable()
  22. {
  23. RemoveUIListenres();
  24. }
  25. #region UI事件
  26. private void AddUIListenres()
  27. {
  28. VM.SkillIconBtn.onClick.Add(OnClickSkillIconBtn);
  29. VM.PassiveSkillIconBtn.onClick.Add(OnClickPassiveSkillIconBtn);
  30. }
  31. private void RemoveUIListenres()
  32. {
  33. VM.SkillIconBtn.onClick.Remove(OnClickSkillIconBtn);
  34. VM.PassiveSkillIconBtn.onClick.Remove(OnClickPassiveSkillIconBtn);
  35. }
  36. private void OnClickSkillIconBtn(EventContext context)
  37. {
  38. }
  39. private void OnClickPassiveSkillIconBtn(EventContext context)
  40. {
  41. }
  42. #endregion
  43. public void ShowUI(int skillId)
  44. {
  45. var skillInfo = SkillTableRepo.Get(skillId);
  46. if (skillInfo != null)
  47. {
  48. bool bPassive = skillInfo.ModalityType == 2;
  49. VM.SkillTypeCtrl.selectedIndex = bPassive ? 1 : 0;
  50. if (bPassive)
  51. {
  52. VM.PassiveSkillIconBtn.icon = skillInfo.Icon;
  53. }
  54. else
  55. {
  56. VM.SkillIconBtn.icon = skillInfo.Icon;
  57. }
  58. VM.SkillNameLabel.text = skillInfo.Name;
  59. VM.SkillDescLabel.text = skillInfo.Desc;
  60. }
  61. }
  62. }
  63. }