CommonComCurrencyNestedCtrl.cs 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  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.Database;
  9. using XGame.Framework.UI;
  10. namespace FL.FGUI
  11. {
  12. /// <summary>
  13. /// UI逻辑处理类
  14. /// </summary>
  15. /// <typeparam name=""></typeparam>
  16. public partial class CommonComCurrencyNestedCtrl : UIController<CommonComCurrencyNestedVM>
  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 ShowUI(int currencyId, long count)
  35. {
  36. var currencyInfo = ItemTableRepo.Get(currencyId);
  37. if (currencyInfo != null) VM.CurrencyIcon.icon = currencyInfo?.Icon;
  38. VM.CurrencyLabel.text = count.ToString();
  39. }
  40. public void ShowCostUI(int costId, long costVal)
  41. {
  42. var costItemInfo = ItemTableRepo.Get(costId);
  43. if (costItemInfo != null) VM.CurrencyIcon.icon = costItemInfo?.Icon;
  44. long count = ItemData.Instance.GetItemNum(costId);
  45. VM.CurrencyLabel.text = $"{count}/{costVal}";
  46. }
  47. }
  48. }