暂无描述
您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. #if SERVICES_SDK_CORE_ENABLED
  2. using UnityEditor.Advertisements;
  3. using UnityEngine.UIElements;
  4. namespace UnityEngine.Advertisements.Editor
  5. {
  6. class GameIdsUi : VisualElement
  7. {
  8. VisualElement m_Container;
  9. public GameIdsUi()
  10. {
  11. m_Container = UiUtils.GetUiFromTemplate(UiConstants.UiTemplatePaths.GameIds);
  12. if (m_Container is null)
  13. {
  14. var message = string.Format(
  15. UiConstants.Formats.TemplateNotFound, nameof(UiConstants.UiTemplatePaths.GameIds));
  16. Debug.LogError(message);
  17. return;
  18. }
  19. Add(m_Container);
  20. RefreshGameIds();
  21. }
  22. public void RefreshGameIds()
  23. {
  24. SetUpGameIdFor(RuntimePlatform.IPhonePlayer, UiConstants.UiElementNames.AppleGameId);
  25. SetUpGameIdFor(RuntimePlatform.Android, UiConstants.UiElementNames.AndroidGameId);
  26. MarkDirtyRepaint();
  27. }
  28. void SetUpGameIdFor(RuntimePlatform platform, string fieldName)
  29. {
  30. var gameIdField = m_Container.Q<TextField>(fieldName);
  31. if (gameIdField is null)
  32. {
  33. return;
  34. }
  35. var gameId = AdvertisementSettings.GetGameId(platform)
  36. ?? UiConstants.LocalizedStrings.Unavailable;
  37. gameIdField.SetValueWithoutNotify(gameId);
  38. }
  39. }
  40. }
  41. #endif