PartnerPartnerItemCtrl.cs 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. /// #pkgName FGUI包名
  2. /// #panelName UIPanel名字
  3. /// #UIName = $"{#pkgName}{#panelName}" UIKey名字
  4. /// 该脚本由模板创建
  5. /// created by cb 2024
  6. using FL.Data;
  7. using XGame.Framework.UI;
  8. namespace FL.FGUI
  9. {
  10. /// <summary>
  11. /// UI逻辑处理类
  12. /// </summary>
  13. /// <typeparam name=""></typeparam>
  14. public partial class PartnerPartnerItemCtrl : UIController<PartnerPartnerItemVM>
  15. {
  16. protected override void OnEnable(object intent)
  17. {
  18. AddUIListenres();
  19. }
  20. protected override void OnDisable()
  21. {
  22. RemoveUIListenres();
  23. }
  24. #region UI事件
  25. private void AddUIListenres() { }
  26. private void RemoveUIListenres() { }
  27. #endregion
  28. public void ShowUI(int id, int planId = -1, int slotId = -1)
  29. {
  30. VM.PartnerBase.Ctrl.ShowUI(id, true);
  31. if(planId >= 0 && slotId >= 0)
  32. {
  33. var slot = PartnersData.Instance.GetPlanSlot(planId,slotId);
  34. VM.EpiSetBase.Ctrl.SetData(slot?.MwId ?? 0, id, false);
  35. }
  36. else
  37. {
  38. var info = PartnersData.Instance.GetPartnerAttrByTableId(id);
  39. VM.EpiSetBase.Ctrl.SetData(info?.EpigraphId ?? 0, id, false);
  40. }
  41. bool isEmpty = id <= 0;
  42. VM.IsEmpty.selectedIndex = isEmpty ? 1 : 0;
  43. }
  44. }
  45. }