PlayerSkillInfoNestedCtrl.cs 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  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. public struct SkillInfoParam
  12. {
  13. public bool bShowRightBubble; // 是否显示右侧气泡类型
  14. public SkillTable skillInfo;
  15. }
  16. /// <summary>
  17. /// UI逻辑处理类
  18. /// </summary>
  19. /// <typeparam name=""></typeparam>
  20. public partial class PlayerSkillInfoNestedCtrl : UIController<PlayerSkillInfoNestedVM>
  21. {
  22. protected override void OnEnable(object intent)
  23. {
  24. AddUIListenres();
  25. if (intent is SkillInfoParam)
  26. {
  27. ShowSkillInfo((SkillInfoParam)intent);
  28. }
  29. }
  30. protected override void OnDisable()
  31. {
  32. RemoveUIListenres();
  33. }
  34. #region UI事件
  35. private void AddUIListenres()
  36. {
  37. }
  38. private void OnTouchEnd(EventContext context)
  39. {
  40. }
  41. private void RemoveUIListenres()
  42. {
  43. }
  44. #endregion
  45. /// <summary>
  46. /// 显示技能弹窗信息UI
  47. /// </summary>
  48. /// <param name="Show"></param>
  49. /// <param name="bPassive"></param>
  50. public void ShowSkillInfo(SkillInfoParam data)
  51. {
  52. SkillTable skillInfo = data.skillInfo;
  53. if (skillInfo != null)
  54. {
  55. VM.SkillIcon.icon = skillInfo.Icon;
  56. VM.SkillNameLabel.text = skillInfo.Name;
  57. VM.SkillDescLabel.text = skillInfo.Desc;
  58. int bubbleType = 0;
  59. if (skillInfo.ModalityType == 1) // 主动技能
  60. {
  61. VM.SkillCdLabel.text = (skillInfo.RestTime * 0.001f).ToString("F1");
  62. }
  63. else
  64. {
  65. bubbleType = 1;
  66. }
  67. VM.BubbleCtrl.selectedIndex = data.bShowRightBubble ? 2 : bubbleType;
  68. }
  69. }
  70. }
  71. }