SentimentWidget.cs 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. using System.Linq;
  2. using Core.Language;
  3. using Excel2Json;
  4. using Fort23.UTool;
  5. namespace Fort23.Mono
  6. {
  7. [UIBinding(prefab = "SentimentWidget")]
  8. public partial class SentimentWidget : ItemWidgetBasic
  9. {
  10. public AccountFileInfo.SentimentData sentimentData;
  11. private void Init()
  12. {
  13. }
  14. public override void AddEvent()
  15. {
  16. }
  17. public override void DelEvent()
  18. {
  19. }
  20. public override void AddButtonEvent()
  21. {
  22. base.AddButtonEvent();
  23. }
  24. public void CustomInit(int id)
  25. {
  26. sentimentData = AccountFileInfo.Instance.playerData.SentimentDatas.FirstOrDefault(sd => sd.id == id);
  27. SentimentConfig sentimentConfig = ConfigComponent.Instance.Get<SentimentConfig>(id);
  28. Text_Name.text = LanguageManager.Instance.Text(sentimentConfig.name);
  29. Icon_Zi.icon_name = sentimentConfig.icon_Text;
  30. if (sentimentData == null)
  31. {
  32. transform.Gray();
  33. }
  34. else
  35. {
  36. transform.RecoverColor();
  37. }
  38. }
  39. }
  40. }