PartnerSbItemCtrl.cs 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. /// #pkgName FGUI包名
  2. /// #panelName UIPanel名字
  3. /// #UIName = $"{#pkgName}{#panelName}" UIKey名字
  4. /// 该脚本由模板创建
  5. /// created by cb 2024
  6. using FairyGUI;
  7. using FL.Data;
  8. using XGame.Framework.UI;
  9. namespace FL.FGUI
  10. {
  11. /// <summary>
  12. /// UI逻辑处理类
  13. /// </summary>
  14. /// <typeparam name=""></typeparam>
  15. public partial class PartnerSbItemCtrl : UIController<PartnerSbItemVM>
  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. private void RemoveUIListenres() { }
  28. #endregion
  29. public void ShowUI(int id)
  30. {
  31. VM.PartnerBase.Ctrl.ShowUI(id, true);
  32. bool isEmpty = id <= 0;
  33. VM.IsEmpty.selectedIndex = isEmpty ? 1 : 0;
  34. if (isEmpty)
  35. {
  36. VM.EpiSetBase.Disable();
  37. return;
  38. }
  39. VM.EpiSetBase.Enable(null);
  40. var info = PartnersData.Instance.GetPartnerAttrByTableId(id);
  41. VM.EpiSetBase.Ctrl.SetData(info?.EpigraphId ?? 0, id, false);
  42. }
  43. }
  44. }