PartnerPartnerBookListItemCtrl.cs 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  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 System.Collections.Generic;
  9. using XGame;
  10. using XGame.Database;
  11. using XGame.Framework.UI;
  12. namespace FL.FGUI
  13. {
  14. /// <summary>
  15. /// UI逻辑处理类
  16. /// </summary>
  17. /// <typeparam name=""></typeparam>
  18. public partial class PartnerPartnerBookListItemCtrl : UIController<PartnerPartnerBookListItemVM>
  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 OnRefresh(int index, int id)
  33. {
  34. var table = PartnerTableRepo.Get(id);
  35. XGame.Framework.Assert.IsNotNull(table, $"圣兵表不存在,id:{id}");
  36. VM.SbLoader.icon = table.Icon;
  37. VM.NameLabel.text = table.Name;
  38. var attr = PartnersData.Instance.GetPartnerAttrByTableId(table.Id);
  39. ShowStar(attr?.RisingStarLv ?? 1);
  40. }
  41. private void ShowStar(int starLv)
  42. {
  43. var curNum = PartnersService.Instance.GetStarLv(starLv);
  44. var curStep = PartnersService.Instance.GetStarStep(starLv);
  45. var list = new List<int>();
  46. for (int i = 0; i < curNum; i++)
  47. {
  48. list.Add(curStep);
  49. }
  50. VM.StarList.BindDatas(list);
  51. }
  52. }
  53. }