PartnerEpiBaseItemCtrl.cs 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  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;
  9. using XGame.Database;
  10. using XGame.Framework;
  11. using XGame.Framework.UI;
  12. namespace FL.FGUI
  13. {
  14. /// <summary>
  15. /// UI逻辑处理类
  16. /// </summary>
  17. /// <typeparam name=""></typeparam>
  18. public partial class PartnerEpiBaseItemCtrl : UIController<PartnerEpiBaseItemVM>
  19. {
  20. protected override void OnEnable(object intent)
  21. {
  22. AddUIListenres();
  23. }
  24. protected override void OnDisable()
  25. {
  26. RemoveUIListenres();
  27. }
  28. #region UI事件
  29. private void AddUIListenres() { }
  30. private void RemoveUIListenres() { }
  31. #endregion
  32. public void SetEpiIcon(int id, bool showStar)
  33. {
  34. var table = EpigraphTableRepo.Get(id);
  35. if (table == null)
  36. {
  37. Log.Error($"铭文表不存在id:{id}");
  38. return;
  39. }
  40. VM.Icon.url = table.Icon;
  41. var info = EpigraphData.Instance.GetEpigraphAttrByTableId(id);
  42. if (info != null && info.StarLv > 0 && showStar)
  43. {
  44. VM.ShowStar.selectedIndex = 0;
  45. var curStarLv = EpigraphData.Instance.GetStarStep(info.StarLv);
  46. VM.Title.text = EpigraphData.Instance.GetCurCtepStarLv(info.StarLv).ToString();
  47. VM.StarIcon.url = AddressableDefine.PartnerStarIconName(curStarLv);
  48. }
  49. else
  50. {
  51. VM.ShowStar.selectedIndex = 1;
  52. }
  53. VM.BgLoader.url = AddressableDefine.EpigraphMwPzDi(table.Quality);
  54. }
  55. }
  56. }