PlayerSkillInfoNestedCtrl.cs 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. /// #pkgName FGUI包名
  2. /// #panelName UIPanel名字
  3. /// #UIName = $"{#pkgName}{#panelName}" UIKey名字
  4. /// 该脚本由模板创建
  5. /// created by cb 2024
  6. using FairyGUI;
  7. using System;
  8. using XGame;
  9. using XGame.Database;
  10. using XGame.Framework.UI;
  11. namespace FL.FGUI
  12. {
  13. public struct SkillInfoParam
  14. {
  15. public bool bShowRightBubble; // 是否显示右侧气泡类型
  16. public SkillTable skillInfo;
  17. }
  18. /// <summary>
  19. /// UI逻辑处理类
  20. /// </summary>
  21. /// <typeparam name=""></typeparam>
  22. public partial class PlayerSkillInfoNestedCtrl : UIController<PlayerSkillInfoNestedVM>
  23. {
  24. protected override void OnEnable(object intent)
  25. {
  26. AddUIListenres();
  27. if (intent != null)
  28. {
  29. ShowSkillInfo((SkillInfoParam)intent);
  30. }
  31. }
  32. protected override void OnDisable()
  33. {
  34. RemoveUIListenres();
  35. }
  36. #region UI事件
  37. private void AddUIListenres()
  38. {
  39. //VM.Panel.onTouchEnd.Add(OnTouchEnd);
  40. }
  41. private void OnTouchEnd(EventContext context)
  42. {
  43. }
  44. private void RemoveUIListenres()
  45. {
  46. }
  47. #endregion
  48. /// <summary>
  49. /// 显示技能弹窗信息UI
  50. /// </summary>
  51. /// <param name="Show"></param>
  52. /// <param name="bPassive"></param>
  53. public void ShowSkillInfo(SkillInfoParam data)
  54. {
  55. SkillTable skillInfo = data.skillInfo;
  56. if (skillInfo != null)
  57. {
  58. VM.SkillIcon.icon = skillInfo.Icon;
  59. VM.SkillNameLabel.text = skillInfo.Name;
  60. VM.SkillDescLabel.text = skillInfo.Desc;
  61. int bubbleType = 0;
  62. if (skillInfo.ModalityType == 1) // 主动技能
  63. {
  64. VM.SkillCdLabel.text = (skillInfo.RestTime * 0.001f).ToString("F1");
  65. }
  66. else
  67. {
  68. bubbleType = 1;
  69. }
  70. VM.BubbleCtrl.selectedIndex = data.bShowRightBubble ? 2 : bubbleType;
  71. }
  72. }
  73. }
  74. }