SentimentWidget.cs 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  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. if (sentimentData == null)
  30. {
  31. transform.Gray();
  32. }
  33. else
  34. {
  35. transform.RecoverColor();
  36. }
  37. }
  38. }
  39. }