EventMinLogWidget.cs 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. using System.Collections.Generic;
  2. using Core.Language;
  3. using Excel2Json;
  4. using Fort23.UTool;
  5. namespace Fort23.Mono
  6. {
  7. [UIBinding(prefab = "EventMinLogWidget")]
  8. public partial class EventMinLogWidget : UIComponent
  9. {
  10. private EventConfig eventConfig;
  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. }
  23. public void CustomInit(int id, AccountFileInfo.EventList eventList, List<int> places)
  24. {
  25. eventConfig = ConfigComponent.Instance.Get<EventConfig>(id);
  26. if (eventConfig.SmallPlacesId != 0)
  27. {
  28. SmallPlacesConfig smallPlacesConfig = ConfigComponent.Instance.Get<SmallPlacesConfig>(eventConfig.SmallPlacesId);
  29. PlacesConfig placesConfig = ConfigComponent.Instance.Get<PlacesConfig>(smallPlacesConfig.PlacesId);
  30. Text_MapName.text = $"{LanguageManager.Instance.Text(placesConfig.placeName)}-{LanguageManager.Instance.Text(smallPlacesConfig.placeName)}";
  31. Text_MapName.gameObject.SetActive(true);
  32. }
  33. else if (eventConfig.placeID != 0)
  34. {
  35. PlacesConfig placesConfig = ConfigComponent.Instance.Get<PlacesConfig>(eventConfig.placeID);
  36. Text_MapName.text = LanguageManager.Instance.Text(placesConfig.placeName);
  37. Text_MapName.gameObject.SetActive(true);
  38. }
  39. else
  40. {
  41. Text_MapName.gameObject.SetActive(false);
  42. }
  43. if (eventList == null)
  44. {
  45. Text_Name.text = "???";
  46. }
  47. else
  48. {
  49. Text_Name.text = LanguageManager.Instance.Text(eventConfig.EventName);
  50. }
  51. if (places.Count > 0)
  52. {
  53. if (places.Contains(eventConfig.placeID))
  54. {
  55. transform.RecoverColor();
  56. }
  57. else
  58. {
  59. transform.Gray();
  60. }
  61. }
  62. else
  63. {
  64. transform.RecoverColor();
  65. }
  66. }
  67. }
  68. }