AdvertisementItemView.cs 898 B

123456789101112131415161718192021222324252627282930313233343536
  1. using UnityEditor;
  2. using UnityEngine;
  3. namespace QFramework
  4. {
  5. public class AdvertisementItemView : HorizontalLayout
  6. {
  7. private readonly IXMLView mView = EasyIMGUI.XMLView();
  8. public AdvertisementItemView(string title, string link)
  9. {
  10. Box();
  11. var supportAsset = Resources.Load<TextAsset>("SupportItem");
  12. AddChild(mView.LoadXMLContent(supportAsset.text));
  13. mView.GetById<ILabel>("title").Text(title);
  14. mView.GetById<IButton>("linkBtn")
  15. .Text(LocalText.Open)
  16. .OnClick(() =>
  17. {
  18. Application.OpenURL(link);
  19. });
  20. }
  21. class LocalText
  22. {
  23. public static string Open
  24. {
  25. get { return Language.IsChinese ? "打开" : "Open"; }
  26. }
  27. }
  28. }
  29. }