Nessuna descrizione
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

SwitchStoreEditorWindow.cs 1.2KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. using System;
  2. using System.Text.RegularExpressions;
  3. using UnityEngine;
  4. namespace UnityEditor.Purchasing
  5. {
  6. class SwitchStoreEditorWindow : EditorWindow
  7. {
  8. #if UNITY_2019
  9. /// <summary>
  10. /// <seealso cref="https://unity3d.com/unity/whats-new/2019.4.15"/>
  11. /// </summary>
  12. /// <returns>true if API is missing</returns>
  13. static bool IsMissingCreateGUI()
  14. {
  15. var matches = Regex.Match(Application.unityVersion, @"^(\d+)\.(\d+)\.(\d+)");
  16. if (!matches.Success)
  17. {
  18. return false;
  19. }
  20. var major = int.Parse(matches.Groups[1].Value);
  21. var minor = int.Parse(matches.Groups[2].Value);
  22. var patch = int.Parse(matches.Groups[3].Value);
  23. return major <= 2019 && minor <= 4 && patch <= 14;
  24. }
  25. void OnEnable()
  26. {
  27. if (IsMissingCreateGUI())
  28. {
  29. CreateGUI();
  30. }
  31. }
  32. #endif
  33. void CreateGUI()
  34. {
  35. var settingsBlock = PlatformsAndStoresServiceSettingsBlock.CreateStateSpecificBlock(true);
  36. var settingsElement = settingsBlock.GetUIBlockElement();
  37. rootVisualElement.Add(settingsElement);
  38. }
  39. }
  40. }