PlayerJobPreviewItemNestedCtrl.cs 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  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 PlayerJobPreviewItemNestedCtrl : UIController<PlayerJobPreviewItemNestedVM>
  16. {
  17. private careerTable _jobInfo;
  18. protected override void OnEnable(object intent)
  19. {
  20. AddUIListenres();
  21. }
  22. protected override void OnDisable()
  23. {
  24. RemoveUIListenres();
  25. }
  26. #region UI事件
  27. private void AddUIListenres()
  28. {
  29. VM.ClickJobBtn.onClick.Add(OnClickClickJobBtn);
  30. }
  31. private void RemoveUIListenres()
  32. {
  33. VM.ClickJobBtn.onClick.Remove(OnClickClickJobBtn);
  34. }
  35. private void OnClickClickJobBtn(EventContext context)
  36. {
  37. Context.UI.OpenAsync(UIKeys.PlayerJobInformationPanel, _jobInfo);
  38. }
  39. #endregion
  40. public void ShowUI(careerTable jobInfo, bool bSelect)
  41. {
  42. _jobInfo = jobInfo;
  43. if (jobInfo == null) return;
  44. //VM.JobIcon.icon = jobInfo.Picture;
  45. VM.NameLabel.text = jobInfo.Name;
  46. VM.SelectCtrl.selectedIndex = bSelect ? 1 : 0;
  47. }
  48. }
  49. }