PlayerSkillInfoNestedCtrl.cs 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  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 != null)
  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. //VM.Panel.onTouchEnd.Add(OnTouchEnd);
  38. }
  39. private void OnTouchEnd(EventContext context)
  40. {
  41. }
  42. private void RemoveUIListenres()
  43. {
  44. }
  45. #endregion
  46. /// <summary>
  47. /// 显示技能弹窗信息UI
  48. /// </summary>
  49. /// <param name="Show"></param>
  50. /// <param name="bPassive"></param>
  51. public void ShowSkillInfo(SkillInfoParam data)
  52. {
  53. SkillTable skillInfo = data.skillInfo;
  54. if (skillInfo != null)
  55. {
  56. VM.SkillIcon.icon = skillInfo.Icon;
  57. VM.SkillNameLabel.text = skillInfo.Name;
  58. VM.SkillDescLabel.text = skillInfo.Desc;
  59. int bubbleType = 0;
  60. if (skillInfo.ModalityType == 1) // 主动技能
  61. {
  62. VM.SkillCdLabel.text = (skillInfo.RestTime * 0.001f).ToString("F1");
  63. }
  64. else
  65. {
  66. bubbleType = 1;
  67. }
  68. VM.BubbleCtrl.selectedIndex = data.bShowRightBubble ? 2 : bubbleType;
  69. }
  70. }
  71. }
  72. }