PartnerMwSetBaseCtrl.cs 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  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;
  9. using XGame.Framework.UI;
  10. namespace FL.FGUI
  11. {
  12. /// <summary>
  13. /// UI逻辑处理类
  14. /// </summary>
  15. /// <typeparam name=""></typeparam>
  16. public partial class PartnerMwSetBaseCtrl : UIController<PartnerMwSetBaseVM>
  17. {
  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. }
  30. private void RemoveUIListenres()
  31. {
  32. }
  33. #endregion
  34. public void SetData(int mwId, int sbId, bool showStar)
  35. {
  36. if (sbId <= 0)
  37. return;
  38. var sbTable = PartnerTableRepo.Get(sbId);
  39. if (sbTable == null)
  40. {
  41. Log.Debug($"圣兵不存在id:{sbId}");
  42. return;
  43. }
  44. VM.EmptyDiLoader.url = AddressableDefine.EpigraphEmptyPz((int)sbTable.Quality);
  45. if (mwId > 0)
  46. {
  47. var table = EpigraphTableRepo.Get(mwId);
  48. if (table == null)
  49. {
  50. Log.Debug($"铭文不存在id:{mwId}");
  51. return;
  52. }
  53. VM.InSet.selectedIndex = 0;
  54. VM.EpiIcon.Enable(null);
  55. VM.EpiIcon.Ctrl.SetEpiIcon(mwId, showStar);
  56. }
  57. else
  58. {
  59. VM.InSet.selectedIndex = 1;
  60. VM.EpiIcon.Disable();
  61. }
  62. }
  63. }
  64. }